mirror of
https://github.com/sharkdp/bat.git
synced 2025-11-01 15:41:57 +00:00
Compare commits
1 Commits
v0.19.0
...
create_hig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
271842d87c |
13
.github/workflows/CICD.yml
vendored
13
.github/workflows/CICD.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: CICD
|
name: CICD
|
||||||
|
|
||||||
env:
|
env:
|
||||||
MIN_SUPPORTED_RUST_VERSION: "1.51.0"
|
MIN_SUPPORTED_RUST_VERSION: "1.46.0"
|
||||||
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -27,15 +27,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: cargo fmt -- --check
|
- run: cargo fmt -- --check
|
||||||
|
|
||||||
license_checks:
|
|
||||||
name: License checks
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: true # we especially want to perform license checks on submodules
|
|
||||||
- run: tests/scripts/license-checks.sh
|
|
||||||
|
|
||||||
min_version:
|
min_version:
|
||||||
name: Minimum supported rust version
|
name: Minimum supported rust version
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
@@ -54,7 +45,7 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: clippy
|
command: clippy
|
||||||
args: --locked --all-targets --all-features
|
args: --locked --all-targets --all-features -- --allow clippy::unknown_clippy_lints
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
15
.gitmodules
vendored
15
.gitmodules
vendored
@@ -67,6 +67,9 @@
|
|||||||
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
||||||
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
||||||
url = https://github.com/babel/babel-sublime
|
url = https://github.com/babel/babel-sublime
|
||||||
|
[submodule "assets/syntaxes/Dart"]
|
||||||
|
path = assets/syntaxes/02_Extra/Dart
|
||||||
|
url = https://github.com/guillermooo/dart-sublime-bundle
|
||||||
[submodule "assets/syntaxes/FSharp"]
|
[submodule "assets/syntaxes/FSharp"]
|
||||||
path = assets/syntaxes/02_Extra/FSharp
|
path = assets/syntaxes/02_Extra/FSharp
|
||||||
url = https://github.com/hoest/sublimetext-fsharp
|
url = https://github.com/hoest/sublimetext-fsharp
|
||||||
@@ -110,6 +113,9 @@
|
|||||||
[submodule "assets/syntaxes/Org mode"]
|
[submodule "assets/syntaxes/Org mode"]
|
||||||
path = assets/syntaxes/02_Extra/Org mode
|
path = assets/syntaxes/02_Extra/Org mode
|
||||||
url = https://github.com/jezcope/Org.tmbundle.git
|
url = https://github.com/jezcope/Org.tmbundle.git
|
||||||
|
[submodule "assets/syntaxes/requirementstxt"]
|
||||||
|
path = assets/syntaxes/02_Extra/requirementstxt
|
||||||
|
url = https://github.com/wuub/requirementstxt
|
||||||
[submodule "assets/syntaxes/DotENV"]
|
[submodule "assets/syntaxes/DotENV"]
|
||||||
path = assets/syntaxes/02_Extra/DotENV
|
path = assets/syntaxes/02_Extra/DotENV
|
||||||
url = https://github.com/zaynali53/DotENV
|
url = https://github.com/zaynali53/DotENV
|
||||||
@@ -197,9 +203,6 @@
|
|||||||
[submodule "assets/syntaxes/02_Extra/Lean"]
|
[submodule "assets/syntaxes/02_Extra/Lean"]
|
||||||
path = assets/syntaxes/02_Extra/Lean
|
path = assets/syntaxes/02_Extra/Lean
|
||||||
url = https://github.com/leanprover/vscode-lean.git
|
url = https://github.com/leanprover/vscode-lean.git
|
||||||
[submodule "assets/syntaxes/02_Extra/LiveScript"]
|
|
||||||
path = assets/syntaxes/02_Extra/LiveScript
|
|
||||||
url = https://github.com/paulmillr/LiveScript.tmbundle
|
|
||||||
[submodule "assets/syntaxes/02_Extra/Zig"]
|
[submodule "assets/syntaxes/02_Extra/Zig"]
|
||||||
path = assets/syntaxes/02_Extra/Zig
|
path = assets/syntaxes/02_Extra/Zig
|
||||||
url = https://github.com/ziglang/sublime-zig-language.git
|
url = https://github.com/ziglang/sublime-zig-language.git
|
||||||
@@ -230,9 +233,3 @@
|
|||||||
[submodule "assets/syntaxes/02_Extra/Racket"]
|
[submodule "assets/syntaxes/02_Extra/Racket"]
|
||||||
path = assets/syntaxes/02_Extra/Racket
|
path = assets/syntaxes/02_Extra/Racket
|
||||||
url = https://github.com/follesoe/sublime-racket.git
|
url = https://github.com/follesoe/sublime-racket.git
|
||||||
[submodule "assets/syntaxes/02_Extra/MediaWiki"]
|
|
||||||
path = assets/syntaxes/02_Extra/MediaWiki
|
|
||||||
url = https://github.com/tosher/Mediawiker.git
|
|
||||||
[submodule "assets/syntaxes/02_Extra/Dart"]
|
|
||||||
path = assets/syntaxes/02_Extra/Dart
|
|
||||||
url = https://github.com/elMuso/Dartlight.git
|
|
||||||
|
|||||||
39
CHANGELOG.md
39
CHANGELOG.md
@@ -1,32 +1,25 @@
|
|||||||
# v0.19.0
|
# unreleased
|
||||||
|
|
||||||
## Performance
|
|
||||||
|
|
||||||
- Reduce startup time in loop-through mode (e.g. when redirecting output) by 90%. See #1747 (@Enselic)
|
|
||||||
- Load themes lazily to make bat start 25% faster when disregarding syntax load time. See #1969 (@Enselic)
|
|
||||||
- Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall)
|
|
||||||
- Fix for poor performance when ANSI escape sequences are piped to `bat`, see #1596 (@eth-p)
|
|
||||||
- Fix for incorrect handling of ANSI escape sequences when using `--wrap=never`, see #1596 (@eth-p)
|
|
||||||
- Load custom assets as fast as integrated assets, see #1753 (@Enselic)
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Support for `x:-delta` (minus) syntax in line ranges (e.g. `20:-10`). See #1901 (@bojan88)
|
|
||||||
- Support for `--ignored-suffix` argument. See #1892 (@bojan88)
|
|
||||||
- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
|
- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
|
||||||
- Support for `x:+delta` syntax in line ranges (e.g. `20:+10`). See #1810 (@bojan88)
|
- Support for `x:+delta` syntax in line ranges (e.g. `20:+10`). See #1810 (@bojan88)
|
||||||
- Add new `--acknowledgements` option that gives credit to theme and syntax definition authors. See #1971 (@Enselic)
|
|
||||||
- Include git hash in `bat -V` and `bat --version` output if present. See #1921 (@Enselic)
|
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
|
- Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall)
|
||||||
- First line not shown in diff context. See #1891 (@divagant-martian)
|
- First line not shown in diff context. See #1891 (@divagant-martian)
|
||||||
- Do not ignore syntaxes that handle file names with a `*.conf` extension. See #1703 (@cbolgiano)
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
- Load cached assets as fast as integrated assets, see #1753 (@Enselic)
|
||||||
|
- Greatly reduce startup time in loop-through mode, e.g. when redirecting output. Instead of *50 ms* - *100 ms*, startup takes *5 ms* - *10 ms*. See #1747 (@Enselic)
|
||||||
|
- Reduce startup time by approximately 80% for 91 out of 168 syntaxes when using `--language`. See #1787 (@Enselic)
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
- Add PowerShell completion, see #1826 (@rashil2000)
|
- Add PowerShell completion, see #1826 (@rashil2000)
|
||||||
- Minimum supported Rust version (MSRV) bumped to 1.51, see #1994 (@mdibaiee)
|
- Minimum supported Rust version (MSRV) bumped to 1.46
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
@@ -37,20 +30,16 @@
|
|||||||
- Syslog highlighting improvements, see #1793 (@scop)
|
- Syslog highlighting improvements, see #1793 (@scop)
|
||||||
- Added support for `slim` syntax, see #1693 (@mfinelli)
|
- Added support for `slim` syntax, see #1693 (@mfinelli)
|
||||||
- Racket, see #1884 (@jubnzv)
|
- Racket, see #1884 (@jubnzv)
|
||||||
- LiveScript, see #1915 (@Enselic)
|
|
||||||
- MediaWiki, see #1925 (@sorairolake)
|
## New themes
|
||||||
- The `requirements.txt` syntax has been removed due to incompatible license requirements.
|
|
||||||
- Dart, new highlighter, see #1959 (@Ersikan)
|
|
||||||
- SCSS and Sass syntaxes updated, see #1766 (@Enselic)
|
|
||||||
- PowerShell syntax updated, see #1935 (@Enselic)
|
|
||||||
- TypeScript syntax updated, see #1834 (@Enselic)
|
|
||||||
|
|
||||||
## `bat` as a library
|
## `bat` as a library
|
||||||
|
|
||||||
- Deprecate `HighlightingAssets::syntaxes()` and `HighlightingAssets::syntax_for_file_name()`. Use `HighlightingAssets::get_syntaxes()` and `HighlightingAssets::get_syntax_for_path()` instead. They return a `Result` which is needed for upcoming lazy-loading work to improve startup performance. They also return which `SyntaxSet` the returned `SyntaxReference` belongs to. See #1747, #1755, #1776, #1862 (@Enselic)
|
- Deprecate `HighlightingAssets::syntaxes()` and `HighlightingAssets::syntax_for_file_name()`. Use `HighlightingAssets::get_syntaxes()` and `HighlightingAssets::get_syntax_for_path()` instead. They return a `Result` which is needed for upcoming lazy-loading work to improve startup performance. They also return which `SyntaxSet` the returned `SyntaxReference` belongs to. See #1747, #1755, #1776, #1862 (@Enselic)
|
||||||
- Remove `HighlightingAssets::from_files` and `HighlightingAssets::save_to_cache`. Instead of calling the former and then the latter you now make a single call to `bat::assets::build`. See #1802, #1971 (@Enselic)
|
- Remove `HighlightingAssets::from_files` and `HighlightingAssets::save_to_cache`. Instead of calling the former and then the latter you now make a single call to `bat::assets::build`. See #1802 (@Enselic)
|
||||||
- Replace the `error::Error(error::ErrorKind, _)` struct and enum with an `error::Error` enum. `Error(ErrorKind::UnknownSyntax, _)` becomes `Error::UnknownSyntax`, etc. Also remove the `error::ResultExt` trait. These changes stem from replacing `error-chain` with `thiserror`. See #1820 (@Enselic)
|
- Replace the `error::Error(error::ErrorKind, _)` struct and enum with an `error::Error` enum. `Error(ErrorKind::UnknownSyntax, _)` becomes `Error::UnknownSyntax`, etc. Also remove the `error::ResultExt` trait. These changes stem from replacing `error-chain` with `thiserror`. See #1820 (@Enselic)
|
||||||
- Add new `MappingTarget` enum variant `MapExtensionToUnknown`. Refer to its documentation for more information. Also mark `MappingTarget` as `#[non_exhaustive]` since more enum variants might be added in the future. See #1703 (@cbolgiano), #2012 (@Enselic)
|
|
||||||
|
|
||||||
|
|
||||||
# v0.18.3
|
# v0.18.3
|
||||||
|
|||||||
336
Cargo.lock
generated
336
Cargo.lock
generated
@@ -26,6 +26,15 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi_term"
|
name = "ansi_term"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -37,9 +46,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "assert_cmd"
|
name = "assert_cmd"
|
||||||
version = "2.0.2"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e996dc7940838b7ef1096b882e29ec30a3149a3a443cdc8dba19ed382eca1fe2"
|
checksum = "b800c4403e8105d959595e1f88119e78bc12bc874c4336973658b648a746ba93"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"doc-comment",
|
"doc-comment",
|
||||||
@@ -74,10 +83,10 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bat"
|
name = "bat"
|
||||||
version = "0.19.0"
|
version = "0.18.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_colours",
|
"ansi_colours",
|
||||||
"ansi_term",
|
"ansi_term 0.12.1",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
"atty",
|
"atty",
|
||||||
"bincode",
|
"bincode",
|
||||||
@@ -92,11 +101,11 @@ dependencies = [
|
|||||||
"git2",
|
"git2",
|
||||||
"globset",
|
"globset",
|
||||||
"grep-cli",
|
"grep-cli",
|
||||||
|
"lazy_static",
|
||||||
|
"lazycell",
|
||||||
"nix",
|
"nix",
|
||||||
"once_cell",
|
|
||||||
"path_abs",
|
"path_abs",
|
||||||
"predicates",
|
"predicates",
|
||||||
"regex",
|
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
@@ -107,7 +116,6 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"wait-timeout",
|
"wait-timeout",
|
||||||
"walkdir",
|
|
||||||
"wild",
|
"wild",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -143,9 +151,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bstr"
|
name = "bstr"
|
||||||
version = "0.2.17"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -164,10 +172,16 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "byteorder"
|
||||||
version = "1.0.72"
|
version = "1.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
|
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.67"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
]
|
]
|
||||||
@@ -179,12 +193,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "chrono"
|
||||||
version = "2.34.0"
|
version = "0.4.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "2.33.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term 0.11.0",
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"strsim",
|
"strsim",
|
||||||
@@ -208,13 +232,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.15.0"
|
version = "0.14.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31"
|
checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"encode_unicode",
|
"encode_unicode",
|
||||||
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"once_cell",
|
|
||||||
"regex",
|
"regex",
|
||||||
"terminal_size",
|
"terminal_size",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
@@ -232,9 +256,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
version = "1.3.0"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836"
|
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@@ -272,6 +296,12 @@ version = "0.3.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dtoa"
|
||||||
|
version = "0.4.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.6.1"
|
version = "1.6.1"
|
||||||
@@ -397,9 +427,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.3"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
|
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -408,9 +438,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git-version"
|
name = "git-version"
|
||||||
version = "0.3.5"
|
version = "0.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899"
|
checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"git-version-macro",
|
"git-version-macro",
|
||||||
"proc-macro-hack",
|
"proc-macro-hack",
|
||||||
@@ -418,9 +448,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git-version-macro"
|
name = "git-version-macro"
|
||||||
version = "0.3.5"
|
version = "0.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f"
|
checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-hack",
|
"proc-macro-hack",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -430,9 +460,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git2"
|
name = "git2"
|
||||||
version = "0.13.25"
|
version = "0.13.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
|
checksum = "d9831e983241f8c5591ed53f17d874833e2fa82cac2625f3888c50cbfe136cba"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -479,15 +509,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.11.2"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.19"
|
version = "0.1.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -505,9 +535,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.7.0"
|
version = "1.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@@ -515,39 +545,33 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instant"
|
name = "instant"
|
||||||
version = "0.1.12"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.10.3"
|
version = "0.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
|
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.8"
|
version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
version = "0.1.24"
|
version = "0.1.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
|
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -566,15 +590,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.112"
|
version = "0.2.103"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
name = "libgit2-sys"
|
||||||
version = "0.12.26+1.3.0"
|
version = "0.12.21+1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
|
checksum = "86271bacd72b2b9e854c3dcfb82efd538f15f870e4c11af66900effb462f6825"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -611,9 +635,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.5"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
|
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
@@ -629,21 +653,21 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matches"
|
name = "matches"
|
||||||
version = "0.1.9"
|
version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.4.1"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
@@ -660,9 +684,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.23.1"
|
version = "0.23.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
|
checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cc",
|
"cc",
|
||||||
@@ -677,6 +701,16 @@ version = "0.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
|
checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
@@ -686,17 +720,11 @@ dependencies = [
|
|||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "once_cell"
|
|
||||||
version = "1.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "onig"
|
name = "onig"
|
||||||
version = "6.3.1"
|
version = "6.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225"
|
checksum = "30b46fd9edbc018f0be4e366c24c46db44fac49cd01c039ae85308088b089dd5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -706,9 +734,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "onig_sys"
|
name = "onig_sys"
|
||||||
version = "69.7.1"
|
version = "69.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e"
|
checksum = "ed063c96cf4c0f2e5d09324409d158b38a0a85a7b90fbd68c8cad75c495d5775"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
@@ -716,9 +744,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.11.2"
|
version = "0.11.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"instant",
|
"instant",
|
||||||
"lock_api",
|
"lock_api",
|
||||||
@@ -727,9 +755,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot_core"
|
name = "parking_lot_core"
|
||||||
version = "0.8.5"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
|
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"instant",
|
"instant",
|
||||||
@@ -756,35 +784,35 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.24"
|
version = "0.3.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plist"
|
name = "plist"
|
||||||
version = "1.3.1"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225"
|
checksum = "679104537029ed2287c216bfb942bbf723f48ee98f0aef15611634173a74ef21"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
|
"chrono",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"line-wrap",
|
"line-wrap",
|
||||||
"serde",
|
"serde",
|
||||||
"time",
|
|
||||||
"xml-rs",
|
"xml-rs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.16"
|
version = "0.2.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "predicates"
|
name = "predicates"
|
||||||
version = "2.1.0"
|
version = "2.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95e5a7689e456ab905c22c2b48225bb921aba7c8dfa58440d68ba13f6222a715"
|
checksum = "c143348f141cc87aab5b950021bac6145d0e5ae754b0591de23244cee42c9308"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"difflib",
|
"difflib",
|
||||||
"float-cmp",
|
"float-cmp",
|
||||||
@@ -802,12 +830,12 @@ checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "predicates-tree"
|
name = "predicates-tree"
|
||||||
version = "1.0.4"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "338c7be2905b732ae3984a2f40032b5e94fd8f52505b186c7d4d68d193445df7"
|
checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"predicates-core",
|
"predicates-core",
|
||||||
"termtree",
|
"treeline",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -818,27 +846,27 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.36"
|
version = "1.0.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.14"
|
version = "1.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
|
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.8.4"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
|
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rand_chacha",
|
"rand_chacha",
|
||||||
@@ -848,9 +876,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_chacha"
|
name = "rand_chacha"
|
||||||
version = "0.3.1"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
@@ -858,27 +886,27 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.6.3"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_hc"
|
name = "rand_hc"
|
||||||
version = "0.3.1"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
|
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand_core",
|
"rand_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.10"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
|
checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
@@ -906,9 +934,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-automata"
|
name = "regex-automata"
|
||||||
version = "0.1.10"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
@@ -927,9 +958,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.9"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "safemem"
|
name = "safemem"
|
||||||
@@ -960,18 +991,18 @@ checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.133"
|
version = "1.0.130"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a"
|
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.133"
|
version = "1.0.130"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537"
|
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -980,23 +1011,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.74"
|
version = "1.0.64"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.1",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.8.23"
|
version = "0.8.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0"
|
checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"dtoa",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"ryu",
|
|
||||||
"serde",
|
"serde",
|
||||||
"yaml-rust",
|
"yaml-rust",
|
||||||
]
|
]
|
||||||
@@ -1037,9 +1068,9 @@ checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.7.0"
|
version = "1.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
|
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "std_prelude"
|
name = "std_prelude"
|
||||||
@@ -1055,9 +1086,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.85"
|
version = "1.0.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
|
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -1089,9 +1120,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sys-info"
|
name = "sys-info"
|
||||||
version = "0.9.1"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c"
|
checksum = "33fcecee49339531cf6bd84ecf3ed94f9c8ef4a7e700f2a1cac9cc1ca485383a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -1132,20 +1163,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "terminal_size"
|
name = "terminal_size"
|
||||||
version = "0.1.17"
|
version = "0.1.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
|
checksum = "86ca8ced750734db02076f44132d802af0b33b09942331f4459dde8636fd2406"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "termtree"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textwrap"
|
name = "textwrap"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
@@ -1158,39 +1183,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.30"
|
version = "1.0.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
|
checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.30"
|
version = "1.0.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
|
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad"
|
|
||||||
dependencies = [
|
|
||||||
"itoa 0.4.8",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.5.1"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
|
checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tinyvec_macros",
|
"tinyvec_macros",
|
||||||
]
|
]
|
||||||
@@ -1202,16 +1217,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi"
|
name = "treeline"
|
||||||
version = "0.3.7"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
|
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-bidi"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
|
||||||
|
dependencies = [
|
||||||
|
"matches",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-normalization"
|
name = "unicode-normalization"
|
||||||
version = "0.1.19"
|
version = "0.1.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
|
checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
]
|
]
|
||||||
@@ -1242,9 +1266,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.15"
|
version = "0.2.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vec_map"
|
name = "vec_map"
|
||||||
@@ -1320,9 +1344,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xml-rs"
|
name = "xml-rs"
|
||||||
version = "0.8.4"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
|
checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yaml-rust"
|
name = "yaml-rust"
|
||||||
|
|||||||
22
Cargo.toml
22
Cargo.toml
@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
|
|||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
name = "bat"
|
name = "bat"
|
||||||
repository = "https://github.com/sharkdp/bat"
|
repository = "https://github.com/sharkdp/bat"
|
||||||
version = "0.19.0"
|
version = "0.18.3"
|
||||||
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
edition = '2018'
|
edition = '2018'
|
||||||
@@ -27,6 +27,7 @@ minimal-application = [
|
|||||||
"atty",
|
"atty",
|
||||||
"clap",
|
"clap",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
|
"lazy_static",
|
||||||
"paging",
|
"paging",
|
||||||
"regex-onig",
|
"regex-onig",
|
||||||
"wild",
|
"wild",
|
||||||
@@ -34,7 +35,7 @@ minimal-application = [
|
|||||||
git = ["git2"] # Support indicating git modifications
|
git = ["git2"] # Support indicating git modifications
|
||||||
paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
|
paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
|
||||||
# Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
|
# Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
|
||||||
build-assets = ["syntect/yaml-load", "syntect/dump-create", "regex", "walkdir"]
|
build-assets = ["syntect/yaml-load", "syntect/dump-create"]
|
||||||
|
|
||||||
# You need to use one of these if you depend on bat as a library:
|
# You need to use one of these if you depend on bat as a library:
|
||||||
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||||
@@ -45,9 +46,10 @@ atty = { version = "0.2.14", optional = true }
|
|||||||
ansi_term = "^0.12.1"
|
ansi_term = "^0.12.1"
|
||||||
ansi_colours = "^1.0"
|
ansi_colours = "^1.0"
|
||||||
bincode = "1.0"
|
bincode = "1.0"
|
||||||
console = "0.15.0"
|
console = "0.14.1"
|
||||||
flate2 = "1.0"
|
flate2 = "1.0"
|
||||||
once_cell = "1.9"
|
lazy_static = { version = "1.4", optional = true }
|
||||||
|
lazycell = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
wild = { version = "2.0", optional = true }
|
wild = { version = "2.0", optional = true }
|
||||||
content_inspector = "0.2.4"
|
content_inspector = "0.2.4"
|
||||||
@@ -63,8 +65,6 @@ clircle = "0.3"
|
|||||||
bugreport = { version = "0.4", optional = true }
|
bugreport = { version = "0.4", optional = true }
|
||||||
dirs-next = { version = "2.0.0", optional = true }
|
dirs-next = { version = "2.0.0", optional = true }
|
||||||
grep-cli = { version = "0.1.6", optional = true }
|
grep-cli = { version = "0.1.6", optional = true }
|
||||||
regex = { version = "1.0", optional = true }
|
|
||||||
walkdir = { version = "2.0", optional = true }
|
|
||||||
|
|
||||||
[dependencies.git2]
|
[dependencies.git2]
|
||||||
version = "0.13"
|
version = "0.13"
|
||||||
@@ -77,23 +77,23 @@ default-features = false
|
|||||||
features = ["parsing"]
|
features = ["parsing"]
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "2.34"
|
version = "2.33"
|
||||||
optional = true
|
optional = true
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["suggestions", "color", "wrap_help"]
|
features = ["suggestions", "color", "wrap_help"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "2.0.2"
|
assert_cmd = "2.0.1"
|
||||||
serial_test = "0.5.1"
|
serial_test = "0.5.1"
|
||||||
predicates = "2.1.0"
|
predicates = "2.0.2"
|
||||||
wait-timeout = "0.2.0"
|
wait-timeout = "0.2.0"
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
nix = "0.23.1"
|
nix = "0.23.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = { version = "2.34", optional = true }
|
clap = { version = "2.33", optional = true }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
|||||||
6
NOTICE
6
NOTICE
@@ -1,6 +0,0 @@
|
|||||||
Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
|
|
||||||
|
|
||||||
bat is made available under the terms of either the MIT License or the Apache
|
|
||||||
License 2.0, at your option.
|
|
||||||
|
|
||||||
See the LICENSE-APACHE and LICENSE-MIT files for license details.
|
|
||||||
28
README.md
28
README.md
@@ -13,7 +13,7 @@
|
|||||||
<a href="#customization">Customization</a> •
|
<a href="#customization">Customization</a> •
|
||||||
<a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
|
<a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
|
||||||
[English]
|
[English]
|
||||||
[<a href="doc/README-zh.md">中文</a>]
|
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
|
||||||
[<a href="doc/README-ja.md">日本語</a>]
|
[<a href="doc/README-ja.md">日本語</a>]
|
||||||
[<a href="doc/README-ko.md">한국어</a>]
|
[<a href="doc/README-ko.md">한국어</a>]
|
||||||
[<a href="doc/README-ru.md">Русский</a>]
|
[<a href="doc/README-ru.md">Русский</a>]
|
||||||
@@ -42,7 +42,7 @@ characters:
|
|||||||
|
|
||||||
### Automatic paging
|
### Automatic paging
|
||||||
|
|
||||||
By default, `bat` pipes its own output to a pager (e.g. `less`) if the output is too large for one screen.
|
By default, `bat` pipes its own output to a pager (e.g `less`) if the output is too large for one screen.
|
||||||
If you would rather `bat` work like `cat` all the time (never page output), you can set `--paging=never` as an option, either on the command line or in your configuration file.
|
If you would rather `bat` work like `cat` all the time (never page output), you can set `--paging=never` as an option, either on the command line or in your configuration file.
|
||||||
If you intend to alias `cat` to `bat` in your shell configuration, you can use `alias cat='bat --paging=never'` to preserve the default behavior.
|
If you intend to alias `cat` to `bat` in your shell configuration, you can use `alias cat='bat --paging=never'` to preserve the default behavior.
|
||||||
|
|
||||||
@@ -103,23 +103,19 @@ bat f - g # output 'f', then stdin, then 'g'.
|
|||||||
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
||||||
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||||
option to restrict the load times for long files:
|
option to restrict the load times for long files:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||||
```
|
```
|
||||||
|
For more information, see [`fzf`s `README`](https://github.com/junegunn/fzf#preview-window).
|
||||||
For more information, see [`fzf`'s `README`](https://github.com/junegunn/fzf#preview-window).
|
|
||||||
|
|
||||||
#### `find` or `fd`
|
#### `find` or `fd`
|
||||||
|
|
||||||
You can use the `-exec` option of `find` to preview all search results with `bat`:
|
You can use the `-exec` option of `find` to preview all search results with `bat`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
find … -exec bat {} +
|
find … -exec bat {} +
|
||||||
```
|
```
|
||||||
|
|
||||||
If you happen to use [`fd`](https://github.com/sharkdp/fd), you can use the `-X`/`--exec-batch` option to do the same:
|
If you happen to use [`fd`](https://github.com/sharkdp/fd), you can use the `-X`/`--exec-batch` option to do the same:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fd … -X bat
|
fd … -X bat
|
||||||
```
|
```
|
||||||
@@ -135,11 +131,9 @@ batgrep needle src/
|
|||||||
#### `tail -f`
|
#### `tail -f`
|
||||||
|
|
||||||
`bat` can be combined with `tail -f` to continuously monitor a given file with syntax highlighting.
|
`bat` can be combined with `tail -f` to continuously monitor a given file with syntax highlighting.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that we have to switch off paging in order for this to work. We have also specified the syntax
|
Note that we have to switch off paging in order for this to work. We have also specified the syntax
|
||||||
explicitly (`-l log`), as it can not be auto-detected in this case.
|
explicitly (`-l log`), as it can not be auto-detected in this case.
|
||||||
|
|
||||||
@@ -147,7 +141,6 @@ explicitly (`-l log`), as it can not be auto-detected in this case.
|
|||||||
|
|
||||||
You can combine `bat` with `git show` to view an older version of a given file with proper syntax
|
You can combine `bat` with `git show` to view an older version of a given file with proper syntax
|
||||||
highlighting:
|
highlighting:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git show v0.6.0:src/main.rs | bat -l rs
|
git show v0.6.0:src/main.rs | bat -l rs
|
||||||
```
|
```
|
||||||
@@ -184,7 +177,7 @@ bat main.cpp | xclip
|
|||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
man 2 select
|
man 2 select
|
||||||
```
|
```
|
||||||
(replace `bat` with `batcat` if you are on Debian or Ubuntu)
|
(replace `bat` by `batcat` if you are on Debian or Ubuntu)
|
||||||
|
|
||||||
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
||||||
formatting problems.
|
formatting problems.
|
||||||
@@ -212,7 +205,7 @@ The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.
|
|||||||
If your Ubuntu/Debian installation is new enough you can simply run:
|
If your Ubuntu/Debian installation is new enough you can simply run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install bat
|
apt install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important**: If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
**Important**: If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||||
@@ -387,7 +380,7 @@ binaries are also available: look for archives with `musl` in the file name.
|
|||||||
|
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
If you want to build `bat` from source, you need Rust 1.51 or
|
If you want to build `bat` from source, you need Rust 1.46 or
|
||||||
higher. You can then use `cargo` to build everything:
|
higher. You can then use `cargo` to build everything:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -592,7 +585,7 @@ alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /de
|
|||||||
|
|
||||||
`bat` can also be customized with a configuration file. The location of the file is dependent
|
`bat` can also be customized with a configuration file. The location of the file is dependent
|
||||||
on your operating system. To get the default path for your system, call
|
on your operating system. To get the default path for your system, call
|
||||||
```bash
|
```
|
||||||
bat --config-file
|
bat --config-file
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -674,13 +667,6 @@ bat() {
|
|||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Garbled output
|
|
||||||
|
|
||||||
If an input file contains color codes or other ANSI escape sequences or control characters, `bat` will have problems
|
|
||||||
performing syntax highlighting and text wrapping, and thus the output can become garbled.
|
|
||||||
When displaying such files it is recommended to disable both syntax highlighting and wrapping by
|
|
||||||
passing the `--color=never --wrap=never` options to `bat`.
|
|
||||||
|
|
||||||
### Terminals & colors
|
### Terminals & colors
|
||||||
|
|
||||||
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
||||||
|
|||||||
BIN
assets/acknowledgements.bin
vendored
BIN
assets/acknowledgements.bin
vendored
Binary file not shown.
16
assets/create.sh
vendored
16
assets/create.sh
vendored
@@ -46,7 +46,6 @@ bat cache --clear
|
|||||||
# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
|
# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
|
||||||
# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
|
# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
|
||||||
|
|
||||||
# Apply patches
|
|
||||||
(
|
(
|
||||||
cd "$ASSET_DIR"
|
cd "$ASSET_DIR"
|
||||||
for patch in patches/*.patch; do
|
for patch in patches/*.patch; do
|
||||||
@@ -54,16 +53,11 @@ bat cache --clear
|
|||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
reverse_patches() {
|
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
||||||
(
|
|
||||||
|
(
|
||||||
cd "$ASSET_DIR"
|
cd "$ASSET_DIR"
|
||||||
for patch in patches/*.patch; do
|
for patch in patches/*.patch; do
|
||||||
patch --strip=0 --reverse <"$patch"
|
patch --strip=0 --reverse < "$patch"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
# Make sure to always reverse patches, even if the `bat cache` command fails or aborts
|
|
||||||
trap reverse_patches EXIT
|
|
||||||
|
|
||||||
bat cache --build --blank --acknowledgements --source="$ASSET_DIR" --target="$ASSET_DIR"
|
|
||||||
|
|||||||
2
assets/manual/bat.1.in
vendored
2
assets/manual/bat.1.in
vendored
@@ -118,8 +118,6 @@ which pager is used, see the '\-\-pager' option. Possible values: *auto*, never,
|
|||||||
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
||||||
environment variables. The default pager is 'less'. To control when the pager is used, see
|
environment variables. The default pager is 'less'. To control when the pager is used, see
|
||||||
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
||||||
|
|
||||||
Note: By default, if the pager is set to 'less' (and no command-line options are specified), 'bat' will pass the following command line options to the pager: '-R'/'--RAW-CONTROL-CHARS', '-F'/'--quit-if-one-screen' and '-X'/'--no-init'. The last option ('-X') is only used for 'less' versions older than 530. The '-R' option is needed to interpret ANSI colors correctly. The second option ('-F') instructs less to exit immediately if the output size is smaller than the vertical size of the terminal. This is convenient for small files because you do not have to press 'q' to quit the pager. The third option ('-X') is needed to fix a bug with the '--quit-if-one-screen' feature in old versions of 'less'. Unfortunately, it also breaks mouse-wheel support in 'less'. If you want to enable mouse-wheel scrolling on older versions of 'less', you can pass just '-R' (as in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer, it should work out of the box.
|
|
||||||
.HP
|
.HP
|
||||||
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
||||||
.IP
|
.IP
|
||||||
|
|||||||
BIN
assets/minimal_syntaxes.bin
vendored
Normal file
BIN
assets/minimal_syntaxes.bin
vendored
Normal file
Binary file not shown.
13
assets/patches/MediaWiki.sublime-syntax.patch
vendored
13
assets/patches/MediaWiki.sublime-syntax.patch
vendored
@@ -1,13 +0,0 @@
|
|||||||
diff --git syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax
|
|
||||||
index f542c9e..8eaf020 100644
|
|
||||||
--- syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax
|
|
||||||
+++ syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
|
||||||
-name: Mediawiki NG
|
|
||||||
+name: MediaWiki
|
|
||||||
file_extensions: [mediawiki, wikipedia, wiki]
|
|
||||||
scope: text.html.mediawiki
|
|
||||||
|
|
||||||
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/Dart
vendored
2
assets/syntaxes/02_Extra/Dart
vendored
Submodule assets/syntaxes/02_Extra/Dart updated: 2734901b01...d891fb36c9
342
assets/syntaxes/02_Extra/Dart.sublime-syntax
vendored
342
assets/syntaxes/02_Extra/Dart.sublime-syntax
vendored
@@ -1,6 +1,6 @@
|
|||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
---
|
---
|
||||||
# http://www.sublimetext.com/docs/syntax.html
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
name: Dart
|
name: Dart
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- dart
|
- dart
|
||||||
@@ -9,7 +9,7 @@ contexts:
|
|||||||
main:
|
main:
|
||||||
- match: ^(#!.*)$
|
- match: ^(#!.*)$
|
||||||
scope: meta.preprocessor.script.dart
|
scope: meta.preprocessor.script.dart
|
||||||
- match: ^\w*\b(library|import|part of|part|export)\b
|
- match: ^\s*\b(library|import|export|part of|part)\b
|
||||||
captures:
|
captures:
|
||||||
0: keyword.other.import.dart
|
0: keyword.other.import.dart
|
||||||
push:
|
push:
|
||||||
@@ -19,114 +19,242 @@ contexts:
|
|||||||
0: punctuation.terminator.dart
|
0: punctuation.terminator.dart
|
||||||
pop: true
|
pop: true
|
||||||
- include: strings
|
- include: strings
|
||||||
- include: comments
|
- match: \b(as|show|hide|deferred)\b
|
||||||
- match: \b(as|show|hide)\b
|
|
||||||
scope: keyword.other.import.dart
|
scope: keyword.other.import.dart
|
||||||
- include: comments
|
- include: comments
|
||||||
- include: punctuation
|
|
||||||
- include: annotations
|
|
||||||
- include: keywords
|
|
||||||
- include: constants-and-special-vars
|
- include: constants-and-special-vars
|
||||||
|
- include: annotations
|
||||||
|
- include: decl-typedef
|
||||||
|
- include: decl-class
|
||||||
|
- include: decl-enum
|
||||||
|
- include: decl-function
|
||||||
|
- include: keywords
|
||||||
- include: strings
|
- include: strings
|
||||||
annotations:
|
annotations:
|
||||||
- match: '@[a-zA-Z]+'
|
- match: '^(?:\s*)((@)([a-zA-Z0-9_]+))'
|
||||||
scope: storage.type.annotation.dart
|
captures:
|
||||||
|
1: annotation.dart
|
||||||
|
2: entity.name.function.annotation.dart
|
||||||
|
3: support.type.dart
|
||||||
comments:
|
comments:
|
||||||
- match: /\*\*/
|
- match: /\*\*/
|
||||||
scope: comment.block.empty.dart
|
scope: comment.block.empty.dart
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.comment.dart
|
0: punctuation.definition.comment.dart
|
||||||
- include: comments-doc-oldschool
|
|
||||||
- include: comments-doc
|
|
||||||
- include: comments-inline
|
- include: comments-inline
|
||||||
comments-block:
|
comments-inline:
|
||||||
- match: /\*
|
- match: /\*
|
||||||
push:
|
push:
|
||||||
- meta_scope: comment.block.dart
|
- meta_scope: comment.block.dart
|
||||||
- match: \*/
|
- match: \*/
|
||||||
pop: true
|
pop: true
|
||||||
- include: comments-block
|
- include: scope:text.dart-doccomments
|
||||||
comments-doc:
|
- match: (///)
|
||||||
- match: ///
|
|
||||||
push:
|
|
||||||
- meta_scope: comment.block.documentation.dart
|
|
||||||
- match: .*
|
|
||||||
pop: true
|
|
||||||
- include: dartdoc
|
|
||||||
comments-doc-oldschool:
|
|
||||||
- match: /\*\*
|
|
||||||
push:
|
|
||||||
- meta_scope: comment.block.documentation.dart
|
|
||||||
- match: \*/
|
|
||||||
pop: true
|
|
||||||
- include: comments-doc-oldschool
|
|
||||||
- include: comments-block
|
|
||||||
- include: dartdoc
|
|
||||||
comments-inline:
|
|
||||||
- include: comments-block
|
|
||||||
- match: ((//).*)$
|
|
||||||
captures:
|
captures:
|
||||||
1: comment.line.double-slash.dart
|
1: marker.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line.triple-slash.dart
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.dart-doccomments
|
||||||
|
- match: (//)
|
||||||
|
captures:
|
||||||
|
1: marker.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line.double-slash.dart
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.dart-doccomments
|
||||||
constants-and-special-vars:
|
constants-and-special-vars:
|
||||||
- match: (?<!\$)\b(true|false|null)\b(?!\$)
|
- match: \b(true|false|null)\b
|
||||||
scope: constant.language.dart
|
scope: constant.language.dart
|
||||||
- match: (?<!\$)\b(this|super)\b(?!\$)
|
- match: \b(this|super)\b
|
||||||
scope: variable.language.dart
|
scope: variable.language.dart
|
||||||
- match: '(?<!\$)\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b(?!\$)'
|
- match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'
|
||||||
scope: constant.numeric.dart
|
scope: constant.numeric.dart
|
||||||
- match: '(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*|bool\b|num\b|int\b|double\b|dynamic\b)'
|
decl-class:
|
||||||
scope: support.class.dart
|
- match: \bclass\b
|
||||||
- match: '([_$]*[a-z][a-zA-Z0-9_$]*)(<|\(|\s+=>)'
|
|
||||||
captures:
|
captures:
|
||||||
1: entity.name.function.dart
|
0: keyword.control.new.dart
|
||||||
dartdoc:
|
|
||||||
- match: '(\[.*?\])'
|
|
||||||
captures:
|
|
||||||
0: variable.name.source.dart
|
|
||||||
- match: '^ {4,}(?![ \*]).*'
|
|
||||||
captures:
|
|
||||||
0: variable.name.source.dart
|
|
||||||
- match: '```.*?$'
|
|
||||||
push:
|
push:
|
||||||
- meta_content_scope: variable.other.source.dart
|
- meta_scope: meta.declaration.class.dart
|
||||||
- match: '```'
|
- match: "(?={)"
|
||||||
pop: true
|
pop: true
|
||||||
- match: (`.*?`)
|
- include: keywords
|
||||||
|
- match: "[A-Za-z_][A-Za-z0-9_]*"
|
||||||
|
scope: class.name.dart
|
||||||
|
decl-enum:
|
||||||
|
- match: \benum\b
|
||||||
captures:
|
captures:
|
||||||
0: variable.other.source.dart
|
0: keyword.declaration.dart
|
||||||
- match: (`.*?`)
|
push:
|
||||||
|
- meta_scope: meta.declaration.enum.dart
|
||||||
|
- match: "(?={)"
|
||||||
|
pop: true
|
||||||
|
- include: keywords
|
||||||
|
- match: "[A-Za-z_][A-Za-z0-9_]*"
|
||||||
|
scope: enum.name.dart
|
||||||
|
decl-function:
|
||||||
|
- match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(get)\s+(\w+)\s+(?==>)
|
||||||
|
comment: A getter with a primitive return type.
|
||||||
|
scope: meta.declaration.function.dart
|
||||||
captures:
|
captures:
|
||||||
0: variable.other.source.dart
|
1: storage.type.primitive.dart
|
||||||
- match: (\* (( ).*))$
|
2: keyword.declaration.dart
|
||||||
|
3: function.name.dart
|
||||||
|
- match: ^\s*(?:\b(\w+)\b\s+)?(get)\s+(\w+)\s+(?==>)
|
||||||
|
comment: A getter with a user-defined return type or no return type.
|
||||||
|
scope: meta.declaration.function.dart
|
||||||
captures:
|
captures:
|
||||||
2: variable.other.source.dart
|
1: type.user-defined.dart
|
||||||
- match: (\* .*)$
|
2: keyword.declaration.dart
|
||||||
|
3: function.name.dart
|
||||||
|
- match: ^\s*(set)\s+(\w+)(?=\()
|
||||||
|
comment: A setter.
|
||||||
|
captures:
|
||||||
|
1: keyword.declaration.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function with a primitive return type.
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: ^\s*(?:\b(return)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function invocation after 'return'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.invocation.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: ^\s*\b(new)\b\s+(\w+)(?=\()
|
||||||
|
comment: A class instantiation after 'new'
|
||||||
|
captures:
|
||||||
|
1: keyword.declaration.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.invocation.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
decl-function-parameter:
|
||||||
|
- include: constants-and-special-vars
|
||||||
|
- match: (?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function with a primitive return type.
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: \b(new)\b\s+(\w+)(?=\()
|
||||||
|
comment: A class instantiation after 'new'
|
||||||
|
captures:
|
||||||
|
1: keyword.declaration.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.invocation.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: (?:\b(\w+)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function with a user-defined return type.
|
||||||
|
captures:
|
||||||
|
1: type.user-defined.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: (\w+)(?=\()
|
||||||
|
comment: A function with no return type.
|
||||||
|
captures:
|
||||||
|
1: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
decl-typedef:
|
||||||
|
- match: typedef
|
||||||
|
captures:
|
||||||
|
0: keyword.control.new.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.typedef.dart
|
||||||
|
- match: ;
|
||||||
|
captures:
|
||||||
|
0: punctuation.terminator.dart
|
||||||
|
pop: true
|
||||||
|
- match: '(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b|([a-zA-Z_][a-zA-Z0-9_]*))\s+([a-zA-Z_][a-zA-Z0-9_]+)'
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: typedef.return.dart
|
||||||
|
3: typedef.name.dart
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- meta_scope: typedef.params.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: keywords
|
||||||
keywords:
|
keywords:
|
||||||
- match: (?<!\$)\bas\b(?!\$)
|
- match: \bassert\b
|
||||||
|
scope: keyword.control.assert.dart
|
||||||
|
- match: \bas\b
|
||||||
scope: keyword.cast.dart
|
scope: keyword.cast.dart
|
||||||
- match: (?<!\$)\b(try|on|catch|finally|throw|rethrow)\b(?!\$)
|
- match: \b(try|catch|finally|throw|on|rethrow)\b
|
||||||
scope: keyword.control.catch-exception.dart
|
scope: keyword.control.catch-exception.dart
|
||||||
- match: (?<!\$)\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b(?!\$)
|
- match: \s+\?\s+|\s+:\s+
|
||||||
|
scope: keyword.control.ternary.dart
|
||||||
|
- match: \b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b
|
||||||
scope: keyword.control.dart
|
scope: keyword.control.dart
|
||||||
- match: (?<!\$)\b(sync(\*)?|async(\*)?|await|yield(\*)?)\b(?!\$)
|
- match: \b(async\*|async|await\*|await|yield)\b
|
||||||
scope: keyword.control.dart
|
scope: keyword.control.async.dart
|
||||||
- match: (?<!\$)\bassert\b(?!\$)
|
- match: \b(new)\b
|
||||||
scope: keyword.control.dart
|
|
||||||
- match: (?<!\$)\b(new)\b(?!\$)
|
|
||||||
scope: keyword.control.new.dart
|
scope: keyword.control.new.dart
|
||||||
- match: (?<!\$)\b(abstract|class|enum|extends|external|factory|implements|get|mixin|native|operator|set|typedef|with|covariant)\b(?!\$)
|
- match: \b(abstract|extends|external|factory|implements|with|interface|get|native|operator|set|typedef)\b
|
||||||
scope: keyword.declaration.dart
|
scope: keyword.declaration.dart
|
||||||
- match: (?<!\$)\b(is\!?)\b(?!\$)
|
- match: \b(is\!?)\b
|
||||||
scope: keyword.operator.dart
|
scope: keyword.operator.dart
|
||||||
- match: '\?|:'
|
|
||||||
scope: keyword.operator.ternary.dart
|
|
||||||
- match: (<<|>>>?|~|\^|\||&)
|
- match: (<<|>>>?|~|\^|\||&)
|
||||||
scope: keyword.operator.bitwise.dart
|
scope: keyword.operator.bitwise.dart
|
||||||
- match: ((&|\^|\||<<|>>>?)=)
|
- match: ((&|\^|\||<<|>>>?)=)
|
||||||
scope: keyword.operator.assignment.bitwise.dart
|
scope: keyword.operator.assignment.bitwise.dart
|
||||||
- match: (=>)
|
- match: (===?|!==?|<=?|>=?)
|
||||||
scope: keyword.operator.closure.dart
|
|
||||||
- match: (==|!=|<=?|>=?)
|
|
||||||
scope: keyword.operator.comparison.dart
|
scope: keyword.operator.comparison.dart
|
||||||
- match: '(([+*/%-]|\~)=)'
|
- match: '(([+*/%-]|\~)=)'
|
||||||
scope: keyword.operator.assignment.arithmetic.dart
|
scope: keyword.operator.assignment.arithmetic.dart
|
||||||
@@ -138,22 +266,56 @@ contexts:
|
|||||||
scope: keyword.operator.arithmetic.dart
|
scope: keyword.operator.arithmetic.dart
|
||||||
- match: (!|&&|\|\|)
|
- match: (!|&&|\|\|)
|
||||||
scope: keyword.operator.logical.dart
|
scope: keyword.operator.logical.dart
|
||||||
- match: (?<!\$)\b(static|final|const)\b(?!\$)
|
|
||||||
scope: storage.modifier.dart
|
|
||||||
- match: (?<!\$)\b(?:void|var)\b(?!\$)
|
|
||||||
scope: storage.type.primitive.dart
|
|
||||||
punctuation:
|
|
||||||
- match: ','
|
|
||||||
scope: punctuation.comma.dart
|
|
||||||
- match: ;
|
- match: ;
|
||||||
scope: punctuation.terminator.dart
|
scope: punctuation.terminator.dart
|
||||||
|
- match: \b(static|final|const)\b
|
||||||
|
scope: storage.modifier.dart
|
||||||
|
- match: \b(?:void|bool|num|int|double|dynamic|var|String|List|Map)\b
|
||||||
|
scope: storage.type.primitive.dart
|
||||||
|
regexp:
|
||||||
|
- match: '\\[^''"]'
|
||||||
|
scope: constant.character.escaped.regex.dart
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- meta_content_scope: meta.capture.regex.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- match: \?(:|=|!)
|
||||||
|
scope: ignore.capture.regex.dart
|
||||||
|
- match: \*|\+|\?|\.|\|
|
||||||
|
scope: keyword.other.regex.dart
|
||||||
|
- match: \^|\$
|
||||||
|
scope: keyword.other.regex.dart
|
||||||
- match: \.
|
- match: \.
|
||||||
scope: punctuation.dot.dart
|
scope: constant.other.regex.dart
|
||||||
string-interp:
|
- match: '\[(\^)?'
|
||||||
- match: '\$((\w+)|\{([^{}]+)\})'
|
|
||||||
captures:
|
captures:
|
||||||
|
1: keyword.other.negation.regex.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: constant.character.range.regex.dart
|
||||||
|
- match: '\]'
|
||||||
|
pop: true
|
||||||
|
- match: '\\[^"'']'
|
||||||
|
scope: constant.character.escaped.regex.dart
|
||||||
|
- match: '\{(?:\d+)?,(?:\d+)?\}'
|
||||||
|
scope: keyword.other.regex.dart
|
||||||
|
string-interp:
|
||||||
|
- match: '(\$)(\{)'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.dart
|
||||||
|
2: keyword.other.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: interpolation.dart
|
||||||
|
- meta_content_scope: source.dart
|
||||||
|
- match: '(\})'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.dart
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: (\$)(\w+)
|
||||||
|
captures:
|
||||||
|
1: keyword.other.dart
|
||||||
2: variable.parameter.dart
|
2: variable.parameter.dart
|
||||||
3: variable.parameter.dart
|
|
||||||
- match: \\.
|
- match: \\.
|
||||||
scope: constant.character.escape.dart
|
scope: constant.character.escape.dart
|
||||||
strings:
|
strings:
|
||||||
@@ -166,7 +328,7 @@ contexts:
|
|||||||
- match: (?<!r)'''
|
- match: (?<!r)'''
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.interpolated.triple.single.dart
|
- meta_scope: string.interpolated.triple.single.dart
|
||||||
- match: '''''''(?!'')'
|
- match: "'''(?!')"
|
||||||
pop: true
|
pop: true
|
||||||
- include: string-interp
|
- include: string-interp
|
||||||
- match: r"""
|
- match: r"""
|
||||||
@@ -177,9 +339,9 @@ contexts:
|
|||||||
- match: r'''
|
- match: r'''
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.triple.single.dart
|
- meta_scope: string.quoted.triple.single.dart
|
||||||
- match: '''''''(?!'')'
|
- match: "'''(?!')"
|
||||||
pop: true
|
pop: true
|
||||||
- match: (?<!\|r)"
|
- match: (?<!\\|r)"
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.interpolated.double.dart
|
- meta_scope: string.interpolated.double.dart
|
||||||
- match: '"'
|
- match: '"'
|
||||||
@@ -192,20 +354,16 @@ contexts:
|
|||||||
- meta_scope: string.quoted.double.dart
|
- meta_scope: string.quoted.double.dart
|
||||||
- match: '"'
|
- match: '"'
|
||||||
pop: true
|
pop: true
|
||||||
- match: \n
|
- include: regexp
|
||||||
scope: invalid.string.newline
|
|
||||||
- match: (?<!\|r)'
|
- match: (?<!\|r)'
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.interpolated.single.dart
|
- meta_scope: string.interpolated.single.dart
|
||||||
- match: "'"
|
- match: "'"
|
||||||
pop: true
|
pop: true
|
||||||
- match: \n
|
|
||||||
scope: invalid.string.newline
|
|
||||||
- include: string-interp
|
- include: string-interp
|
||||||
- match: r'
|
- match: r'
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.single.dart
|
- meta_scope: string.quoted.single.dart
|
||||||
- match: "'"
|
- match: "'"
|
||||||
pop: true
|
pop: true
|
||||||
- match: \n
|
- include: regexp
|
||||||
scope: invalid.string.newline
|
|
||||||
|
|||||||
2
assets/syntaxes/02_Extra/LESS
vendored
2
assets/syntaxes/02_Extra/LESS
vendored
Submodule assets/syntaxes/02_Extra/LESS updated: 836b47ec61...a2eae0453e
1
assets/syntaxes/02_Extra/LiveScript
vendored
1
assets/syntaxes/02_Extra/LiveScript
vendored
Submodule assets/syntaxes/02_Extra/LiveScript deleted from 2575013851
400
assets/syntaxes/02_Extra/LiveScript.sublime-syntax
vendored
400
assets/syntaxes/02_Extra/LiveScript.sublime-syntax
vendored
@@ -1,400 +0,0 @@
|
|||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
|
||||||
name: LiveScript
|
|
||||||
comment: "LiveScript Syntax: version 1"
|
|
||||||
file_extensions:
|
|
||||||
- ls
|
|
||||||
- Slakefile
|
|
||||||
- ls.erb
|
|
||||||
first_line_match: ^#!.*\bls
|
|
||||||
scope: source.livescript
|
|
||||||
contexts:
|
|
||||||
main:
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
!?[~-]{1,2}>\*?
|
|
||||||
|<[~-]{1,2}!?
|
|
||||||
|\(\s* (?= instanceof[\s)]|and[\s)]|or[\s)]|is[\s)]|isnt[\s)]|in[\s)]|import[\s)]|import\ all[\s)] |\.|[-+/*%^&<>=|][\b\s)\w$]|\*\*|\%\%)
|
|
||||||
| (?<=[\s(]instanceof|[\s(]and|[\s(]or|[\s(]is|[\s(]isnt|[\s(]in|[\s(]import|[\s(]import\ all|[\s(]do|\.|\*\*|\%\%|[\b\s(\w$][-+/*%^&<>=|]) \s*\)
|
|
||||||
scope: storage.type.function.livescript
|
|
||||||
- match: \/\*
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.comment.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: comment.block.livescript
|
|
||||||
- match: \*\/
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.comment.livescript
|
|
||||||
pop: true
|
|
||||||
- match: '@\w*'
|
|
||||||
scope: storage.type.annotation.livescriptscript
|
|
||||||
- match: '(#)(?!\{).*$\n?'
|
|
||||||
scope: comment.line.number-sign.livescript
|
|
||||||
captures:
|
|
||||||
1: punctuation.definition.comment.livescript
|
|
||||||
- match: '((?:!|~|!~|~!)?function\*?)\s+([$\w\-]*[$\w]+)'
|
|
||||||
captures:
|
|
||||||
1: storage.type.function.livescript
|
|
||||||
2: entity.name.function.livescript
|
|
||||||
- match: (new)\s+(\w+(?:\.\w*)*)
|
|
||||||
captures:
|
|
||||||
1: keyword.operator.new.livescript
|
|
||||||
2: entity.name.type.instance.livescript
|
|
||||||
- match: \b(package|private|protected|public|interface|enum|static)(?!-)\b
|
|
||||||
scope: keyword.illegal.livescript
|
|
||||||
- match: "'''"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.begin.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: string.quoted.heredoc.livescript
|
|
||||||
- match: "'''"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.livescript
|
|
||||||
pop: true
|
|
||||||
- match: '"""'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.begin.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: string.quoted.double.heredoc.livescript
|
|
||||||
- match: '"""'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.livescript
|
|
||||||
pop: true
|
|
||||||
- match: \\.
|
|
||||||
scope: constant.character.escape.livescript
|
|
||||||
- include: interpolated_livescript
|
|
||||||
- match: "``"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.begin.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: string.quoted.script.livescript
|
|
||||||
- match: "``"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.livescript
|
|
||||||
pop: true
|
|
||||||
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
|
|
||||||
scope: constant.character.escape.livescript
|
|
||||||
- match: '<\['
|
|
||||||
push:
|
|
||||||
- meta_scope: string.array-literal.livescript
|
|
||||||
- match: '\]>'
|
|
||||||
pop: true
|
|
||||||
- match: '/{2}(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])/{2}'
|
|
||||||
scope: string.regexp.livescript
|
|
||||||
- match: '/{2}\n'
|
|
||||||
push:
|
|
||||||
- meta_scope: string.regexp.livescript
|
|
||||||
- match: "/{2}[imgy]{0,4}"
|
|
||||||
pop: true
|
|
||||||
- include: embedded_spaced_comment
|
|
||||||
- include: interpolated_livescript
|
|
||||||
- match: "/{2}"
|
|
||||||
push:
|
|
||||||
- meta_scope: string.regexp.livescript
|
|
||||||
- match: "/{2}[imgy]{0,4}"
|
|
||||||
pop: true
|
|
||||||
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
|
|
||||||
scope: constant.character.escape.livescript
|
|
||||||
- include: interpolated_livescript
|
|
||||||
- match: '/(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])'
|
|
||||||
scope: string.regexp.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
\b(?<![\.\$\-@])(
|
|
||||||
instanceof|new|delete|typeof|and|or|is|isnt|not
|
|
||||||
)(?!\-|\s*:)\b
|
|
||||||
scope: keyword.operator.livescript
|
|
||||||
- match: <\||\|>
|
|
||||||
scope: keyword.operator.livescript
|
|
||||||
- match: "=>"
|
|
||||||
scope: keyword.control.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
\b(?<![\.\$\-@])(?:
|
|
||||||
return|break|continue|throw
|
|
||||||
|try|if|while|for|for\s+own|switch|unless|until
|
|
||||||
|catch|finally|else|nobreak|case|default|fallthrough|when|otherwise|then
|
|
||||||
|yield
|
|
||||||
)(?!\-|\s*:)\b
|
|
||||||
scope: keyword.control.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
and=|or=|%|&|\^|\*|\/|(?<![a-zA-Z$_])(\-)?\-(?!\-?>)|\+\+|\+|
|
|
||||||
~(?!~?>)|==|=|!=|<=|>=|<<=|>>=|
|
|
||||||
>>>=|<>|<(?!\[)|(?<!\])>|(?<!\w)!(?!([~\-]+)?>)|&&|\.\.(\.)?|\s\.\s|\?|\|\||\:|\*=|(?<!\()/=|%=|\+=|\-=|\.=|&=
|
|
||||||
|\^=
|
|
||||||
scope: keyword.operator.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
\b(?<![\.\$\-@])(?:
|
|
||||||
function
|
|
||||||
)(?!\-|\s*:)\b
|
|
||||||
scope: storage.type.function.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
\b(?<![\.\$\-@])(?:
|
|
||||||
this|throw|then|try|typeof!?|til|to
|
|
||||||
|continue|const|case|catch|class
|
|
||||||
|in|instanceof|import|import\s+all|implements|if|is
|
|
||||||
|default|delete|debugger|do
|
|
||||||
|for|for\s+own|finally|function|from|fallthrough
|
|
||||||
|super|switch
|
|
||||||
|else|nobreak|extends|export|eval
|
|
||||||
|and|arguments
|
|
||||||
|new|not
|
|
||||||
|unless|until
|
|
||||||
|while|with|when
|
|
||||||
|of|or|otherwise
|
|
||||||
|let|var|loop
|
|
||||||
|match
|
|
||||||
|by|yield
|
|
||||||
)(?!\-|\s*:)\b
|
|
||||||
scope: keyword.other.livescript
|
|
||||||
- match: '([a-zA-Z\$_](?:[\w$.-])*)\s*(?!\::)((:)|(=(?!>)))\s*(?!(\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))'
|
|
||||||
captures:
|
|
||||||
1: variable.assignment.livescript
|
|
||||||
3: punctuation.separator.key-value, keyword.operator.livescript
|
|
||||||
4: keyword.operator.livescript
|
|
||||||
- match: '(?<=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])'
|
|
||||||
captures:
|
|
||||||
0: keyword.operator.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.variable.assignment.destructured.livescript
|
|
||||||
- match: '([\]\}]\s*[:=])'
|
|
||||||
captures:
|
|
||||||
0: keyword.operator.livescript
|
|
||||||
pop: true
|
|
||||||
- include: variable_name
|
|
||||||
- include: instance_variable
|
|
||||||
- include: single_quoted_string
|
|
||||||
- include: double_quoted_string
|
|
||||||
- include: numeric
|
|
||||||
- match: |-
|
|
||||||
(?x)
|
|
||||||
(\s*)
|
|
||||||
(?=[a-zA-Z\$_])
|
|
||||||
([a-zA-Z\$_]([\w$.:-])*)\s*
|
|
||||||
(?=[:=](\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))
|
|
||||||
scope: meta.function.livescript
|
|
||||||
captures:
|
|
||||||
2: entity.name.function.livescript
|
|
||||||
3: entity.name.function.livescript
|
|
||||||
4: variable.parameter.function.livescript
|
|
||||||
5: storage.type.function.livescript
|
|
||||||
- match: \b(?<!\.)(true|on|yes)(?!\s*:)\b
|
|
||||||
scope: constant.language.boolean.true.livescript
|
|
||||||
- match: \b(?<!\.)(false|off|no)(?!\s*:)\b
|
|
||||||
scope: constant.language.boolean.false.livescript
|
|
||||||
- match: \b(?<!\.)(null|void)(?!\s*:)\b
|
|
||||||
scope: constant.language.null.livescript
|
|
||||||
- match: \b(?<!\.)(super|this|extends)(?!\s*:)\b
|
|
||||||
scope: variable.language.livescript
|
|
||||||
- match: '(class\b)\s+(@?[a-zA-Z$_][\w$.-]*)?(?:\s+(extends)\s+(@?[a-zA-Z$_][\w$.-]*))?'
|
|
||||||
scope: meta.class.livescript
|
|
||||||
captures:
|
|
||||||
1: storage.type.class.livescript
|
|
||||||
2: entity.name.type.class.livescript
|
|
||||||
3: keyword.control.inheritance.livescript
|
|
||||||
4: entity.other.inherited-class.livescript
|
|
||||||
- match: \b(debugger|\\)\b
|
|
||||||
scope: keyword.other.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)\b(
|
|
||||||
Array|ArrayBuffer|Blob|Boolean|Date|document|event|Function|
|
|
||||||
Int(8|16|32|64)Array|Math|Map|Number|
|
|
||||||
Object|Proxy|RegExp|Set|String|WeakMap|
|
|
||||||
window|Uint(8|16|32|64)Array|XMLHttpRequest
|
|
||||||
)\b
|
|
||||||
scope: support.class.livescript
|
|
||||||
- match: \b(console)\b
|
|
||||||
scope: entity.name.type.object.livescript
|
|
||||||
- match: \b(Infinity|NaN|undefined)\b
|
|
||||||
scope: constant.language.livescript
|
|
||||||
- match: \;
|
|
||||||
scope: punctuation.terminator.statement.livescript
|
|
||||||
- match: ',[ |\t]*'
|
|
||||||
scope: meta.delimiter.object.comma.livescript
|
|
||||||
- match: \.
|
|
||||||
scope: meta.delimiter.method.period.livescript
|
|
||||||
- match: '\{|\}'
|
|
||||||
scope: meta.brace.curly.livescript
|
|
||||||
- match: \(|\)
|
|
||||||
scope: meta.brace.round.livescript
|
|
||||||
- match: '\[|\]\s*'
|
|
||||||
scope: meta.brace.square.livescript
|
|
||||||
- include: instance_variable
|
|
||||||
- include: backslash_string
|
|
||||||
- include: single_quoted_string
|
|
||||||
- include: double_quoted_string
|
|
||||||
- include: numeric
|
|
||||||
- match: '()(@|@@|[$\w\-]*[$\w]+)\s*(`)'
|
|
||||||
captures:
|
|
||||||
1: keyword.operator.livescript
|
|
||||||
2: meta.function-call.livescript
|
|
||||||
3: keyword.operator.livescript
|
|
||||||
- match: "`"
|
|
||||||
scope: keyword.operator.livescript
|
|
||||||
- match: '()(@|@@|[$\w\-]*[$\w]+)(?:(\??\!)|[(])'
|
|
||||||
captures:
|
|
||||||
1: keyword.operator.livescript
|
|
||||||
2: meta.function-call.livescript
|
|
||||||
3: keyword.operator.livescript
|
|
||||||
- match: '(@|@@|[$\w\-]*[$\w]+)(\?)? (?!\s*(((by|of|and|or|with|when|unless|if|is|isnt|else|nobreak|for|from|not in|in|catch|til|to|then|import|extends|implements|instanceof)\b)|[=:.*\/+\-%\^<>][ =)]|[`}%*)]|/(?!.*?/)|&&|[.][^.]|=>|\/ +|\||\|\||\-\-|\+\+|\|>|<|\||$|\n|\#|/\*))'
|
|
||||||
captures:
|
|
||||||
1: meta.function-call.livescript
|
|
||||||
2: keyword.operator.livescript
|
|
||||||
- match: \| _
|
|
||||||
scope: keyword.control.livescript
|
|
||||||
- match: '\|(?![.])'
|
|
||||||
scope: keyword.control.livescript
|
|
||||||
- match: \|
|
|
||||||
scope: keyword.operator.livescript
|
|
||||||
- match: ((?<=console\.)(debug|warn|info|log|error|time(End|-end)|assert))\b
|
|
||||||
scope: support.function.console.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)\b(
|
|
||||||
decodeURI(Component)?|encodeURI(Component)?|eval|parse(Float|Int)|require
|
|
||||||
)\b
|
|
||||||
scope: support.function.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)(?<![.-])\b(
|
|
||||||
map|filter|reject|partition|find|each|head|tail|last|initial|empty|
|
|
||||||
values|keys|length|cons|append|join|reverse|fold(l|r)?1?|unfoldr|
|
|
||||||
and(List|-list)|or(List|-list)|any|all|unique|sum|product|mean|compact|
|
|
||||||
concat(Map|-map)?|maximum|minimum|scan(l|r)?1?|replicate|slice|apply|
|
|
||||||
split(At|-at)?|take(While|-while)?|drop(While|-while)?|span|first|
|
|
||||||
break(It|-it)|list(ToObj|-to-obj)|obj(ToFunc|-to-func)|
|
|
||||||
pairs(ToObj|-to-obj)|obj(ToPairs|-to-pairs|ToLists|-to-lists)|
|
|
||||||
zip(All|-all)?(With|-with)?|compose|curry|partial|flip|fix|
|
|
||||||
sort(With|-with|By|-by)?|group(By|-by)|break(List|-list|Str|-str)|
|
|
||||||
difference|intersection|union|average|flatten|chars|unchars|repeat|
|
|
||||||
lines|unlines|words|unwords|max|min|negate|abs|signum|quot|rem|div|mod|
|
|
||||||
recip|pi|tau|exp|sqrt|ln|pow|sin|cos|tan|asin|acos|atan|atan2|truncate|
|
|
||||||
round|ceiling|floor|is(It|-it)NaN|even|odd|gcd|lcm|disabled__id
|
|
||||||
)\b(?![.-])
|
|
||||||
comment: |
|
|
||||||
Generated by DOM query from http://gkz.github.com/prelude-ls/:
|
|
||||||
[].slice
|
|
||||||
.call(document.querySelectorAll(".nav-pills li a"))
|
|
||||||
.map(function(_) {return _.innerText})
|
|
||||||
.filter(function(_) {return _.trim() !== '})
|
|
||||||
.slice(2)
|
|
||||||
.join("|")
|
|
||||||
scope: support.function.prelude.livescript
|
|
||||||
- match: '(?x)(?<![.-])\b(that|it|e|_)\b'
|
|
||||||
scope: support.function.semireserved.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)((?<=(\.|\]|\)))(
|
|
||||||
apply|call|concat|every|filter|for(Each|-each)|
|
|
||||||
from|has(Own|-own)(Property|-property)|index(Of|-of)|
|
|
||||||
is(Prototype|-prototype)(Of|-of)|join|last(Index|-index)(Of|-of)|
|
|
||||||
map|of|pop|property(Is|-is)(Enumerable|-enumerable)|push|
|
|
||||||
reduce(Right|-right)?|reverse|shift|slice|some|sort|
|
|
||||||
splice|to(Locale|-locale)?(String|-string)|unshift|valueOf
|
|
||||||
))\b(?!-)
|
|
||||||
scope: support.function.method.array.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)((?<=Array\.)(
|
|
||||||
isArray
|
|
||||||
))\b
|
|
||||||
scope: support.function.static.array.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)((?<=Object\.)(
|
|
||||||
create|define(Propert|-propert)(ies|y)|freeze|
|
|
||||||
get(Own|-own)(Property|-property)(Descriptors?|Names)|
|
|
||||||
get(Property|-property)(Descriptor|Names)|getPrototypeOf|
|
|
||||||
is((Extensible|-extensible)|(Frozen|-frozen)|(Sealed|-sealed))?|
|
|
||||||
keys|prevent(Extensions|-extensions)|seal
|
|
||||||
))\b
|
|
||||||
scope: support.function.static.object.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)((?<=Math\.)(
|
|
||||||
abs|acos|acosh|asin|asinh|atan|atan2|atanh|ceil|cos|cosh|exp|expm1|floor|
|
|
||||||
hypot|log|log10|log1p|log2|max|min|pow|random|round|sign|sin|sinh|sqrt|
|
|
||||||
tan|tanh|trunc
|
|
||||||
))\b
|
|
||||||
scope: support.function.static.math.livescript
|
|
||||||
- match: |-
|
|
||||||
(?x)((?<=Number\.)(
|
|
||||||
is(Finite|Integer|NaN)|to(Integer|-integer)
|
|
||||||
))\b
|
|
||||||
scope: support.function.static.number.livescript
|
|
||||||
- match: '[\$\w][\w-]*'
|
|
||||||
scope: variable.other.livescript
|
|
||||||
backslash_string:
|
|
||||||
- match: '\\([\\)\s,\};\]])?'
|
|
||||||
captures:
|
|
||||||
0: string.quoted.single.livescript
|
|
||||||
push:
|
|
||||||
- meta_content_scope: string.quoted.single.livescript
|
|
||||||
- match: '([\\)\s,\};\]])'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.livescript
|
|
||||||
pop: true
|
|
||||||
constructor_variable:
|
|
||||||
- match: '([a-zA-Z$_][\w$-]*)(@{2})([a-zA-Z$_][\w$-]*)?'
|
|
||||||
scope: variable.other.readwrite.constructor.livescript
|
|
||||||
double_quoted_string:
|
|
||||||
- match: '"'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.begin.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: string.quoted.double.livescript
|
|
||||||
- match: '"'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.livescript
|
|
||||||
pop: true
|
|
||||||
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
|
|
||||||
scope: constant.character.escape.livescript
|
|
||||||
- include: interpolated_livescript
|
|
||||||
embedded_comment:
|
|
||||||
- match: (?<!\\)(#).*$\n
|
|
||||||
scope: comment.line.number-sign.livescript
|
|
||||||
captures:
|
|
||||||
1: punctuation.definition.comment.livescript
|
|
||||||
embedded_spaced_comment:
|
|
||||||
- match: (?<!\\)(#\s).*$\n
|
|
||||||
scope: comment.line.number-sign.livescript
|
|
||||||
captures:
|
|
||||||
1: punctuation.definition.comment.livescript
|
|
||||||
instance_variable:
|
|
||||||
- match: '(?<![$\w\-])(@)'
|
|
||||||
scope: variable.other.readwrite.instance.livescript
|
|
||||||
interpolated_livescript:
|
|
||||||
- match: '\#\{'
|
|
||||||
captures:
|
|
||||||
0: punctuation.section.embedded.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: source.livescript.embedded.source
|
|
||||||
- match: '\}'
|
|
||||||
captures:
|
|
||||||
0: punctuation.section.embedded.livescript
|
|
||||||
pop: true
|
|
||||||
- include: main
|
|
||||||
- match: '\#'
|
|
||||||
push:
|
|
||||||
- meta_scope: source.livescript.embedded.source.simple
|
|
||||||
- match: ""
|
|
||||||
pop: true
|
|
||||||
- include: main
|
|
||||||
numeric:
|
|
||||||
- match: '(?<![\$@a-zA-Z_])(([0-9]+r[0-9_]+)|((16r|0[xX])[0-9a-fA-F_]+)|([0-9]+(\.[0-9]+[0-9_]*)?(e[+\-]?[0-9_]+)?)[_a-zA-Z0-9]*)'
|
|
||||||
scope: constant.numeric.livescript
|
|
||||||
single_quoted_string:
|
|
||||||
- match: "'"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.begin.livescript
|
|
||||||
push:
|
|
||||||
- meta_scope: string.quoted.single.livescript
|
|
||||||
- match: "'"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.livescript
|
|
||||||
pop: true
|
|
||||||
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
|
|
||||||
scope: constant.character.escape.livescript
|
|
||||||
variable_name:
|
|
||||||
- match: '([a-zA-Z\$_][\w$-]*(\.\w+)*)(?!\-)'
|
|
||||||
scope: variable.assignment.livescript
|
|
||||||
captures:
|
|
||||||
1: variable.assignment.livescript
|
|
||||||
1
assets/syntaxes/02_Extra/MediaWiki
vendored
1
assets/syntaxes/02_Extra/MediaWiki
vendored
Submodule assets/syntaxes/02_Extra/MediaWiki deleted from 81bf97cace
1
assets/syntaxes/02_Extra/Nim.sublime-syntax
vendored
1
assets/syntaxes/02_Extra/Nim.sublime-syntax
vendored
@@ -5,7 +5,6 @@ name: Nim
|
|||||||
file_extensions:
|
file_extensions:
|
||||||
- nim
|
- nim
|
||||||
- nims
|
- nims
|
||||||
- nimble
|
|
||||||
scope: source.nim
|
scope: source.nim
|
||||||
contexts:
|
contexts:
|
||||||
main:
|
main:
|
||||||
|
|||||||
2
assets/syntaxes/02_Extra/PowerShell
vendored
2
assets/syntaxes/02_Extra/PowerShell
vendored
Submodule assets/syntaxes/02_Extra/PowerShell updated: 742f0b5d4b...4a0a076661
116
assets/syntaxes/02_Extra/PowerShell.sublime-syntax
vendored
116
assets/syntaxes/02_Extra/PowerShell.sublime-syntax
vendored
@@ -24,7 +24,7 @@ contexts:
|
|||||||
- include: commands
|
- include: commands
|
||||||
- include: commentLine
|
- include: commentLine
|
||||||
- include: variable
|
- include: variable
|
||||||
- include: subexpression
|
- include: interpolatedStringContent
|
||||||
- include: function
|
- include: function
|
||||||
- include: attribute
|
- include: attribute
|
||||||
- include: UsingDirective
|
- include: UsingDirective
|
||||||
@@ -33,38 +33,32 @@ contexts:
|
|||||||
- include: doubleQuotedString
|
- include: doubleQuotedString
|
||||||
- include: scriptblock
|
- include: scriptblock
|
||||||
- include: doubleQuotedStringEscapes
|
- include: doubleQuotedStringEscapes
|
||||||
- match: '[''\x{2018}-\x{201B}]'
|
- match: (?<!')'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.powershell
|
0: punctuation.definition.string.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.single.powershell
|
- meta_scope: string.quoted.single.powershell
|
||||||
- match: '[''\x{2018}-\x{201B}]{2}'
|
- match: "'(?!')"
|
||||||
scope: constant.character.escape.powershell
|
|
||||||
- match: '[''\x{2018}-\x{201B}]'
|
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.end.powershell
|
0: punctuation.definition.string.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(@["\x{201C}-\x{201E}])\s*$'
|
- match: "''"
|
||||||
captures:
|
scope: constant.character.escape.powershell
|
||||||
1: punctuation.definition.string.begin.powershell
|
- match: \@"(?=$)
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.double.heredoc.powershell
|
- meta_scope: string.quoted.double.heredoc.powershell
|
||||||
- match: '^["\x{201C}-\x{201E}]@'
|
- match: ^"@
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.powershell
|
|
||||||
pop: true
|
pop: true
|
||||||
- include: variableNoProperty
|
- include: variableNoProperty
|
||||||
- include: doubleQuotedStringEscapes
|
- include: doubleQuotedStringEscapes
|
||||||
- include: interpolation
|
- include: interpolation
|
||||||
- match: '(@[''\x{2018}-\x{201B}])\s*$'
|
- match: \@'(?=$)
|
||||||
captures:
|
|
||||||
1: punctuation.definition.string.begin.powershell
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.single.heredoc.powershell
|
- meta_scope: string.quoted.single.heredoc.powershell
|
||||||
- match: '^[''\x{2018}-\x{201B}]@'
|
- match: ^'@
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.powershell
|
|
||||||
pop: true
|
pop: true
|
||||||
|
- match: "''"
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
- include: numericConstant
|
- include: numericConstant
|
||||||
- match: (@)(\()
|
- match: (@)(\()
|
||||||
captures:
|
captures:
|
||||||
@@ -77,12 +71,11 @@ contexts:
|
|||||||
0: punctuation.section.group.end.powershell
|
0: punctuation.section.group.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- include: main
|
||||||
- match: ((\$))(\()
|
- match: (\$)(\()
|
||||||
comment: "TODO: move to repo; make recursive."
|
comment: "TODO: move to repo; make recursive."
|
||||||
captures:
|
captures:
|
||||||
1: keyword.other.substatement.powershell
|
1: punctuation.definition.variable.powershell
|
||||||
2: punctuation.definition.subexpression.powershell
|
2: punctuation.section.group.begin.powershell
|
||||||
3: punctuation.section.group.begin.powershell
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.group.complex.subexpression.powershell
|
- meta_scope: meta.group.complex.subexpression.powershell
|
||||||
- match: \)
|
- match: \)
|
||||||
@@ -92,7 +85,7 @@ contexts:
|
|||||||
- include: main
|
- include: main
|
||||||
- match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
|
- match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
|
||||||
scope: support.function.powershell
|
scope: 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)
|
- match: (?<!\w|-|\.)((?i:begin|break|catch|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)
|
||||||
scope: keyword.control.powershell
|
scope: keyword.control.powershell
|
||||||
- match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
|
- match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
|
||||||
scope: keyword.control.powershell
|
scope: keyword.control.powershell
|
||||||
@@ -142,7 +135,7 @@ contexts:
|
|||||||
- meta_scope: meta.requires.powershell
|
- meta_scope: meta.requires.powershell
|
||||||
- match: $
|
- match: $
|
||||||
pop: true
|
pop: true
|
||||||
- match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version|Assembly|PSEdition)
|
- match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
|
||||||
scope: keyword.other.powershell
|
scope: keyword.other.powershell
|
||||||
- match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
|
- match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
|
||||||
scope: variable.parameter.powershell
|
scope: variable.parameter.powershell
|
||||||
@@ -194,53 +187,51 @@ contexts:
|
|||||||
comment: Builtin cmdlets with reserved verbs
|
comment: Builtin cmdlets with reserved verbs
|
||||||
scope: support.function.powershell
|
scope: support.function.powershell
|
||||||
commentEmbeddedDocs:
|
commentEmbeddedDocs:
|
||||||
- match: (?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$
|
- match: ^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))
|
||||||
comment: these embedded doc keywords do not support arguments, must be the only thing on the line
|
|
||||||
scope: comment.documentation.embedded.powershell
|
scope: comment.documentation.embedded.powershell
|
||||||
captures:
|
captures:
|
||||||
1: constant.string.documentation.powershell
|
1: constant.string.documentation.powershell
|
||||||
2: keyword.operator.documentation.powershell
|
2: keyword.operator.documentation.powershell
|
||||||
- match: (?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$
|
- match: '(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))'
|
||||||
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
|
|
||||||
scope: comment.documentation.embedded.powershell
|
scope: comment.documentation.embedded.powershell
|
||||||
captures:
|
captures:
|
||||||
1: constant.string.documentation.powershell
|
1: constant.string.documentation.powershell
|
||||||
2: keyword.operator.documentation.powershell
|
2: keyword.operator.documentation.powershell
|
||||||
3: keyword.operator.documentation.powershell
|
3: keyword.operator.documentation.powershell
|
||||||
commentLine:
|
commentLine:
|
||||||
- match: '(?<![`\\-])(#)#*'
|
- match: '(?<![`\\-])#'
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.comment.powershell
|
0: punctuation.definition.comment.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: comment.line.powershell
|
- meta_scope: comment.line.powershell
|
||||||
- match: $\n?
|
- match: $\n?
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.comment.powershell
|
0: punctuation.definition.comment.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: commentEmbeddedDocs
|
- include: commentEmbeddedDocs
|
||||||
- include: RequiresDirective
|
- include: RequiresDirective
|
||||||
doubleQuotedString:
|
doubleQuotedString:
|
||||||
- match: '["\x{201C}-\x{201E}]'
|
- match: (?<!(?<!`)")"
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.powershell
|
0: punctuation.definition.string.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.double.powershell
|
- meta_scope: string.quoted.double.powershell
|
||||||
- match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
|
- match: '"(?!")'
|
||||||
- include: variableNoProperty
|
|
||||||
- include: doubleQuotedStringEscapes
|
|
||||||
- match: '["\x{201C}-\x{201E}]{2}'
|
|
||||||
scope: constant.character.escape.powershell
|
|
||||||
- include: interpolation
|
|
||||||
- match: '`\s*$'
|
|
||||||
scope: keyword.other.powershell
|
|
||||||
- match: '["\x{201C}-\x{201E}]'
|
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.end.powershell
|
0: punctuation.definition.string.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
|
- match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
|
||||||
|
- include: variableNoProperty
|
||||||
|
- include: doubleQuotedStringEscapes
|
||||||
|
- include: interpolation
|
||||||
|
- match: '`\s*$'
|
||||||
|
scope: keyword.other.powershell
|
||||||
doubleQuotedStringEscapes:
|
doubleQuotedStringEscapes:
|
||||||
- match: '`[`0abefnrtv''"\x{2018}-\x{201E}$]'
|
- match: '`[`0abefnrtv"''$]'
|
||||||
scope: constant.character.escape.powershell
|
scope: constant.character.escape.powershell
|
||||||
- include: unicodeEscape
|
- include: unicodeEscape
|
||||||
|
- match: '""'
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
function:
|
function:
|
||||||
- match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
|
- match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
|
||||||
captures:
|
captures:
|
||||||
@@ -272,23 +263,33 @@ contexts:
|
|||||||
4: keyword.operator.assignment.powershell
|
4: keyword.operator.assignment.powershell
|
||||||
- include: scriptblock
|
- include: scriptblock
|
||||||
- include: main
|
- include: main
|
||||||
interpolation:
|
interpolatedStringContent:
|
||||||
- match: (((\$)))((\())
|
- match: \(
|
||||||
captures:
|
captures:
|
||||||
1: keyword.other.substatement.powershell
|
0: punctuation.section.group.begin.powershell
|
||||||
2: punctuation.definition.substatement.powershell
|
|
||||||
3: punctuation.section.embedded.substatement.begin.powershell
|
|
||||||
4: punctuation.section.group.begin.powershell
|
|
||||||
5: punctuation.section.embedded.substatement.begin.powershell
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.embedded.substatement.powershell
|
- meta_content_scope: interpolated.simple.source.powershell
|
||||||
- meta_content_scope: interpolated.complex.source.powershell
|
- match: \)
|
||||||
- match: (\))
|
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.section.group.end.powershell
|
0: punctuation.section.group.end.powershell
|
||||||
1: punctuation.section.embedded.substatement.end.powershell
|
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- include: main
|
||||||
|
- include: interpolation
|
||||||
|
- include: interpolatedStringContent
|
||||||
|
interpolation:
|
||||||
|
- match: (\$)(\()
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_content_scope: interpolated.complex.source.powershell
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- include: interpolation
|
||||||
|
- include: interpolatedStringContent
|
||||||
numericConstant:
|
numericConstant:
|
||||||
- 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'
|
- 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:
|
captures:
|
||||||
@@ -329,17 +330,6 @@ contexts:
|
|||||||
0: punctuation.section.braces.end.powershell
|
0: punctuation.section.braces.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- include: main
|
||||||
subexpression:
|
|
||||||
- match: \(
|
|
||||||
captures:
|
|
||||||
0: punctuation.section.group.begin.powershell
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.group.simple.subexpression.powershell
|
|
||||||
- match: \)
|
|
||||||
captures:
|
|
||||||
0: punctuation.section.group.end.powershell
|
|
||||||
pop: true
|
|
||||||
- include: main
|
|
||||||
type:
|
type:
|
||||||
- match: '\['
|
- match: '\['
|
||||||
captures:
|
captures:
|
||||||
|
|||||||
2
assets/syntaxes/02_Extra/SCSS_Sass
vendored
2
assets/syntaxes/02_Extra/SCSS_Sass
vendored
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: d3d9404640...63819a1ab6
2
assets/syntaxes/02_Extra/TOML
vendored
2
assets/syntaxes/02_Extra/TOML
vendored
Submodule assets/syntaxes/02_Extra/TOML updated: 6bfcc3c236...0f14b7caf3
2
assets/syntaxes/02_Extra/TypeScript
vendored
2
assets/syntaxes/02_Extra/TypeScript
vendored
Submodule assets/syntaxes/02_Extra/TypeScript updated: ba45efd058...a607ddfec9
384
assets/syntaxes/02_Extra/TypeScript.sublime-syntax
vendored
384
assets/syntaxes/02_Extra/TypeScript.sublime-syntax
vendored
@@ -44,7 +44,7 @@ contexts:
|
|||||||
- match: (?=$)
|
- match: (?=$)
|
||||||
pop: true
|
pop: true
|
||||||
access-modifier:
|
access-modifier:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|declare|override|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static|declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: storage.modifier.ts
|
scope: storage.modifier.ts
|
||||||
after-operator-block-as-object-literal:
|
after-operator-block-as-object-literal:
|
||||||
- match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
|
- match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
|
||||||
@@ -106,7 +106,7 @@ contexts:
|
|||||||
(?=
|
(?=
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -116,9 +116,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -268,7 +268,7 @@ contexts:
|
|||||||
- include: decorator
|
- include: decorator
|
||||||
- match: (?<=:)\s*
|
- match: (?<=:)\s*
|
||||||
push:
|
push:
|
||||||
- match: '(?=\s|[;),}\]:\-\+]|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?=\s|[;),}\]:\-\+]|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
- include: method-declaration
|
- include: method-declaration
|
||||||
@@ -317,12 +317,7 @@ contexts:
|
|||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: keyword.control.loop.ts
|
scope: keyword.control.loop.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
captures:
|
scope: keyword.control.flow.ts
|
||||||
0: keyword.control.flow.ts
|
|
||||||
push:
|
|
||||||
- match: '(?=[;}]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
|
||||||
pop: true
|
|
||||||
- include: expression
|
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: keyword.control.switch.ts
|
scope: keyword.control.switch.ts
|
||||||
- include: if-statement
|
- include: if-statement
|
||||||
@@ -767,7 +762,7 @@ contexts:
|
|||||||
4: keyword.control.default.ts
|
4: keyword.control.default.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.export.default.ts
|
- meta_scope: meta.export.default.ts
|
||||||
- match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
- match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
||||||
pop: true
|
pop: true
|
||||||
- include: interface-declaration
|
- include: interface-declaration
|
||||||
- include: expression
|
- include: expression
|
||||||
@@ -777,7 +772,7 @@ contexts:
|
|||||||
2: keyword.control.type.ts
|
2: keyword.control.type.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.export.ts
|
- meta_scope: meta.export.ts
|
||||||
- match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
- match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
||||||
pop: true
|
pop: true
|
||||||
- include: import-export-declaration
|
- include: import-export-declaration
|
||||||
expression:
|
expression:
|
||||||
@@ -790,11 +785,11 @@ contexts:
|
|||||||
- include: string
|
- include: string
|
||||||
- include: decorator
|
- include: decorator
|
||||||
- include: destructuring-parameter
|
- include: destructuring-parameter
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
||||||
# function assignment |
|
# function assignment |
|
||||||
(=\s*(
|
(=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
@@ -803,10 +798,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -816,9 +811,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -836,18 +831,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -857,9 +852,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -870,7 +865,7 @@ contexts:
|
|||||||
3: entity.name.function.ts variable.language.this.ts
|
3: entity.name.function.ts variable.language.this.ts
|
||||||
4: entity.name.function.ts
|
4: entity.name.function.ts
|
||||||
5: keyword.operator.optional.ts
|
5: keyword.operator.optional.ts
|
||||||
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
|
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: keyword.operator.rest.ts
|
2: keyword.operator.rest.ts
|
||||||
@@ -935,11 +930,10 @@ contexts:
|
|||||||
scope: keyword.operator.comparison.ts
|
scope: keyword.operator.comparison.ts
|
||||||
- match: <=|>=|<>|<|>
|
- match: <=|>=|<>|<|>
|
||||||
scope: keyword.operator.relational.ts
|
scope: keyword.operator.relational.ts
|
||||||
- match: '(?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*])))'
|
- match: '(?<=[_$[:alnum:]])(\!)\s*(/)(?![/*])'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.logical.ts
|
1: keyword.operator.logical.ts
|
||||||
2: keyword.operator.assignment.compound.ts
|
2: keyword.operator.arithmetic.ts
|
||||||
3: keyword.operator.arithmetic.ts
|
|
||||||
- match: \!|&&|\|\||\?\?
|
- match: \!|&&|\|\||\?\?
|
||||||
scope: keyword.operator.logical.ts
|
scope: keyword.operator.logical.ts
|
||||||
- match: \&|~|\^|\|
|
- match: \&|~|\^|\|
|
||||||
@@ -952,18 +946,16 @@ contexts:
|
|||||||
scope: keyword.operator.increment.ts
|
scope: keyword.operator.increment.ts
|
||||||
- match: '%|\*|/|-|\+'
|
- match: '%|\*|/|-|\+'
|
||||||
scope: keyword.operator.arithmetic.ts
|
scope: keyword.operator.arithmetic.ts
|
||||||
- match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*]))))'
|
- match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(/)(?![/*]))'
|
||||||
push:
|
push:
|
||||||
- match: '(?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/)))'
|
- match: '(/)(?!\*([^\*]|(\*[^\/]))*\*\/)'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.assignment.compound.ts
|
1: keyword.operator.arithmetic.ts
|
||||||
2: keyword.operator.arithmetic.ts
|
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- match: '(?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*])))'
|
- match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.assignment.compound.ts
|
1: keyword.operator.arithmetic.ts
|
||||||
2: keyword.operator.arithmetic.ts
|
|
||||||
expressionPunctuations:
|
expressionPunctuations:
|
||||||
- include: punctuation-comma
|
- include: punctuation-comma
|
||||||
- include: punctuation-accessor
|
- include: punctuation-accessor
|
||||||
@@ -1029,10 +1021,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1042,9 +1034,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1062,18 +1054,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1083,9 +1075,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1126,19 +1118,18 @@ contexts:
|
|||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- include: function-parameters
|
- include: function-parameters
|
||||||
- include: return-type
|
- include: return-type
|
||||||
- include: type-function-return-type
|
|
||||||
- include: decl-block
|
- include: decl-block
|
||||||
- match: \*
|
- match: \*
|
||||||
scope: keyword.generator.asterisk.ts
|
scope: keyword.generator.asterisk.ts
|
||||||
function-call:
|
function-call:
|
||||||
- match: '(?=(((([_$[: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*)?\())'
|
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
push:
|
push:
|
||||||
- match: '(?<=\))(?!(((([_$[: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*)?\())'
|
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.function-call.ts
|
- meta_scope: meta.function-call.ts
|
||||||
- match: '(?=\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*)?\())'
|
- match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
pop: true
|
pop: true
|
||||||
- include: function-call-target
|
- include: function-call-target
|
||||||
- include: comment
|
- include: comment
|
||||||
@@ -1178,7 +1169,7 @@ contexts:
|
|||||||
6: meta.definition.function.ts entity.name.function.ts
|
6: meta.definition.function.ts entity.name.function.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.function.ts
|
- meta_scope: meta.function.ts
|
||||||
- match: '(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
|
- match: '(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
|
||||||
pop: true
|
pop: true
|
||||||
- include: function-name
|
- include: function-name
|
||||||
- include: function-body
|
- include: function-body
|
||||||
@@ -1230,10 +1221,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1243,9 +1234,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1269,7 +1260,7 @@ contexts:
|
|||||||
- match: "[_$[:alpha:]][_$[:alnum:]]*"
|
- match: "[_$[:alpha:]][_$[:alnum:]]*"
|
||||||
scope: variable.other.readwrite.ts
|
scope: variable.other.readwrite.ts
|
||||||
if-statement:
|
if-statement:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))\s*(?!\{))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\([^\(\)]*\)))*\))\s*(?!\{))'
|
||||||
push:
|
push:
|
||||||
- match: '(?=;|$|\})'
|
- match: '(?=;|$|\})'
|
||||||
pop: true
|
pop: true
|
||||||
@@ -1284,12 +1275,12 @@ contexts:
|
|||||||
0: meta.brace.round.ts
|
0: meta.brace.round.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
- match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
- match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.ts
|
0: punctuation.definition.string.begin.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.regexp.ts
|
- meta_scope: string.regexp.ts
|
||||||
- match: "(/)([dgimsuy]*)"
|
- match: "(/)([gimsuy]*)"
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.end.ts
|
1: punctuation.definition.string.end.ts
|
||||||
2: keyword.other.ts
|
2: keyword.other.ts
|
||||||
@@ -1423,9 +1414,6 @@ contexts:
|
|||||||
2: keyword.operator.type.modifier.ts
|
2: keyword.operator.type.modifier.ts
|
||||||
3: keyword.operator.optional.ts
|
3: keyword.operator.optional.ts
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
|
|
||||||
captures:
|
|
||||||
1: keyword.control.as.ts
|
|
||||||
- include: type
|
- include: type
|
||||||
inline-tags:
|
inline-tags:
|
||||||
- match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
|
- match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
|
||||||
@@ -1516,27 +1504,25 @@ contexts:
|
|||||||
- include: this-literal
|
- include: this-literal
|
||||||
- include: super-literal
|
- include: super-literal
|
||||||
method-declaration:
|
method-declaration:
|
||||||
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: storage.modifier.ts
|
2: storage.modifier.ts
|
||||||
3: storage.modifier.ts
|
3: storage.modifier.async.ts
|
||||||
4: storage.modifier.async.ts
|
4: storage.type.ts
|
||||||
5: storage.type.ts
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.method.declaration.ts
|
- meta_scope: meta.method.declaration.ts
|
||||||
- match: '(?=\}|;|,|$)|(?<=\})'
|
- match: '(?=\}|;|,|$)|(?<=\})'
|
||||||
pop: true
|
pop: true
|
||||||
- include: method-declaration-name
|
- include: method-declaration-name
|
||||||
- include: function-body
|
- include: function-body
|
||||||
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])'
|
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: storage.modifier.ts
|
2: storage.modifier.ts
|
||||||
3: storage.modifier.ts
|
3: storage.modifier.async.ts
|
||||||
4: storage.modifier.async.ts
|
4: keyword.operator.new.ts
|
||||||
5: keyword.operator.new.ts
|
5: keyword.generator.asterisk.ts
|
||||||
6: keyword.generator.asterisk.ts
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.method.declaration.ts
|
- meta_scope: meta.method.declaration.ts
|
||||||
- match: '(?=\}|;|,|$)|(?<=\})'
|
- match: '(?=\}|;|,|$)|(?<=\})'
|
||||||
@@ -1544,7 +1530,7 @@ contexts:
|
|||||||
- include: method-declaration-name
|
- include: method-declaration-name
|
||||||
- include: function-body
|
- include: function-body
|
||||||
- match: |-
|
- match: |-
|
||||||
(?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(?!\$))|((?<!\$)(?:
|
(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\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_]*(\.)[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)| # 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
|
||||||
@@ -1553,14 +1539,13 @@ contexts:
|
|||||||
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 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
|
||||||
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
||||||
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: storage.modifier.ts
|
2: storage.modifier.ts
|
||||||
3: storage.modifier.ts
|
3: storage.modifier.async.ts
|
||||||
4: storage.modifier.async.ts
|
4: storage.type.property.ts
|
||||||
5: storage.type.property.ts
|
5: keyword.generator.asterisk.ts
|
||||||
6: keyword.generator.asterisk.ts
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.method.declaration.ts
|
- meta_scope: meta.method.declaration.ts
|
||||||
- match: '(?=\}|;|,|$)|(?<=\})'
|
- match: '(?=\}|;|,|$)|(?<=\})'
|
||||||
@@ -1597,7 +1582,7 @@ contexts:
|
|||||||
3: storage.type.namespace.ts
|
3: storage.type.namespace.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.namespace.declaration.ts
|
- meta_scope: meta.namespace.declaration.ts
|
||||||
- match: '(?<=\})|(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?<=\})|(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: string
|
- include: string
|
||||||
@@ -1613,7 +1598,9 @@ contexts:
|
|||||||
- meta_scope: new.expr.ts
|
- meta_scope: new.expr.ts
|
||||||
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: paren-expression
|
||||||
|
- include: class-declaration
|
||||||
|
- include: type
|
||||||
null-literal:
|
null-literal:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: constant.language.null.ts
|
scope: constant.language.null.ts
|
||||||
@@ -1794,7 +1781,7 @@ contexts:
|
|||||||
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 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
|
||||||
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
||||||
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
2: storage.type.property.ts
|
2: storage.type.property.ts
|
||||||
@@ -1815,7 +1802,7 @@ contexts:
|
|||||||
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 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
|
||||||
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
||||||
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
2: storage.type.property.ts
|
2: storage.type.property.ts
|
||||||
@@ -1877,10 +1864,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1890,9 +1877,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1943,7 +1930,7 @@ contexts:
|
|||||||
- meta_scope: meta.object.member.ts
|
- meta_scope: meta.object.member.ts
|
||||||
- match: '(?=,|\})'
|
- match: '(?=,|\})'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
push:
|
push:
|
||||||
@@ -1959,7 +1946,7 @@ contexts:
|
|||||||
0: meta.brace.round.ts
|
0: meta.brace.round.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression-inside-possibly-arrow-parens
|
- include: expression-inside-possibly-arrow-parens
|
||||||
- match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
2: meta.brace.round.ts
|
2: meta.brace.round.ts
|
||||||
@@ -1976,7 +1963,7 @@ contexts:
|
|||||||
- match: (?<=\>)
|
- match: (?<=\>)
|
||||||
pop: true
|
pop: true
|
||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: meta.brace.round.ts
|
1: meta.brace.round.ts
|
||||||
push:
|
push:
|
||||||
@@ -2010,11 +1997,11 @@ contexts:
|
|||||||
- include: destructuring-parameter-rest
|
- include: destructuring-parameter-rest
|
||||||
- include: variable-initializer
|
- include: variable-initializer
|
||||||
parameter-name:
|
parameter-name:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
||||||
# function assignment |
|
# function assignment |
|
||||||
(=\s*(
|
(=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
@@ -2023,10 +2010,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -2036,9 +2023,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -2056,18 +2043,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -2077,9 +2064,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -2090,7 +2077,7 @@ contexts:
|
|||||||
3: entity.name.function.ts variable.language.this.ts
|
3: entity.name.function.ts variable.language.this.ts
|
||||||
4: entity.name.function.ts
|
4: entity.name.function.ts
|
||||||
5: keyword.operator.optional.ts
|
5: keyword.operator.optional.ts
|
||||||
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
|
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: keyword.operator.rest.ts
|
2: keyword.operator.rest.ts
|
||||||
@@ -2150,14 +2137,14 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
paren-expression-possibly-arrow:
|
paren-expression-possibly-arrow:
|
||||||
- match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
push:
|
push:
|
||||||
- match: (?<=\))
|
- match: (?<=\))
|
||||||
pop: true
|
pop: true
|
||||||
- include: paren-expression-possibly-arrow-with-typeparameters
|
- include: paren-expression-possibly-arrow-with-typeparameters
|
||||||
- match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
|
- match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
push:
|
push:
|
||||||
@@ -2177,7 +2164,7 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: expression-inside-possibly-arrow-parens
|
- include: expression-inside-possibly-arrow-parens
|
||||||
possibly-arrow-return-type:
|
possibly-arrow-return-type:
|
||||||
- match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
|
- match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
|
||||||
captures:
|
captures:
|
||||||
1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
|
1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
|
||||||
push:
|
push:
|
||||||
@@ -2224,23 +2211,23 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: string-character-escape
|
- include: string-character-escape
|
||||||
regex:
|
regex:
|
||||||
- match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
- match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.begin.ts
|
1: punctuation.definition.string.begin.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.regexp.ts
|
- meta_scope: string.regexp.ts
|
||||||
- match: "(/)([dgimsuy]*)"
|
- match: "(/)([gimsuy]*)"
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.end.ts
|
1: punctuation.definition.string.end.ts
|
||||||
2: keyword.other.ts
|
2: keyword.other.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: regexp
|
- include: regexp
|
||||||
- match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
- match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.ts
|
0: punctuation.definition.string.begin.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.regexp.ts
|
- meta_scope: string.regexp.ts
|
||||||
- match: "(/)([dgimsuy]*)"
|
- match: "(/)([gimsuy]*)"
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.end.ts
|
1: punctuation.definition.string.end.ts
|
||||||
2: keyword.other.ts
|
2: keyword.other.ts
|
||||||
@@ -2443,7 +2430,7 @@ contexts:
|
|||||||
4: support.variable.property.target.ts
|
4: support.variable.property.target.ts
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
|
(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
|
||||||
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
|
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
|
||||||
|
|
|
|
||||||
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
|
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
|
||||||
captures:
|
captures:
|
||||||
@@ -2549,7 +2536,7 @@ contexts:
|
|||||||
|siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
|
|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
|
|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
|
|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*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
|
|vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.accessor.ts
|
1: punctuation.accessor.ts
|
||||||
2: punctuation.accessor.optional.ts
|
2: punctuation.accessor.optional.ts
|
||||||
@@ -2716,7 +2703,27 @@ contexts:
|
|||||||
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
||||||
- include: statements
|
- include: statements
|
||||||
template:
|
template:
|
||||||
- include: template-call
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||||
|
push:
|
||||||
|
- meta_scope: string.template.ts
|
||||||
|
- match: (?=`)
|
||||||
|
pop: true
|
||||||
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
|
push:
|
||||||
|
- match: '(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||||
|
pop: true
|
||||||
|
- include: support-function-call-identifiers
|
||||||
|
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
||||||
|
scope: entity.name.function.tagged-template.ts
|
||||||
|
- include: type-arguments
|
||||||
|
- match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.tagged-template.ts
|
||||||
|
push:
|
||||||
|
- meta_scope: string.template.ts
|
||||||
|
- match: (?=`)
|
||||||
|
pop: true
|
||||||
|
- include: type-arguments
|
||||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
|
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
|
||||||
captures:
|
captures:
|
||||||
1: entity.name.function.tagged-template.ts
|
1: entity.name.function.tagged-template.ts
|
||||||
@@ -2729,28 +2736,6 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: template-substitution-element
|
- include: template-substitution-element
|
||||||
- include: string-character-escape
|
- include: string-character-escape
|
||||||
template-call:
|
|
||||||
- match: '(?=(([_$[: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*)?`)'
|
|
||||||
push:
|
|
||||||
- meta_scope: string.template.ts
|
|
||||||
- match: (?=`)
|
|
||||||
pop: true
|
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
|
||||||
push:
|
|
||||||
- match: '(?=(<\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*)?`)'
|
|
||||||
pop: true
|
|
||||||
- include: support-function-call-identifiers
|
|
||||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
|
||||||
scope: entity.name.function.tagged-template.ts
|
|
||||||
- include: type-arguments
|
|
||||||
- match: '([_$[: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*)`)'
|
|
||||||
captures:
|
|
||||||
1: entity.name.function.tagged-template.ts
|
|
||||||
push:
|
|
||||||
- meta_scope: string.template.ts
|
|
||||||
- match: (?=`)
|
|
||||||
pop: true
|
|
||||||
- include: type-arguments
|
|
||||||
template-substitution-element:
|
template-substitution-element:
|
||||||
- match: '\$\{'
|
- match: '\$\{'
|
||||||
captures:
|
captures:
|
||||||
@@ -2763,32 +2748,6 @@ contexts:
|
|||||||
0: punctuation.definition.template-expression.end.ts
|
0: punctuation.definition.template-expression.end.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
template-type:
|
|
||||||
- include: template-call
|
|
||||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
|
|
||||||
captures:
|
|
||||||
1: entity.name.function.tagged-template.ts
|
|
||||||
2: punctuation.definition.string.template.begin.ts
|
|
||||||
push:
|
|
||||||
- meta_scope: string.template.ts
|
|
||||||
- match: "`"
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.template.end.ts
|
|
||||||
pop: true
|
|
||||||
- include: template-type-substitution-element
|
|
||||||
- include: string-character-escape
|
|
||||||
template-type-substitution-element:
|
|
||||||
- match: '\$\{'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.template-expression.begin.ts
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.template.expression.ts
|
|
||||||
- meta_content_scope: meta.embedded.line.ts
|
|
||||||
- match: '\}'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.template-expression.end.ts
|
|
||||||
pop: true
|
|
||||||
- include: type
|
|
||||||
ternary-expression:
|
ternary-expression:
|
||||||
- match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
|
- match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
|
||||||
captures:
|
captures:
|
||||||
@@ -2804,7 +2763,7 @@ contexts:
|
|||||||
scope: variable.language.this.ts
|
scope: variable.language.this.ts
|
||||||
type:
|
type:
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: type-string
|
- include: string
|
||||||
- include: numeric-literal
|
- include: numeric-literal
|
||||||
- include: type-primitive
|
- include: type-primitive
|
||||||
- include: type-builtin-literals
|
- include: type-builtin-literals
|
||||||
@@ -2829,23 +2788,15 @@ contexts:
|
|||||||
4: entity.name.type.alias.ts
|
4: entity.name.type.alias.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.type.declaration.ts
|
- meta_scope: meta.type.declaration.ts
|
||||||
- match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- match: '(=)\s*(intrinsic)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
|
||||||
captures:
|
|
||||||
1: keyword.operator.assignment.ts
|
|
||||||
2: keyword.control.intrinsic.ts
|
|
||||||
push:
|
|
||||||
- match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
|
||||||
pop: true
|
|
||||||
- include: type
|
|
||||||
- match: (=)\s*
|
- match: (=)\s*
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.assignment.ts
|
1: keyword.operator.assignment.ts
|
||||||
push:
|
push:
|
||||||
- match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: type
|
- include: type
|
||||||
type-annotation:
|
type-annotation:
|
||||||
@@ -2903,19 +2854,17 @@ contexts:
|
|||||||
- include: type
|
- include: type
|
||||||
- include: type
|
- include: type
|
||||||
type-fn-type-parameters:
|
type-fn-type-parameters:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<)'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)'
|
||||||
captures:
|
captures:
|
||||||
1: meta.type.constructor.ts storage.modifier.ts
|
1: meta.type.constructor.ts keyword.control.new.ts
|
||||||
2: meta.type.constructor.ts keyword.control.new.ts
|
|
||||||
push:
|
push:
|
||||||
- match: (?<=>)
|
- match: (?<=>)
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\()'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: keyword.control.new.ts
|
||||||
2: keyword.control.new.ts
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.type.constructor.ts
|
- meta_scope: meta.type.constructor.ts
|
||||||
- match: (?<=\))
|
- match: (?<=\))
|
||||||
@@ -3044,6 +2993,8 @@ contexts:
|
|||||||
scope: keyword.operator.ternary.ts
|
scope: keyword.operator.ternary.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
||||||
scope: keyword.operator.expression.infer.ts
|
scope: keyword.operator.expression.infer.ts
|
||||||
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))awaited(?=\s+[_$[:alpha:]])'
|
||||||
|
scope: keyword.operator.expression.awaited.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
||||||
scope: keyword.operator.expression.import.ts
|
scope: keyword.operator.expression.import.ts
|
||||||
type-parameters:
|
type-parameters:
|
||||||
@@ -3086,7 +3037,7 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: keyword.operator.rest.ts
|
2: keyword.operator.rest.ts
|
||||||
@@ -3123,10 +3074,6 @@ contexts:
|
|||||||
type-primitive:
|
type-primitive:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: support.type.primitive.ts
|
scope: support.type.primitive.ts
|
||||||
type-string:
|
|
||||||
- include: qstring-single
|
|
||||||
- include: qstring-double
|
|
||||||
- include: template-type
|
|
||||||
type-tuple:
|
type-tuple:
|
||||||
- match: '\['
|
- match: '\['
|
||||||
captures:
|
captures:
|
||||||
@@ -3148,12 +3095,7 @@ contexts:
|
|||||||
- include: punctuation-comma
|
- include: punctuation-comma
|
||||||
typeof-operator:
|
typeof-operator:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
captures:
|
scope: keyword.operator.expression.typeof.ts
|
||||||
0: keyword.operator.expression.typeof.ts
|
|
||||||
push:
|
|
||||||
- match: '(?=[,);}\]=>:&|{\?]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
|
||||||
pop: true
|
|
||||||
- include: expression
|
|
||||||
undefined-literal:
|
undefined-literal:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: constant.language.undefined.ts
|
scope: constant.language.undefined.ts
|
||||||
@@ -3161,7 +3103,7 @@ contexts:
|
|||||||
- match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
|
- match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.var.expr.ts
|
- meta_scope: meta.var.expr.ts
|
||||||
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
|
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
||||||
captures:
|
captures:
|
||||||
@@ -3194,7 +3136,7 @@ contexts:
|
|||||||
3: storage.type.ts
|
3: storage.type.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.var.expr.ts
|
- meta_scope: meta.var.expr.ts
|
||||||
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
|
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
||||||
captures:
|
captures:
|
||||||
@@ -3231,10 +3173,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3244,9 +3186,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -3264,18 +3206,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3285,9 +3227,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -3318,10 +3260,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3331,9 +3273,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -3351,18 +3293,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\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
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3372,9 +3314,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|||||||
1237
assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax
vendored
1237
assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax
vendored
File diff suppressed because it is too large
Load Diff
1
assets/syntaxes/02_Extra/requirementstxt
vendored
Submodule
1
assets/syntaxes/02_Extra/requirementstxt
vendored
Submodule
Submodule assets/syntaxes/02_Extra/requirementstxt added at 775e6dd62a
19
assets/syntaxes/02_Extra/requirementstxt.sublime-syntax
vendored
Normal file
19
assets/syntaxes/02_Extra/requirementstxt.sublime-syntax
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: requirements.txt
|
||||||
|
file_extensions:
|
||||||
|
- requirements.txt
|
||||||
|
scope: source.requirementstxt
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: (#).*$\n?
|
||||||
|
scope: comment.line.requirementstxt
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.requirementstxt
|
||||||
|
- match: '(?i)^[a-z0-9_\-\.]+'
|
||||||
|
scope: string.package_name.requirementstxt
|
||||||
|
- match: (?i)==|<|<=|>=|>
|
||||||
|
scope: keyword.operator.logical.punctuation.requirementstxt
|
||||||
|
- match: '(?i)\d+\.[\da-z\-_\.]*'
|
||||||
|
scope: constant.numeric.verions.requirementstxt
|
||||||
2
assets/syntaxes/02_Extra/ssh-config
vendored
2
assets/syntaxes/02_Extra/ssh-config
vendored
Submodule assets/syntaxes/02_Extra/ssh-config updated: e1012e9f13...201816b609
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
@@ -13,7 +13,7 @@
|
|||||||
<a href="#カスタマイズ">カスタマイズ</a> •
|
<a href="#カスタマイズ">カスタマイズ</a> •
|
||||||
<a href="#プロジェクトの目標と既存の類似したOSS">プロジェクトの目標と既存の類似したOSS</a><br>
|
<a href="#プロジェクトの目標と既存の類似したOSS">プロジェクトの目標と既存の類似したOSS</a><br>
|
||||||
[<a href="../README.md">English</a>]
|
[<a href="../README.md">English</a>]
|
||||||
[<a href="README-zh.md">中文</a>]
|
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
|
||||||
[日本語]
|
[日本語]
|
||||||
[<a href="README-ko.md">한국어</a>]
|
[<a href="README-ko.md">한국어</a>]
|
||||||
[<a href="README-ru.md">Русский</a>]
|
[<a href="README-ru.md">Русский</a>]
|
||||||
@@ -366,7 +366,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
### From source
|
### From source
|
||||||
|
|
||||||
|
|
||||||
`bat` をソースからビルドしたいならば、Rust 1.51 以上の環境が必要です。
|
`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
|
||||||
`cargo` を使用してビルドすることができます:
|
`cargo` を使用してビルドすることができます:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<a href="#사용자화">사용자화</a> •
|
<a href="#사용자화">사용자화</a> •
|
||||||
<a href="#프로젝트-목표와-대안들">프로젝트 목표와 대안들</a><br>
|
<a href="#프로젝트-목표와-대안들">프로젝트 목표와 대안들</a><br>
|
||||||
[<a href="../README.md">English</a>]
|
[<a href="../README.md">English</a>]
|
||||||
[<a href="README-zh.md">中文</a>]
|
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
|
||||||
[<a href="README-ja.md">日本語</a>]
|
[<a href="README-ja.md">日本語</a>]
|
||||||
[한국어]
|
[한국어]
|
||||||
[<a href="README-ru.md">Русский</a>]
|
[<a href="README-ru.md">Русский</a>]
|
||||||
@@ -416,7 +416,7 @@ scoop install bat
|
|||||||
|
|
||||||
### 소스에서
|
### 소스에서
|
||||||
|
|
||||||
`bat`의 소스를 빌드하기 위해서는, Rust 1.51 이상이 필요합니다.
|
`bat`의 소스를 빌드하기 위해서는, Rust 1.46 이상이 필요합니다.
|
||||||
`cargo`를 이용해 전부 빌드할 수 있습니다:
|
`cargo`를 이용해 전부 빌드할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<a href="#кастомизация">Кастомизация</a> •
|
<a href="#кастомизация">Кастомизация</a> •
|
||||||
<a href="#цели-и-альтернативы">Цели и альтернативы </a><br>
|
<a href="#цели-и-альтернативы">Цели и альтернативы </a><br>
|
||||||
[<a href="../README.md">English]
|
[<a href="../README.md">English]
|
||||||
[<a href="README-zh.md">中文</a>]
|
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
|
||||||
[<a href="README-ja.md">日本語</a>]
|
[<a href="README-ja.md">日本語</a>]
|
||||||
[<a href="README-ko.md">한국어</a>]
|
[<a href="README-ko.md">한국어</a>]
|
||||||
[Русский]
|
[Русский]
|
||||||
@@ -344,7 +344,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
|
|
||||||
### Из исходников
|
### Из исходников
|
||||||
|
|
||||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.51 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.46 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --locked bat
|
cargo install --locked bat
|
||||||
|
|||||||
678
doc/README-zh.md
678
doc/README-zh.md
@@ -1,678 +0,0 @@
|
|||||||
<p align="center">
|
|
||||||
<img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
|
|
||||||
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
|
||||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
|
||||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
|
||||||
类似 <i>cat(1)</i>,但带有 git 集成和语法高亮.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="#语法高亮">主要功能</a> •
|
|
||||||
<a href="#如何使用">使用方法</a> •
|
|
||||||
<a href="#安装">安装</a> •
|
|
||||||
<a href="#自定义">自定义</a> •
|
|
||||||
<a href="#project-goals-and-alternatives">项目目标和替代方案</a><br>
|
|
||||||
[<a href="../README.md">English</a>]
|
|
||||||
[中文]
|
|
||||||
[<a href="README-ja.md">日本語</a>]
|
|
||||||
[<a href="README-ko.md">한국어</a>]
|
|
||||||
[<a href="README-ru.md">Русский</a>]
|
|
||||||
</p>
|
|
||||||
|
|
||||||
### 语法高亮
|
|
||||||
|
|
||||||
`bat` 对大部分编程语言和标记语言提供语法高亮:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Git 集成
|
|
||||||
|
|
||||||
`bat` 能从 git 中获取文件的修改并展示在边栏(见下图):
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 不可打印(non-printable)字符可视化
|
|
||||||
|
|
||||||
添加`-A`/`--show-all`参数可以文件文件中的不可打印字符:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 自动分页
|
|
||||||
|
|
||||||
`bat`会在一般情况下将大于屏幕可显示范围的内容输出到分页器(pager, e.g. `less`)。
|
|
||||||
|
|
||||||
你可以在调用时添加`--paging=never`参数来使`bat`不使用分页器(就像`cat`一样)。如果你想要用为`cat`使用`bat`别名,可以在 shell 配置文件(shell configuration)中添加`alias cat='bat --paging=never'`。
|
|
||||||
|
|
||||||
#### 智能输出
|
|
||||||
|
|
||||||
`bat`能够在设置了分页器选项的同时进行管道:wink:。
|
|
||||||
当`bat`检测到当前环境为非可交互终端或管道时(例如使用`bat`并将内容用管道输出到文件),`bat`会像`cat`一样,一次输出文件内容为纯文本且无视`--paging`参数。
|
|
||||||
|
|
||||||
## 如何使用
|
|
||||||
|
|
||||||
在终端中查看一个文件
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> bat README.md
|
|
||||||
```
|
|
||||||
|
|
||||||
一次性展示多个文件
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> bat src/*.rs
|
|
||||||
```
|
|
||||||
|
|
||||||
从`stdin`读入流,自动为内容添加语法高亮(前提是输入内容的语言可以被正确识别,通常根据内容第一行的 shebang 标记,形如`#!bin/sh`)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> curl -s https://sh.rustup.rs | bat
|
|
||||||
```
|
|
||||||
|
|
||||||
显式指定`stdin`输入的语言
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> yaml2json .travis.yml | json_pp | bat -l json
|
|
||||||
```
|
|
||||||
|
|
||||||
显示不可打印字符
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> bat -A /etc/hosts
|
|
||||||
```
|
|
||||||
|
|
||||||
与`cat`的兼容性
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat > note.md # 创建一个空文件
|
|
||||||
|
|
||||||
bat header.md content.md footer.md > document.md
|
|
||||||
|
|
||||||
bat -n main.rs # 只显示行号
|
|
||||||
|
|
||||||
bat f - g # 输出 f,接着是标准输入流,最后 g
|
|
||||||
```
|
|
||||||
|
|
||||||
### 第三方工具交互
|
|
||||||
|
|
||||||
#### `fzf`
|
|
||||||
|
|
||||||
你可以使用`bat`作为`fzf`的预览器。这需要在`bat`后添加`--color=always`选项,以及`--line-range` 选项来限制大文件的加载次数。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
|
||||||
```
|
|
||||||
|
|
||||||
更多信息请参阅[`fzf`的说明](https://github.com/junegunn/fzf#preview-window)。
|
|
||||||
|
|
||||||
#### `find` 或 `fd`
|
|
||||||
|
|
||||||
你可以使用`find`的`-exec`选项来用`bat`预览搜索结果:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
find … -exec bat {} +
|
|
||||||
```
|
|
||||||
|
|
||||||
亦或者在用`fd`时添加`-X`/`--exec-batch`选项:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
fd … -X bat
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `ripgrep`
|
|
||||||
|
|
||||||
`bat`也能用`batgrep`来显示`ripgrep`的搜索结果。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
batgrep needle src/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `tail -f`
|
|
||||||
|
|
||||||
当与`tail -f`一起使用,`bat`可以持续监视文件内容并为其添加语法高亮。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
|
||||||
```
|
|
||||||
|
|
||||||
注意:这项功能需要在关闭分页时使用,同时要手动指定输入的内容语法(通过`-l log`)。
|
|
||||||
|
|
||||||
#### `git`
|
|
||||||
|
|
||||||
`bat`也能直接接受来自`git show`的输出并为其添加语法高亮(当然也需要手动指定语法):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git show v0.6.0:src/main.rs | bat -l rs
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `git diff`
|
|
||||||
|
|
||||||
`bat`也可以和`git diff`一起使用:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
batdiff() {
|
|
||||||
git diff --name-only --diff-filter=d | xargs bat --diff
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
该功能也作为一个独立工具提供,你可以在[`bat-extras`](https://github.com/eth-p/bat-extras)中找到`batdiff`。
|
|
||||||
|
|
||||||
如果你想了解更多 git 和 diff 的信息,参阅[`delta`](https://github.com/dandavison/delta)。
|
|
||||||
|
|
||||||
#### `xclip`
|
|
||||||
|
|
||||||
当需要拷贝文件内容时,行号以及 git 标记会影响输出,此时可以使用`-p`/`--plain`参数来把纯文本传递给`xclip`。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat main.cpp | xclip
|
|
||||||
```
|
|
||||||
|
|
||||||
`bat`会检测输出是否是管道重定向来决定是否使用纯文本输出。
|
|
||||||
|
|
||||||
#### `man`
|
|
||||||
|
|
||||||
`bat`也能给`man`的输出上色。这需要设置`MANPAGER`环境变量:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
|
||||||
man 2 select
|
|
||||||
```
|
|
||||||
|
|
||||||
(如果你使用的是 Debian 或者 Ubuntu,使用`batcat`替换`bat`)
|
|
||||||
|
|
||||||
如果你遇到格式化问题,设置`MANROFFOPT="-c"`也许会有帮助。
|
|
||||||
|
|
||||||
`batman`能提供类似功能——作为一个独立的命令。
|
|
||||||
|
|
||||||
注意:[man page 语法](assets/syntaxes/02_Extra/Manpage.sublime-syntax) 还需要完善。在使用特定的`man`实现时该功能[无法正常工作](https://github.com/sharkdp/bat/issues/1145)。
|
|
||||||
|
|
||||||
#### `prettier` / `shfmt` / `rustfmt`
|
|
||||||
|
|
||||||
`prettybat`脚本能够格式化代码并用`bat`输出。
|
|
||||||
|
|
||||||
## 安装
|
|
||||||
|
|
||||||
[](https://repology.org/project/bat-cat/versions)
|
|
||||||
|
|
||||||
### Ubuntu (使用 `apt`)
|
|
||||||
|
|
||||||
*... 以及其他基于 Debian的发行版.*
|
|
||||||
|
|
||||||
`bat` 要求的版本: [Ubuntu 高于 20.04 ("Focal")](https://packages.ubuntu.com/search?keywords=bat&exact=1) 和 [Debian 高于 August 2021 (Debian 11 - "Bullseye")](https://packages.debian.org/bullseye/bat).
|
|
||||||
|
|
||||||
当你的发行版满足条件那么直接在终端运执行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
重要:如果你通过这种方法安装`bat`,请留意你所安装的可执行文件是否为`batcat`(由[其他包的可执行文件名冲突](https://github.com/sharkdp/bat/issues/982)造成)。你可以创建一个`bat -> batcat`的符号链接(symlink)或别名来避免因为可执行文件不同带来的问题并与其他发行版保持一致性。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p ~/.local/bin
|
|
||||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ubuntu (使用`.deb`包)
|
|
||||||
|
|
||||||
*... 以及其他基于 Debian的发行版.*
|
|
||||||
|
|
||||||
如果你无法使用上一种方法安装,或需要用最新版的`bat`,你可以从[release 页面](https://github.com/sharkdp/bat/releases)下载最新的`.deb`包并通过下述方法安装:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
|
|
||||||
```
|
|
||||||
|
|
||||||
### Alpine Linux
|
|
||||||
|
|
||||||
你可以用下面下列命令从官方源中安装[`bat 包`](https://pkgs.alpinelinux.org/packages?name=bat):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apk add bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Arch Linux
|
|
||||||
|
|
||||||
你可以用下面下列命令从官方源中安装[`bat`包](https://www.archlinux.org/packages/community/x86_64/bat/):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pacman -S bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Fedora
|
|
||||||
|
|
||||||
你可以使用下列命令从官方[Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/)仓库安装[`bat` 包](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
dnf install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Funtoo Linux
|
|
||||||
|
|
||||||
你可以从 dev-kit 中安装[`bat` 包](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
emerge sys-apps/bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gentoo Linux
|
|
||||||
|
|
||||||
你可以使用下列命令从官方源中安装 [`bat` 包](https://packages.gentoo.org/packages/sys-apps/bat):
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
|
||||||
emerge sys-apps/bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Void Linux
|
|
||||||
|
|
||||||
你可以用 xbps-install 安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
xbps-install -S bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Termux:
|
|
||||||
|
|
||||||
你可以用 pkg 安装`bat:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pkg install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### FreeBSD
|
|
||||||
|
|
||||||
你可以用 pkg 来安装一份预编译的[`bat` 包](https://www.freshports.org/textproc/bat):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pkg install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
或从 FreeBSD ports 自己编译一份:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /usr/ports/textproc/bat
|
|
||||||
make install
|
|
||||||
```
|
|
||||||
|
|
||||||
### OpenBSD
|
|
||||||
|
|
||||||
你可以用`pkg——add`安装`bat`包
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pkg_add bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### 通过 nix
|
|
||||||
|
|
||||||
你可以用[nix 包管理器](https://nixos.org/nix)安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix-env -i bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### openSUSE
|
|
||||||
|
|
||||||
你可以用 zypper 安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
zypper install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### 通过 snap
|
|
||||||
|
|
||||||
目前还没有推荐的 snap 包可用。可以使用其他现存的包但不会受到官方支持且可能会遇到[问题](https://github.com/sharkdp/bat/issues/1519)。
|
|
||||||
|
|
||||||
### macOS (或 Linux) 通过 Homebrew
|
|
||||||
|
|
||||||
你可以用 [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) 或者 [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat) 安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### macOS 通过 MacPorts
|
|
||||||
|
|
||||||
或用 [MacPorts](https://ports.macports.org/port/bat/summary) 安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
port install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
|
|
||||||
在 Windows 上具有多种安装`bat`的方法。若你已完成安装,记得看看 ["在 Windows 上使用`bat`"](#在-Windows-中使用-bat) 。
|
|
||||||
|
|
||||||
#### 前置条件
|
|
||||||
|
|
||||||
你必须已安装 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
|
|
||||||
|
|
||||||
#### 使用 Chocolatey
|
|
||||||
|
|
||||||
你可以用[Chocolatey](https://chocolatey.org/packages/Bat) 安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
choco install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 使用 Scoop
|
|
||||||
|
|
||||||
你可以用 [scoop](https://scoop.sh/) 安装`bat`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
scoop install bat
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 使用预编译二进制版本
|
|
||||||
|
|
||||||
直接从 [Release 发布页](https://github.com/sharkdp/bat/releases) 下载已经编译好的二进制包,前提是你安装了 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
|
|
||||||
|
|
||||||
### 使用二进制版本
|
|
||||||
|
|
||||||
在 [Release 发布页](https://github.com/sharkdp/bat/releases) 中可以找到为多种架构构建的`bat`版本和静态编译的二进制文件(文件名带有`musl`)。
|
|
||||||
|
|
||||||
### 从源码编译
|
|
||||||
|
|
||||||
如果你想要自己构建`bat`,那么你需要安装有高于1.51版本的 Rust。
|
|
||||||
|
|
||||||
使用以下命令编译。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo install --locked bat
|
|
||||||
```
|
|
||||||
|
|
||||||
注意:man page或 shell 自动补全所需要的额外文件无法通过该方法安装。但你可以在`cargo`的生成目录找到这些文件(`build`目录下)。
|
|
||||||
|
|
||||||
## 自定义
|
|
||||||
|
|
||||||
### 语法高亮主题
|
|
||||||
|
|
||||||
使用 `bat --list-themes` 一份语法高亮主题的清单,然后用`--theme=TwoDark`来指定主题为`TwoDark`,也可以通过设置`BAT_THEME`环境变量来选定主题。把`export BAT_THEME="TwoDark"`添加到 shell 的启动脚本(shell startup file)来取得永久效果。或者使用`bat`的[配置文件](#c配置文件)
|
|
||||||
|
|
||||||
若想要查看所有主题在一个文件上的显示效果可以用一下命令(需要安装`fzf`):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
|
||||||
```
|
|
||||||
|
|
||||||
`bat`在默认情况下能够在黑色主题背景下获得较好的效果,如果你的终端使用亮色背景,可以试试`GitHub`或`OneHalfLight`。想要添加自定义主题可以参考[添加主题](#添加主题)。
|
|
||||||
|
|
||||||
### 8-bit 主题
|
|
||||||
|
|
||||||
`bat` 自带三个 [8-bit 色彩](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 主题:
|
|
||||||
|
|
||||||
- `ansi` 适应于大部分终端。它使用 3-bit 色彩:黑红绿黄蓝洋红靛青白。
|
|
||||||
- `base16`专为 [base16](https://github.com/chriskempson/base16) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md) 制作。
|
|
||||||
- `base16-25`专为 [base16-shell](https://github.com/chriskempson/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
|
|
||||||
|
|
||||||
尽管这些主题具有诸多限制,但具有一些 truecolor 主题不具有的三个优点:
|
|
||||||
|
|
||||||
- 享有最佳兼容性。并不是所有终端工具都支持高于 3-bit 的色彩。
|
|
||||||
- 适应终端主题。
|
|
||||||
- 视觉上和其他的终端工具更协调。
|
|
||||||
|
|
||||||
### 输出样式
|
|
||||||
|
|
||||||
你可以用`--style`参数来控制`bat`输出的样式。使用`--style=numbers,chanegs`可以只开启 Git 修改和行号显示而不添加其他内容。`BAT_STYLE`环境变量具有相同功能。
|
|
||||||
|
|
||||||
### 添加新的语言和语法
|
|
||||||
|
|
||||||
当现有的`bat`不支持某个语言或语法时你可以自己添加。
|
|
||||||
|
|
||||||
`bat`使用`syntect`库来支持语法高亮,该库使用 [Sublime Text `.sublime-syntax` 语法文件](https://www.sublimetext.com/docs/3/syntax.html)和主题。而后者中的大部分可以在 [Package Control](https://packagecontrol.io/) 找到。
|
|
||||||
|
|
||||||
当你找到一份语法文件,按照下列方法:
|
|
||||||
|
|
||||||
1. 创建包含语法描述文件的目录:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
|
||||||
cd "$(bat --config-dir)/syntaxes"
|
|
||||||
|
|
||||||
# Put new '.sublime-syntax' language definition files
|
|
||||||
# in this folder (or its subdirectories), for example:
|
|
||||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
|
||||||
```
|
|
||||||
|
|
||||||
2. 调用下面指令把文件转换为二进制缓存:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat cache --build
|
|
||||||
```
|
|
||||||
|
|
||||||
3. 最后用`bat --list-languages`来检查新的语法是否被成功导入。如果想要回滚到最初状态,执行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat cache --clear
|
|
||||||
```
|
|
||||||
|
|
||||||
4. 如果你觉得`bat`有必要自带该语法支持,请在阅读[指导](doc/assets.md)后向仓库提交 [Syntax Request](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md)。
|
|
||||||
|
|
||||||
### 添加主题
|
|
||||||
|
|
||||||
类似添加语法支持,第一步也是创建一个带有语法高亮的目录
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p "$(bat --config-dir)/themes"
|
|
||||||
cd "$(bat --config-dir)/themes"
|
|
||||||
|
|
||||||
# 下载一个主题
|
|
||||||
git clone https://github.com/greggb/sublime-snazzy
|
|
||||||
|
|
||||||
# 更新二进制缓存
|
|
||||||
bat cache --build
|
|
||||||
```
|
|
||||||
|
|
||||||
然后用`bat --list-themes`检查添加是否成功。
|
|
||||||
|
|
||||||
### 添加或修改文件关联
|
|
||||||
|
|
||||||
你可以用`--map-syntax`参数添加或修改文件名模板。它需要一个类似`pattern:syntax`的参数来指定,其中`pattern`是 glob 文件匹配模板,`syntax`则是支持的语法的完整名(使用`bat --list-languages`来查看获取一份清单)。
|
|
||||||
|
|
||||||
注意:方便起见,你可能需要把参数添加到配置文件,而不是每次都在命令行中传递该参数。
|
|
||||||
|
|
||||||
以下展示了把“INI”关联到具有`.conf`扩展名的文件
|
|
||||||
|
|
||||||
```bash
|
|
||||||
--map-syntax='*.conf:INI'
|
|
||||||
```
|
|
||||||
|
|
||||||
把`.ignore`文件与“Git Ignore”关联
|
|
||||||
|
|
||||||
```bash
|
|
||||||
--map-syntax='.ignore:Git Ignore'
|
|
||||||
```
|
|
||||||
|
|
||||||
把`/etc/apache2`内的`.conf`文件关联到“Apache Conf”语法(`bat`已默认绑定)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
--map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 使用自定义分页器
|
|
||||||
|
|
||||||
`bat`默认使用`PAGER`环境变量定义的分页器,如果没有定义则使用`less`。`bat`提供了`BAT_PAGER`环境变量来专为`bat`选择分页器(优先级高于`PAGER`)。
|
|
||||||
|
|
||||||
注意:当`PAGER`设置为`more`或`most`时,`bat`会使用`less`来代替以确保能提供色彩支持。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export BAT_PAGER="less -RF"
|
|
||||||
```
|
|
||||||
|
|
||||||
除了使用环境变量来改变`bat`使用的的分页器,也可以在配置文件中提供`--pager`参数。
|
|
||||||
|
|
||||||
注意:`bat`会把部分命令行参数直接传递给分页器:`-R`/`--RAW-CONTROL-CHARS`,`-F`/`--quit-if-one-screen`以及`-X`/`--no-init`(该参数仅适用于高于530版本的`less`)。其中`-R` 参数需要在解释 ANSI 标准颜色时起作用。`-F`则指示`less`在输出内容的垂直尺寸小于终端尺寸时立即退出。当文件内容可以在一个屏幕里完全显示时,就不需要按`q`键退出阅读模式,很方便就是了。`-X`则能修复`-F`在`less`的老版本中的一些bug(代价是不支持鼠标滚轮,但可以用`-R`来取消`quit-if-one-screen`功能。)。
|
|
||||||
|
|
||||||
### 缩进
|
|
||||||
|
|
||||||
`bat` 使用四个空格宽的制表符,而不受分页器影响,同时也可以用`--tabs`参数来自定义。
|
|
||||||
|
|
||||||
注意:通过其他方法针对分页器的制表符设置不会生效(例如通过`bat`的`--pager`参数传递或`less`使用的`LESS`环境变量)。因为在输出提交给分页器之前,内容中的制表符就已经被`bat`替换为了特定长度的空格以避免由于边栏导致的缩进问题。你可以用给`bat`传递`--tabs=0`参数来取消该设定并让分页器自己处理制表符。
|
|
||||||
|
|
||||||
### 暗色模式
|
|
||||||
|
|
||||||
如果你用的 macOS 处于暗色模式,你可以为`bat`启用基于系统主题的主题。如下所示操作会让`bat`在系统处于亮色模式时加载`GitHub`主题和暗色模式时加载`default`主题。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
|
||||||
```
|
|
||||||
|
|
||||||
## 配置文件
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat --config-file
|
|
||||||
```
|
|
||||||
|
|
||||||
你也可以用`BAT_CONFIG_PATH`来为`bat`指定自定义位置的配置文件:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
|
||||||
```
|
|
||||||
|
|
||||||
使用`--generate-config-file`参数调用`bat`会在指定位置生成一份默认的`bat`配置文件:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat --generate-config-file
|
|
||||||
```
|
|
||||||
|
|
||||||
### 格式
|
|
||||||
|
|
||||||
配置文件其实是一份按行分割的命令行参数列表。你可以用`bat --help`来查看所有可用的参数和适用的值。配置文件中`#`打头的行会被视为注释而不生效。
|
|
||||||
|
|
||||||
以下是一份示例:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 设置主题为 TwoDark
|
|
||||||
--theme="TwoDark"
|
|
||||||
|
|
||||||
# 显示行号和 Git 修改信息, 但没有边框
|
|
||||||
--style="numbers,changes,header"
|
|
||||||
|
|
||||||
# 在终端中以斜体输出文本(不是所有终端都支持)
|
|
||||||
--italic-text=always
|
|
||||||
|
|
||||||
# 使用 C++ 语法来给 Ardiuno 的 .ino 文件提供高亮
|
|
||||||
--map-syntax "*.ino:C++"
|
|
||||||
```
|
|
||||||
|
|
||||||
## 在 Windows 中使用 `bat`
|
|
||||||
|
|
||||||
`bat` 在 Windows 上开箱即用,除了部分功能需要额外配置。
|
|
||||||
|
|
||||||
### 前置条件
|
|
||||||
|
|
||||||
你需要先安装 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
|
|
||||||
|
|
||||||
### 分页
|
|
||||||
|
|
||||||
Windows 只有一个提供有限功能的分页器,你可以从[这里下载](http://www.greenwoodsoftware.com/less/download.html)或用 [Chocolatey 安装](https://chocolatey.org/packages/Less) Windows 版本的`less`。第一种方法需要你把它所在目录加入`PATH`环境变量或[定义分页器变量](#使用自定义分页器)
|
|
||||||
|
|
||||||
### 色彩
|
|
||||||
|
|
||||||
Windows 10 从 [v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update)) 开始 shell(`conhost.exe`,命令提示符或 Powershell)原生支持色彩。在早些版本的 Windows 中你可以用第三方终端如 [Cmder](http://cmder.net/) (使用[ConEmu](https://conemu.github.io/))。
|
|
||||||
|
|
||||||
注意:Git 和 MSYS 版本的 `less` 没法正确在 Windows 表达色彩。如果你没有安装其他分页器,你可以直接用`--paging=never`或设置`BAT_PAGER`为空字符串来关闭分页功能。
|
|
||||||
|
|
||||||
### Cygwin
|
|
||||||
|
|
||||||
Windows 上的`bat`原生不支持 Cygwin' unix-style 路径(`/cygdrive/*`)。当传递一个绝对 cygwin 路径作为参数值时,`bat`会产生`The system cannot find the path specified. (os error 3)`的错误。你可以`.bash_profile`文件中添加以下函数来解决这个问题。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bat() {
|
|
||||||
local index
|
|
||||||
local args=("$@")
|
|
||||||
for index in $(seq 0 ${#args[@]}) ; do
|
|
||||||
case "${args[index]}" in
|
|
||||||
-*) continue;;
|
|
||||||
*) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
command bat "${args[@]}"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 疑难解答
|
|
||||||
|
|
||||||
### 输出内容含糊不清
|
|
||||||
|
|
||||||
当输入文件包含颜色代码和其他 ANSI 转义符号时,`bat`会产生错误的语法高亮和文本,导致输出看起来令人无法理解。当你需要输出该文件时,请使用`--color=never --wrap=never`参数来关闭上色和文字包裹。
|
|
||||||
|
|
||||||
### 终端与色彩
|
|
||||||
|
|
||||||
`bat`会区分支持 truecolor 和不支持 truecolor 的终端。但是大部分语法高亮主题都是用了没有为 8-bit 色彩支持的颜色,因此强烈推荐使用一个支持 24-bit 色彩的终端(`terminator`,`konsole`,`iTerm2`...),或使用一个 [8-bit 主题](#8-bit-主题)来限制一些颜色。查看[这篇文章使用自定义分页器](https://gist.github.com/XVilka/8346728)了解更多支持 truecolor 的终端。你需要定义`COLORTERM`变量为`truecolor`或`24bit`来确保`bat`能够识别终端的对颜色的支持,否则会使用 8 bit 模式。
|
|
||||||
|
|
||||||
### 行号和边框很难看清
|
|
||||||
|
|
||||||
试试其他主题,说不定能有所改善(用`bat --list-themes`查看主题列表)。
|
|
||||||
|
|
||||||
### 文件编码
|
|
||||||
|
|
||||||
`bat`原生支持 UTF-8 和 UTF-16。至于其他文件你可能需要在使用`bat`之前先把编码转换到UTF-8。
|
|
||||||
|
|
||||||
这里展示了使用`iconv`来把 Latin-1(ISO-8859-1) 编码的 PHP 文件转换到 UTF-8:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
|
||||||
```
|
|
||||||
|
|
||||||
注意: 当`bat`无法识别语言时你可能会需要`-l`/`--language`参数。
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Recursive clone to retrieve all submodules
|
|
||||||
git clone --recursive https://github.com/sharkdp/bat
|
|
||||||
|
|
||||||
# Build (debug version)
|
|
||||||
cd bat
|
|
||||||
cargo build --bins
|
|
||||||
|
|
||||||
# Run unit tests and integration tests
|
|
||||||
cargo test
|
|
||||||
|
|
||||||
# Install (release version)
|
|
||||||
cargo install --path . --locked
|
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
|
||||||
bash assets/create.sh
|
|
||||||
cargo install --path . --locked --force
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to build an application that uses `bat`s pretty-printing
|
|
||||||
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
|
||||||
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
|
||||||
when you depend on `bat` as a library.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
|
||||||
|
|
||||||
## Maintainers
|
|
||||||
|
|
||||||
- [sharkdp](https://github.com/sharkdp)
|
|
||||||
- [eth-p](https://github.com/eth-p)
|
|
||||||
- [keith-hall](https://github.com/keith-hall)
|
|
||||||
- [Enselic](https://github.com/Enselic)
|
|
||||||
|
|
||||||
## Security vulnerabilities
|
|
||||||
|
|
||||||
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
|
||||||
|
|
||||||
## Project goals and alternatives
|
|
||||||
|
|
||||||
`bat` tries to achieve the following goals:
|
|
||||||
|
|
||||||
- Provide beautiful, advanced syntax highlighting
|
|
||||||
- Integrate with Git to show file modifications
|
|
||||||
- Be a drop-in replacement for (POSIX) `cat`
|
|
||||||
- Offer a user-friendly command-line interface
|
|
||||||
|
|
||||||
There are a lot of alternatives, if you are looking for similar programs. See
|
|
||||||
[this document](doc/alternatives.md) for a comparison.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
|
||||||
|
|
||||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
|
||||||
|
|
||||||
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
|
||||||
@@ -22,42 +22,3 @@ request.
|
|||||||
Some other alternatives that are also related, but not yet included in the table:
|
Some other alternatives that are also related, but not yet included in the table:
|
||||||
- [lesspipe](https://github.com/wofr06/lesspipe)
|
- [lesspipe](https://github.com/wofr06/lesspipe)
|
||||||
- [vimpager](https://github.com/rkitover/vimpager)
|
- [vimpager](https://github.com/rkitover/vimpager)
|
||||||
|
|
||||||
## Benchmarks
|
|
||||||
|
|
||||||
The benchmarks above have been created with this script:
|
|
||||||
```bash
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
|
||||||
|
|
||||||
if ! command -v hyperfine > /dev/null 2>&1; then
|
|
||||||
echo "'hyperfine' does not seem to be installed."
|
|
||||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
SRC="test-src/jquery-3.3.1.js"
|
|
||||||
|
|
||||||
|
|
||||||
cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
|
|
||||||
cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
|
|
||||||
cmd_pygmentize="pygmentize -g '$SRC'"
|
|
||||||
cmd_highlight="highlight -O truecolor '$SRC'"
|
|
||||||
cmd_ccat="ccat --color=always '$SRC'"
|
|
||||||
cmd_source_highlight="source-highlight --failsafe --infer-lang -f esc -i '$SRC'"
|
|
||||||
cmd_hicat="hicat '$SRC'"
|
|
||||||
cmd_coderay="coderay '$SRC'"
|
|
||||||
cmd_rouge="rougify '$SRC'"
|
|
||||||
|
|
||||||
hyperfine --warmup 3 \
|
|
||||||
"$cmd_bat" \
|
|
||||||
"$cmd_bat_simple" \
|
|
||||||
"$cmd_pygmentize" \
|
|
||||||
"$cmd_highlight" \
|
|
||||||
"$cmd_ccat" \
|
|
||||||
"$cmd_source_highlight" \
|
|
||||||
"$cmd_hicat" \
|
|
||||||
"$cmd_coderay" \
|
|
||||||
"$cmd_rouge" \
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
|
|||||||
|
|
||||||
- [ ] Optional: update dependencies with `cargo update`. This is also done by
|
- [ ] Optional: update dependencies with `cargo update`. This is also done by
|
||||||
dependabot, so it is not strictly necessary.
|
dependabot, so it is not strictly necessary.
|
||||||
- [ ] Install [cargo-outdated](https://crates.io/crates/cargo-outdated). Check
|
- [ ] Check for outdated dependencies (`cargo outdated`) and decide for each of
|
||||||
for outdated dependencies with `cargo outdated --root-deps-only` and
|
them whether we want to (manually) upgrade. This will require changes to
|
||||||
decide for each of them whether we want to (manually) upgrade. This will
|
`Cargo.toml`.
|
||||||
require changes to `Cargo.toml`.
|
|
||||||
|
|
||||||
## Version bump
|
## Version bump
|
||||||
|
|
||||||
@@ -18,9 +17,9 @@ See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
|
|||||||
- [ ] Find the current min. supported Rust version by running
|
- [ ] Find the current min. supported Rust version by running
|
||||||
`grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
|
`grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
|
||||||
- [ ] Update the version and the min. supported Rust version in `README.md` and
|
- [ ] Update the version and the min. supported Rust version in `README.md` and
|
||||||
`doc/README-*.md`. Check with `git grep -i 'rust.*1\.'` and
|
`doc/README-*.md`.
|
||||||
`git grep -i '1\..*rust'`.
|
- [ ] Update `CHANGELOG.md`. Introduce a section for the new release and
|
||||||
- [ ] Update `CHANGELOG.md`. Introduce a section for the new release.
|
prepare a new (empty) "unreleased" section at the top.
|
||||||
|
|
||||||
## Update syntaxes and themes (build assets)
|
## Update syntaxes and themes (build assets)
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
|
|||||||
- [ ] Push all changes and wait for CI to succeed (before continuing with the
|
- [ ] Push all changes and wait for CI to succeed (before continuing with the
|
||||||
next section).
|
next section).
|
||||||
- [ ] Optional: manually test the new features and command-line options. To do
|
- [ ] Optional: manually test the new features and command-line options. To do
|
||||||
this, install the latest `bat` version again (to include the new syntaxes
|
this, install the latest `bat` version again (to include the new synaxes
|
||||||
and themes).
|
and themes).
|
||||||
- [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
|
- [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
|
||||||
succeed later (after creating the GitHub release).
|
succeed later (after creating the GitHub release).
|
||||||
@@ -57,7 +56,3 @@ See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
|
|||||||
appear when the CI run for the Git tag has finished).
|
appear when the CI run for the Git tag has finished).
|
||||||
- [ ] Publish to crates.io by running `cargo publish` in a *clean* repository.
|
- [ ] Publish to crates.io by running `cargo publish` in a *clean* repository.
|
||||||
The safest way to do this is to clone a fresh copy.
|
The safest way to do this is to clone a fresh copy.
|
||||||
|
|
||||||
## Post-release
|
|
||||||
|
|
||||||
- [ ] Prepare a new (empty) "unreleased" section at the top of `CHANGELOG.md`.
|
|
||||||
|
|||||||
204
src/assets.rs
204
src/assets.rs
@@ -2,21 +2,20 @@ use std::ffi::OsStr;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use once_cell::unsync::OnceCell;
|
use lazycell::LazyCell;
|
||||||
|
|
||||||
use syntect::highlighting::Theme;
|
use syntect::highlighting::{Theme, ThemeSet};
|
||||||
use syntect::parsing::{SyntaxReference, SyntaxSet};
|
use syntect::parsing::{SyntaxReference, SyntaxSet};
|
||||||
|
|
||||||
use path_abs::PathAbs;
|
use path_abs::PathAbs;
|
||||||
|
|
||||||
|
use crate::bat_warning;
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
use crate::input::{InputReader, OpenedInput};
|
use crate::input::{InputReader, OpenedInput};
|
||||||
use crate::syntax_mapping::ignored_suffixes::IgnoredSuffixes;
|
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||||
use crate::syntax_mapping::MappingTarget;
|
|
||||||
use crate::{bat_warning, SyntaxMapping};
|
|
||||||
|
|
||||||
use lazy_theme_set::LazyThemeSet;
|
|
||||||
|
|
||||||
|
use ignored_suffixes::*;
|
||||||
|
use minimal_assets::*;
|
||||||
use serialized_syntax_set::*;
|
use serialized_syntax_set::*;
|
||||||
|
|
||||||
#[cfg(feature = "build-assets")]
|
#[cfg(feature = "build-assets")]
|
||||||
@@ -25,15 +24,18 @@ pub use crate::assets::build_assets::*;
|
|||||||
pub(crate) mod assets_metadata;
|
pub(crate) mod assets_metadata;
|
||||||
#[cfg(feature = "build-assets")]
|
#[cfg(feature = "build-assets")]
|
||||||
mod build_assets;
|
mod build_assets;
|
||||||
mod lazy_theme_set;
|
mod ignored_suffixes;
|
||||||
|
mod minimal_assets;
|
||||||
mod serialized_syntax_set;
|
mod serialized_syntax_set;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct HighlightingAssets {
|
pub struct HighlightingAssets {
|
||||||
syntax_set_cell: OnceCell<SyntaxSet>,
|
syntax_set_cell: LazyCell<SyntaxSet>,
|
||||||
serialized_syntax_set: SerializedSyntaxSet,
|
serialized_syntax_set: SerializedSyntaxSet,
|
||||||
|
|
||||||
theme_set: LazyThemeSet,
|
minimal_assets: MinimalAssets,
|
||||||
|
|
||||||
|
theme_set: ThemeSet,
|
||||||
fallback_theme: Option<&'static str>,
|
fallback_theme: Option<&'static str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,23 +48,30 @@ pub struct SyntaxReferenceInSet<'a> {
|
|||||||
/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
|
/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
|
||||||
pub(crate) const COMPRESS_SYNTAXES: bool = true;
|
pub(crate) const COMPRESS_SYNTAXES: bool = true;
|
||||||
|
|
||||||
/// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes
|
/// Compress for size of ~20 kB instead of ~200 kB at the cost of ~30% longer deserialization time
|
||||||
/// within it are already compressed, and compressing another time just makes
|
pub(crate) const COMPRESS_THEMES: bool = true;
|
||||||
/// performance suffer
|
|
||||||
pub(crate) const COMPRESS_THEMES: bool = false;
|
|
||||||
|
|
||||||
/// Compress for size of ~40 kB instead of ~200 kB without much difference in
|
/// Compress for size of ~400 kB instead of ~2100 kB at the cost of ~30% longer deserialization time
|
||||||
/// performance due to lazy-loading
|
pub(crate) const COMPRESS_SERIALIZED_MINIMAL_SYNTAXES: bool = true;
|
||||||
pub(crate) const COMPRESS_LAZY_THEMES: bool = true;
|
|
||||||
|
|
||||||
/// Compress for size of ~10 kB instead of ~120 kB
|
/// Whether or not to compress the serialized form of [MinimalSyntaxes]. Shall
|
||||||
pub(crate) const COMPRESS_ACKNOWLEDGEMENTS: bool = true;
|
/// always be `false`, because the data in
|
||||||
|
/// [MinimalSyntaxes.serialized_syntax_sets] has already been compressed
|
||||||
|
/// (assuming [COMPRESS_SERIALIZED_MINIMAL_SYNTAXES] is `true`). The "outer" data
|
||||||
|
/// structures like `by_name` are tiny. If we compress, deserialization can't do
|
||||||
|
/// efficient byte-by-byte copy of `serialized_syntax_sets`.
|
||||||
|
pub(crate) const COMPRESS_MINIMAL_SYNTAXES: bool = false;
|
||||||
|
|
||||||
impl HighlightingAssets {
|
impl HighlightingAssets {
|
||||||
fn new(serialized_syntax_set: SerializedSyntaxSet, theme_set: LazyThemeSet) -> Self {
|
fn new(
|
||||||
|
serialized_syntax_set: SerializedSyntaxSet,
|
||||||
|
minimal_syntaxes: MinimalSyntaxes,
|
||||||
|
theme_set: ThemeSet,
|
||||||
|
) -> Self {
|
||||||
HighlightingAssets {
|
HighlightingAssets {
|
||||||
syntax_set_cell: OnceCell::new(),
|
syntax_set_cell: LazyCell::new(),
|
||||||
serialized_syntax_set,
|
serialized_syntax_set,
|
||||||
|
minimal_assets: MinimalAssets::new(minimal_syntaxes),
|
||||||
theme_set,
|
theme_set,
|
||||||
fallback_theme: None,
|
fallback_theme: None,
|
||||||
}
|
}
|
||||||
@@ -75,6 +84,11 @@ impl HighlightingAssets {
|
|||||||
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
||||||
Ok(HighlightingAssets::new(
|
Ok(HighlightingAssets::new(
|
||||||
SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
|
SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
|
||||||
|
asset_from_cache(
|
||||||
|
&cache_path.join("minimal_syntaxes.bin"),
|
||||||
|
"minimal syntax sets",
|
||||||
|
COMPRESS_MINIMAL_SYNTAXES,
|
||||||
|
)?,
|
||||||
asset_from_cache(&cache_path.join("themes.bin"), "theme set", COMPRESS_THEMES)?,
|
asset_from_cache(&cache_path.join("themes.bin"), "theme set", COMPRESS_THEMES)?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -82,6 +96,7 @@ impl HighlightingAssets {
|
|||||||
pub fn from_binary() -> Self {
|
pub fn from_binary() -> Self {
|
||||||
HighlightingAssets::new(
|
HighlightingAssets::new(
|
||||||
SerializedSyntaxSet::FromBinary(get_serialized_integrated_syntaxset()),
|
SerializedSyntaxSet::FromBinary(get_serialized_integrated_syntaxset()),
|
||||||
|
get_integrated_minimal_syntaxes(),
|
||||||
get_integrated_themeset(),
|
get_integrated_themeset(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -90,9 +105,9 @@ impl HighlightingAssets {
|
|||||||
self.fallback_theme = Some(theme);
|
self.fallback_theme = Some(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_syntax_set(&self) -> Result<&SyntaxSet> {
|
pub(crate) fn get_syntax_set(&self) -> Result<&SyntaxSet> {
|
||||||
self.syntax_set_cell
|
self.syntax_set_cell
|
||||||
.get_or_try_init(|| self.serialized_syntax_set.deserialize())
|
.try_borrow_with(|| self.serialized_syntax_set.deserialize())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use [Self::get_syntaxes] instead
|
/// Use [Self::get_syntaxes] instead
|
||||||
@@ -107,12 +122,22 @@ impl HighlightingAssets {
|
|||||||
Ok(self.get_syntax_set()?.syntaxes())
|
Ok(self.get_syntax_set()?.syntaxes())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_theme_set(&self) -> &LazyThemeSet {
|
fn get_theme_set(&self) -> &ThemeSet {
|
||||||
&self.theme_set
|
&self.theme_set
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||||
self.get_theme_set().themes()
|
self.get_theme_set().themes.keys().map(|s| s.as_ref())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Finds a [SyntaxSet] that contains a [SyntaxReference] by its name. First
|
||||||
|
/// tries to find a minimal [SyntaxSet]. If none is found, returns the
|
||||||
|
/// [SyntaxSet] that contains all syntaxes.
|
||||||
|
fn get_syntax_set_by_name(&self, name: &str) -> Result<&SyntaxSet> {
|
||||||
|
match self.minimal_assets.get_syntax_set_by_name(name) {
|
||||||
|
Some(syntax_set) => Ok(syntax_set),
|
||||||
|
None => self.get_syntax_set(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use [Self::get_syntax_for_path] instead
|
/// Use [Self::get_syntax_for_path] instead
|
||||||
@@ -128,12 +153,9 @@ impl HighlightingAssets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Detect the syntax based on, in order:
|
/// Detect the syntax based on, in order:
|
||||||
/// 1. Syntax mappings with [MappingTarget::MapTo] and [MappingTarget::MapToUnknown]
|
/// 1. Syntax mappings (e.g. `/etc/profile` -> `Bourne Again Shell (bash)`)
|
||||||
/// (e.g. `/etc/profile` -> `Bourne Again Shell (bash)`)
|
|
||||||
/// 2. The file name (e.g. `Dockerfile`)
|
/// 2. The file name (e.g. `Dockerfile`)
|
||||||
/// 3. Syntax mappings with [MappingTarget::MapExtensionToUnknown]
|
/// 3. The file name extension (e.g. `.rs`)
|
||||||
/// (e.g. `*.conf`)
|
|
||||||
/// 4. The file name extension (e.g. `.rs`)
|
|
||||||
///
|
///
|
||||||
/// When detecting syntax based on syntax mappings, the full path is taken
|
/// When detecting syntax based on syntax mappings, the full path is taken
|
||||||
/// into account. When detecting syntax based on file name, no regard is
|
/// into account. When detecting syntax based on file name, no regard is
|
||||||
@@ -143,9 +165,9 @@ impl HighlightingAssets {
|
|||||||
///
|
///
|
||||||
/// Returns [Error::UndetectedSyntax] if it was not possible detect syntax
|
/// Returns [Error::UndetectedSyntax] if it was not possible detect syntax
|
||||||
/// based on path/file name/extension (or if the path was mapped to
|
/// based on path/file name/extension (or if the path was mapped to
|
||||||
/// [MappingTarget::MapToUnknown] or [MappingTarget::MapExtensionToUnknown]).
|
/// [MappingTarget::MapToUnknown]). In this case it is appropriate to fall
|
||||||
/// In this case it is appropriate to fall back to other methods to detect
|
/// back to other methods to detect syntax. Such as using the contents of
|
||||||
/// syntax. Such as using the contents of the first line of the file.
|
/// the first line of the file.
|
||||||
///
|
///
|
||||||
/// Returns [Error::UnknownSyntax] if a syntax mapping exist, but the mapped
|
/// Returns [Error::UnknownSyntax] if a syntax mapping exist, but the mapped
|
||||||
/// syntax does not exist.
|
/// syntax does not exist.
|
||||||
@@ -155,39 +177,25 @@ impl HighlightingAssets {
|
|||||||
mapping: &SyntaxMapping,
|
mapping: &SyntaxMapping,
|
||||||
) -> Result<SyntaxReferenceInSet> {
|
) -> Result<SyntaxReferenceInSet> {
|
||||||
let path = path.as_ref();
|
let path = path.as_ref();
|
||||||
|
match mapping.get_syntax_for(path) {
|
||||||
let syntax_match = mapping.get_syntax_for(path);
|
Some(MappingTarget::MapToUnknown) => {
|
||||||
|
|
||||||
if let Some(MappingTarget::MapToUnknown) = syntax_match {
|
|
||||||
return Err(Error::UndetectedSyntax(path.to_string_lossy().into()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(MappingTarget::MapTo(syntax_name)) = syntax_match {
|
|
||||||
return self
|
|
||||||
.find_syntax_by_name(syntax_name)?
|
|
||||||
.ok_or_else(|| Error::UnknownSyntax(syntax_name.to_owned()));
|
|
||||||
}
|
|
||||||
|
|
||||||
let file_name = path.file_name().unwrap_or_default();
|
|
||||||
|
|
||||||
match (
|
|
||||||
self.get_syntax_for_file_name(file_name, &mapping.ignored_suffixes)?,
|
|
||||||
syntax_match,
|
|
||||||
) {
|
|
||||||
(Some(syntax), _) => Ok(syntax),
|
|
||||||
|
|
||||||
(_, Some(MappingTarget::MapExtensionToUnknown)) => {
|
|
||||||
Err(Error::UndetectedSyntax(path.to_string_lossy().into()))
|
Err(Error::UndetectedSyntax(path.to_string_lossy().into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => self
|
Some(MappingTarget::MapTo(syntax_name)) => self
|
||||||
.get_syntax_for_file_extension(file_name, &mapping.ignored_suffixes)?
|
.find_syntax_by_name(syntax_name)?
|
||||||
.ok_or_else(|| Error::UndetectedSyntax(path.to_string_lossy().into())),
|
.ok_or_else(|| Error::UnknownSyntax(syntax_name.to_owned())),
|
||||||
|
|
||||||
|
None => {
|
||||||
|
let file_name = path.file_name().unwrap_or_default();
|
||||||
|
self.get_extension_syntax(file_name)?
|
||||||
|
.ok_or_else(|| Error::UndetectedSyntax(path.to_string_lossy().into()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
||||||
match self.get_theme_set().get(theme) {
|
match self.get_theme_set().themes.get(theme) {
|
||||||
Some(theme) => theme,
|
Some(theme) => theme,
|
||||||
None => {
|
None => {
|
||||||
if theme == "ansi-light" || theme == "ansi-dark" {
|
if theme == "ansi-light" || theme == "ansi-dark" {
|
||||||
@@ -197,9 +205,8 @@ impl HighlightingAssets {
|
|||||||
if !theme.is_empty() {
|
if !theme.is_empty() {
|
||||||
bat_warning!("Unknown theme '{}', using default.", theme)
|
bat_warning!("Unknown theme '{}', using default.", theme)
|
||||||
}
|
}
|
||||||
self.get_theme_set()
|
&self.get_theme_set().themes
|
||||||
.get(self.fallback_theme.unwrap_or_else(Self::default_theme))
|
[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||||
.expect("something is very wrong if the default theme is missing")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,7 +218,7 @@ impl HighlightingAssets {
|
|||||||
mapping: &SyntaxMapping,
|
mapping: &SyntaxMapping,
|
||||||
) -> Result<SyntaxReferenceInSet> {
|
) -> Result<SyntaxReferenceInSet> {
|
||||||
if let Some(language) = language {
|
if let Some(language) = language {
|
||||||
let syntax_set = self.get_syntax_set()?;
|
let syntax_set = self.get_syntax_set_by_name(language)?;
|
||||||
return syntax_set
|
return syntax_set
|
||||||
.find_syntax_by_token(language)
|
.find_syntax_by_token(language)
|
||||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set })
|
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set })
|
||||||
@@ -256,33 +263,14 @@ impl HighlightingAssets {
|
|||||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_syntax_for_file_name(
|
fn get_extension_syntax(&self, file_name: &OsStr) -> Result<Option<SyntaxReferenceInSet>> {
|
||||||
&self,
|
|
||||||
file_name: &OsStr,
|
|
||||||
ignored_suffixes: &IgnoredSuffixes,
|
|
||||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
|
||||||
let mut syntax = self.find_syntax_by_extension(Some(file_name))?;
|
let mut syntax = self.find_syntax_by_extension(Some(file_name))?;
|
||||||
if syntax.is_none() {
|
if syntax.is_none() {
|
||||||
syntax =
|
syntax = self.find_syntax_by_extension(Path::new(file_name).extension())?;
|
||||||
ignored_suffixes.try_with_stripped_suffix(file_name, |stripped_file_name| {
|
|
||||||
// Note: recursion
|
|
||||||
self.get_syntax_for_file_name(stripped_file_name, ignored_suffixes)
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
Ok(syntax)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_syntax_for_file_extension(
|
|
||||||
&self,
|
|
||||||
file_name: &OsStr,
|
|
||||||
ignored_suffixes: &IgnoredSuffixes,
|
|
||||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
|
||||||
let mut syntax = self.find_syntax_by_extension(Path::new(file_name).extension())?;
|
|
||||||
if syntax.is_none() {
|
if syntax.is_none() {
|
||||||
syntax =
|
syntax = try_with_stripped_suffix(file_name, |stripped_file_name| {
|
||||||
ignored_suffixes.try_with_stripped_suffix(file_name, |stripped_file_name| {
|
self.get_extension_syntax(stripped_file_name) // Note: recursion
|
||||||
// Note: recursion
|
|
||||||
self.get_syntax_for_file_extension(stripped_file_name, ignored_suffixes)
|
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
Ok(syntax)
|
Ok(syntax)
|
||||||
@@ -304,14 +292,14 @@ pub(crate) fn get_serialized_integrated_syntaxset() -> &'static [u8] {
|
|||||||
include_bytes!("../assets/syntaxes.bin")
|
include_bytes!("../assets/syntaxes.bin")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_integrated_themeset() -> LazyThemeSet {
|
pub(crate) fn get_integrated_themeset() -> ThemeSet {
|
||||||
from_binary(include_bytes!("../assets/themes.bin"), COMPRESS_THEMES)
|
from_binary(include_bytes!("../assets/themes.bin"), COMPRESS_THEMES)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_acknowledgements() -> String {
|
fn get_integrated_minimal_syntaxes() -> MinimalSyntaxes {
|
||||||
from_binary(
|
from_binary(
|
||||||
include_bytes!("../assets/acknowledgements.bin"),
|
include_bytes!("../assets/minimal_syntaxes.bin"),
|
||||||
COMPRESS_ACKNOWLEDGEMENTS,
|
COMPRESS_MINIMAL_SYNTAXES,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,42 +530,6 @@ mod tests {
|
|||||||
assert_eq!(test.syntax_for_file("test.h"), "C");
|
assert_eq!(test.syntax_for_file("test.h"), "C");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn syntax_detection_with_extension_mapping_to_unknown() {
|
|
||||||
let mut test = SyntaxDetectionTest::new();
|
|
||||||
|
|
||||||
// Normally, a CMakeLists.txt file shall use the CMake syntax, even if it is
|
|
||||||
// a bash script in disguise
|
|
||||||
assert_eq!(
|
|
||||||
test.syntax_for_file_with_content("CMakeLists.txt", "#!/bin/bash"),
|
|
||||||
"CMake"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Other .txt files shall use the Plain Text syntax
|
|
||||||
assert_eq!(
|
|
||||||
test.syntax_for_file_with_content("some-other.txt", "#!/bin/bash"),
|
|
||||||
"Plain Text"
|
|
||||||
);
|
|
||||||
|
|
||||||
// If we setup MapExtensionToUnknown on *.txt, the match on the full
|
|
||||||
// file name of "CMakeLists.txt" shall have higher prio, and CMake shall
|
|
||||||
// still be used for it
|
|
||||||
test.syntax_mapping
|
|
||||||
.insert("*.txt", MappingTarget::MapExtensionToUnknown)
|
|
||||||
.ok();
|
|
||||||
assert_eq!(
|
|
||||||
test.syntax_for_file_with_content("CMakeLists.txt", "#!/bin/bash"),
|
|
||||||
"CMake"
|
|
||||||
);
|
|
||||||
|
|
||||||
// However, for *other* files with a .txt extension, first-line fallback
|
|
||||||
// shall now be used
|
|
||||||
assert_eq!(
|
|
||||||
test.syntax_for_file_with_content("some-other.txt", "#!/bin/bash"),
|
|
||||||
"Bourne Again Shell (bash)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn syntax_detection_is_case_sensitive() {
|
fn syntax_detection_is_case_sensitive() {
|
||||||
let mut test = SyntaxDetectionTest::new();
|
let mut test = SyntaxDetectionTest::new();
|
||||||
|
|||||||
@@ -1,43 +1,64 @@
|
|||||||
use std::convert::TryInto;
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use syntect::highlighting::ThemeSet;
|
use syntect::highlighting::ThemeSet;
|
||||||
use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
|
use syntect::parsing::syntax_definition::{
|
||||||
|
ContextReference, MatchOperation, MatchPattern, Pattern, SyntaxDefinition,
|
||||||
|
};
|
||||||
|
use syntect::parsing::{Scope, SyntaxSet, SyntaxSetBuilder};
|
||||||
|
|
||||||
use crate::assets::*;
|
use crate::assets::*;
|
||||||
use acknowledgements::build_acknowledgements;
|
|
||||||
|
|
||||||
mod acknowledgements;
|
mod graphviz_utils;
|
||||||
|
|
||||||
|
type SyntaxName = String;
|
||||||
|
|
||||||
|
/// Used to look up which [SyntaxDefinition] corresponds to a given [OtherSyntax]
|
||||||
|
type OtherSyntaxLookup<'a> = HashMap<OtherSyntax, &'a SyntaxDefinition>;
|
||||||
|
|
||||||
|
/// Used to look up what dependencies a given [SyntaxDefinition] has
|
||||||
|
type SyntaxToDependencies = HashMap<SyntaxName, Vec<OtherSyntax>>;
|
||||||
|
|
||||||
|
/// Used to look up what other [SyntaxDefinition]s depend on a given [SyntaxDefinition]
|
||||||
|
type SyntaxToDependents<'a> = HashMap<SyntaxName, Vec<OtherSyntax>>;
|
||||||
|
|
||||||
|
/// Represents some other `*.sublime-syntax` file, i.e. another [SyntaxDefinition].
|
||||||
|
#[derive(Debug, Eq, PartialEq, PartialOrd, Ord, Clone, Hash)]
|
||||||
|
pub(crate) enum OtherSyntax {
|
||||||
|
/// By name. Example YAML: `include: C.sublime-syntax` (name is `"C"`)
|
||||||
|
ByName(String),
|
||||||
|
|
||||||
|
/// By scope. Example YAML: `embed: scope:source.c` (scope is `"source.c"`)
|
||||||
|
ByScope(Scope),
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(
|
pub fn build(
|
||||||
source_dir: &Path,
|
source_dir: &Path,
|
||||||
include_integrated_assets: bool,
|
include_integrated_assets: bool,
|
||||||
include_acknowledgements: bool,
|
|
||||||
target_dir: &Path,
|
target_dir: &Path,
|
||||||
current_version: &str,
|
current_version: &str,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let theme_set = build_theme_set(source_dir, include_integrated_assets)?;
|
let theme_set = build_theme_set(source_dir, include_integrated_assets);
|
||||||
|
|
||||||
let syntax_set_builder = build_syntax_set_builder(source_dir, include_integrated_assets)?;
|
let syntax_set_builder = build_syntax_set_builder(source_dir, include_integrated_assets)?;
|
||||||
|
|
||||||
let syntax_set = syntax_set_builder.build();
|
let minimal_syntaxes = build_minimal_syntaxes(&syntax_set_builder, include_integrated_assets)?;
|
||||||
|
|
||||||
let acknowledgements = build_acknowledgements(source_dir, include_acknowledgements)?;
|
let syntax_set = syntax_set_builder.build();
|
||||||
|
|
||||||
print_unlinked_contexts(&syntax_set);
|
print_unlinked_contexts(&syntax_set);
|
||||||
|
|
||||||
write_assets(
|
write_assets(
|
||||||
&theme_set,
|
&theme_set,
|
||||||
&syntax_set,
|
&syntax_set,
|
||||||
&acknowledgements,
|
&minimal_syntaxes,
|
||||||
target_dir,
|
target_dir,
|
||||||
current_version,
|
current_version,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> Result<LazyThemeSet> {
|
fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> ThemeSet {
|
||||||
let mut theme_set = if include_integrated_assets {
|
let mut theme_set = if include_integrated_assets {
|
||||||
crate::assets::get_integrated_themeset().try_into()?
|
crate::assets::get_integrated_themeset()
|
||||||
} else {
|
} else {
|
||||||
ThemeSet::new()
|
ThemeSet::new()
|
||||||
};
|
};
|
||||||
@@ -59,7 +80,7 @@ fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> Result
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
theme_set.try_into()
|
theme_set
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_syntax_set_builder(
|
fn build_syntax_set_builder(
|
||||||
@@ -99,9 +120,9 @@ fn print_unlinked_contexts(syntax_set: &SyntaxSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn write_assets(
|
fn write_assets(
|
||||||
theme_set: &LazyThemeSet,
|
theme_set: &ThemeSet,
|
||||||
syntax_set: &SyntaxSet,
|
syntax_set: &SyntaxSet,
|
||||||
acknowledgements: &Option<String>,
|
minimal_syntaxes: &MinimalSyntaxes,
|
||||||
target_dir: &Path,
|
target_dir: &Path,
|
||||||
current_version: &str,
|
current_version: &str,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
@@ -118,15 +139,12 @@ fn write_assets(
|
|||||||
"syntax set",
|
"syntax set",
|
||||||
COMPRESS_SYNTAXES,
|
COMPRESS_SYNTAXES,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if let Some(acknowledgements) = acknowledgements {
|
|
||||||
asset_to_cache(
|
asset_to_cache(
|
||||||
acknowledgements,
|
minimal_syntaxes,
|
||||||
&target_dir.join("acknowledgements.bin"),
|
&target_dir.join("minimal_syntaxes.bin"),
|
||||||
"acknowledgements",
|
"minimal syntax sets",
|
||||||
COMPRESS_ACKNOWLEDGEMENTS,
|
COMPRESS_MINIMAL_SYNTAXES,
|
||||||
)?;
|
)?;
|
||||||
}
|
|
||||||
|
|
||||||
print!(
|
print!(
|
||||||
"Writing metadata to folder {} ... ",
|
"Writing metadata to folder {} ... ",
|
||||||
@@ -138,7 +156,300 @@ fn write_assets(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn asset_to_contents<T: serde::Serialize>(
|
fn print_syntax_set_names(syntax_set: &SyntaxSet) {
|
||||||
|
let names = syntax_set
|
||||||
|
.syntaxes()
|
||||||
|
.iter()
|
||||||
|
.map(|syntax| &syntax.name)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
println!("{:?}", names);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_minimal_syntaxes(
|
||||||
|
syntax_set_builder: &'_ SyntaxSetBuilder,
|
||||||
|
include_integrated_assets: bool,
|
||||||
|
) -> Result<MinimalSyntaxes> {
|
||||||
|
let mut minimal_syntaxes = MinimalSyntaxes {
|
||||||
|
by_name: HashMap::new(),
|
||||||
|
serialized_syntax_sets: vec![],
|
||||||
|
};
|
||||||
|
|
||||||
|
if include_integrated_assets {
|
||||||
|
// Dependency info is not present in integrated assets, so we can't
|
||||||
|
// calculate minimal syntax sets. Return early without any data filled
|
||||||
|
// in. This means that no minimal syntax sets will be available to use, and
|
||||||
|
// the full, slow-to-deserialize, fallback syntax set will be used instead.
|
||||||
|
return Ok(minimal_syntaxes);
|
||||||
|
}
|
||||||
|
|
||||||
|
let minimal_syntax_sets_to_serialize = build_minimal_syntax_sets(syntax_set_builder)
|
||||||
|
// For now, only store syntax sets with one syntax, otherwise
|
||||||
|
// the binary grows by several megs
|
||||||
|
.filter(|syntax_set| syntax_set.syntaxes().len() == 1);
|
||||||
|
|
||||||
|
for minimal_syntax_set in minimal_syntax_sets_to_serialize {
|
||||||
|
// Remember what index it is found at
|
||||||
|
let current_index = minimal_syntaxes.serialized_syntax_sets.len();
|
||||||
|
|
||||||
|
for syntax in minimal_syntax_set.syntaxes() {
|
||||||
|
minimal_syntaxes
|
||||||
|
.by_name
|
||||||
|
.insert(syntax.name.to_ascii_lowercase().clone(), current_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
let serialized_syntax_set = asset_to_contents(
|
||||||
|
&minimal_syntax_set,
|
||||||
|
&format!("failed to serialize minimal syntax set {}", current_index),
|
||||||
|
COMPRESS_SERIALIZED_MINIMAL_SYNTAXES,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
// Add last so that it ends up at `current_index`
|
||||||
|
minimal_syntaxes
|
||||||
|
.serialized_syntax_sets
|
||||||
|
.push(serialized_syntax_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(minimal_syntaxes)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Analyzes dependencies between syntaxes in a [SyntaxSetBuilder].
|
||||||
|
/// From that, it builds minimal [SyntaxSet]s.
|
||||||
|
fn build_minimal_syntax_sets(
|
||||||
|
syntax_set_builder: &'_ SyntaxSetBuilder,
|
||||||
|
) -> impl Iterator<Item = SyntaxSet> + '_ {
|
||||||
|
let syntaxes = syntax_set_builder.syntaxes();
|
||||||
|
|
||||||
|
// Build the data structures we need for dependency resolution
|
||||||
|
let (other_syntax_lookup, syntax_to_dependencies, syntax_to_dependents) =
|
||||||
|
generate_maps(syntaxes);
|
||||||
|
|
||||||
|
maybe_write_syntax_dependencies_to_graphviz_dot_file(
|
||||||
|
&other_syntax_lookup,
|
||||||
|
&syntax_to_dependencies,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create one minimal SyntaxSet from each (non-hidden) SyntaxDefinition
|
||||||
|
syntaxes.iter().filter_map(move |syntax| {
|
||||||
|
if syntax.hidden {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut builder = SyntaxSetDependencyBuilder::new();
|
||||||
|
builder.add_with_dependencies(
|
||||||
|
syntax,
|
||||||
|
&other_syntax_lookup,
|
||||||
|
&syntax_to_dependencies,
|
||||||
|
&syntax_to_dependents,
|
||||||
|
);
|
||||||
|
let syntax_set = builder.build();
|
||||||
|
|
||||||
|
if std::env::var("BAT_PRINT_SYNTAX_DEPENDENCIES").is_ok() {
|
||||||
|
// To trigger this code, run:
|
||||||
|
// BAT_PRINT_SYNTAX_DEPENDENCIES=1 cargo run -- cache --build --source assets --blank --target /tmp
|
||||||
|
print_syntax_set_names(&syntax_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(syntax_set)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// In order to analyze dependencies, we need three key pieces of data.
|
||||||
|
///
|
||||||
|
/// * When we have a [OtherSyntax], we need to know what [SyntaxDefinition]
|
||||||
|
/// that corresponds to
|
||||||
|
/// * When we have a [SyntaxDefinition], we need to know what dependencies it
|
||||||
|
/// has
|
||||||
|
/// * When we have a [SyntaxDefinition], we need to know what other syntaxes
|
||||||
|
/// depend on it
|
||||||
|
///
|
||||||
|
/// This functions generates that data for each syntax.
|
||||||
|
fn generate_maps(
|
||||||
|
syntaxes: &[SyntaxDefinition],
|
||||||
|
) -> (OtherSyntaxLookup, SyntaxToDependencies, SyntaxToDependents) {
|
||||||
|
let mut other_syntax_lookup = HashMap::new();
|
||||||
|
let mut syntax_to_dependencies = HashMap::new();
|
||||||
|
let mut syntax_to_dependents = HashMap::new();
|
||||||
|
|
||||||
|
for syntax in syntaxes {
|
||||||
|
other_syntax_lookup.insert(OtherSyntax::ByName(syntax.name.clone()), syntax);
|
||||||
|
other_syntax_lookup.insert(OtherSyntax::ByScope(syntax.scope), syntax);
|
||||||
|
}
|
||||||
|
|
||||||
|
for syntax in syntaxes {
|
||||||
|
let dependencies = dependencies_for_syntax(syntax);
|
||||||
|
|
||||||
|
for dependency in &dependencies {
|
||||||
|
if let Some(dependency) = other_syntax_lookup.get(dependency) {
|
||||||
|
syntax_to_dependents
|
||||||
|
.entry(dependency.name.clone())
|
||||||
|
.or_insert_with(Vec::new)
|
||||||
|
.push(OtherSyntax::ByName(syntax.name.clone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
syntax_to_dependencies.insert(syntax.name.clone(), dependencies);
|
||||||
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
other_syntax_lookup,
|
||||||
|
syntax_to_dependencies,
|
||||||
|
syntax_to_dependents,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets what external dependencies a given [SyntaxDefinition] has.
|
||||||
|
/// An external dependency is another `.sublime-syntax` file.
|
||||||
|
/// It does that by looking for variants of the following YAML patterns:
|
||||||
|
/// - `include: C.sublime-syntax`
|
||||||
|
/// - `embed: scope:source.c`
|
||||||
|
fn dependencies_for_syntax(syntax: &SyntaxDefinition) -> Vec<OtherSyntax> {
|
||||||
|
let mut dependencies: Vec<OtherSyntax> = syntax
|
||||||
|
.contexts
|
||||||
|
.values()
|
||||||
|
.flat_map(|context| &context.patterns)
|
||||||
|
.flat_map(dependencies_from_pattern)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
// No need to track a dependency more than once
|
||||||
|
dependencies.sort();
|
||||||
|
dependencies.dedup();
|
||||||
|
|
||||||
|
dependencies
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dependencies_from_pattern(pattern: &Pattern) -> Vec<OtherSyntax> {
|
||||||
|
match *pattern {
|
||||||
|
Pattern::Match(MatchPattern {
|
||||||
|
operation: MatchOperation::Push(ref context_references),
|
||||||
|
..
|
||||||
|
}) => context_references
|
||||||
|
.iter()
|
||||||
|
.map(dependency_from_context_reference)
|
||||||
|
.collect(),
|
||||||
|
Pattern::Include(ref context_reference) => {
|
||||||
|
vec![dependency_from_context_reference(context_reference)]
|
||||||
|
}
|
||||||
|
_ => vec![],
|
||||||
|
}
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// To generate a Graphviz dot file of syntax dependencies, do this:
|
||||||
|
/// ```bash
|
||||||
|
/// sudo apt install graphviz
|
||||||
|
/// BAT_SYNTAX_DEPENDENCIES_TO_GRAPHVIZ_DOT_FILE=/tmp/bat-syntax-dependencies.dot cargo run -- cache --build --source assets --blank --target /tmp
|
||||||
|
/// dot /tmp/bat-syntax-dependencies.dot -Tpng -o /tmp/bat-syntax-dependencies.png
|
||||||
|
/// open /tmp/bat-syntax-dependencies.png
|
||||||
|
/// ```
|
||||||
|
fn maybe_write_syntax_dependencies_to_graphviz_dot_file(
|
||||||
|
other_syntax_lookup: &OtherSyntaxLookup,
|
||||||
|
syntax_to_dependencies: &SyntaxToDependencies,
|
||||||
|
) {
|
||||||
|
if let Ok(dot_file_path) = std::env::var("BAT_SYNTAX_DEPENDENCIES_TO_GRAPHVIZ_DOT_FILE") {
|
||||||
|
graphviz_utils::try_syntax_dependencies_to_graphviz_dot_file(
|
||||||
|
other_syntax_lookup,
|
||||||
|
syntax_to_dependencies,
|
||||||
|
&dot_file_path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Removes any context name from the syntax reference.
|
||||||
|
///
|
||||||
|
/// When we track dependencies between syntaxes, we are not interested in
|
||||||
|
/// dependencies on specific contexts inside other syntaxes. We only care about
|
||||||
|
/// the dependency on the syntax itself.
|
||||||
|
///
|
||||||
|
/// For example, if a syntax includes another syntax like this:
|
||||||
|
/// ```yaml
|
||||||
|
/// - include: scope:source.c++#unique-variables
|
||||||
|
/// ```
|
||||||
|
/// we only want to track the dependency on `source.c++`.
|
||||||
|
fn remove_explicit_context(scope: Scope) -> Scope {
|
||||||
|
if let Some(without_context) = scope.build_string().split('#').next() {
|
||||||
|
Scope::new(without_context).expect("removing context reference must never fail")
|
||||||
|
} else {
|
||||||
|
scope
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dependency_from_context_reference(context_reference: &ContextReference) -> Option<OtherSyntax> {
|
||||||
|
match &context_reference {
|
||||||
|
ContextReference::File { ref name, .. } => Some(OtherSyntax::ByName(name.clone())),
|
||||||
|
ContextReference::ByScope { ref scope, .. } => {
|
||||||
|
Some(OtherSyntax::ByScope(remove_explicit_context(*scope)))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Helper to construct a [SyntaxSetBuilder] that contains only [SyntaxDefinition]s
|
||||||
|
/// that have dependencies among them.
|
||||||
|
struct SyntaxSetDependencyBuilder {
|
||||||
|
syntax_set_builder: SyntaxSetBuilder,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SyntaxSetDependencyBuilder {
|
||||||
|
fn new() -> Self {
|
||||||
|
SyntaxSetDependencyBuilder {
|
||||||
|
syntax_set_builder: SyntaxSetBuilder::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add a [SyntaxDefinition] to the underlying [SyntaxSetBuilder].
|
||||||
|
/// Also resolve any dependencies it has and add those [SyntaxDefinition]s too.
|
||||||
|
/// This is a recursive process.
|
||||||
|
fn add_with_dependencies(
|
||||||
|
&mut self,
|
||||||
|
syntax: &SyntaxDefinition,
|
||||||
|
other_syntax_lookup: &OtherSyntaxLookup,
|
||||||
|
syntax_to_dependencies: &SyntaxToDependencies,
|
||||||
|
syntax_to_dependents: &SyntaxToDependents,
|
||||||
|
) {
|
||||||
|
let name = &syntax.name;
|
||||||
|
if self.is_syntax_already_added(name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.syntax_set_builder.add(syntax.clone());
|
||||||
|
|
||||||
|
let mut syntaxes_to_add = vec![];
|
||||||
|
if let Some(dependencies) = syntax_to_dependencies.get(name) {
|
||||||
|
syntaxes_to_add.extend(dependencies);
|
||||||
|
}
|
||||||
|
if let Some(dependents) = syntax_to_dependents.get(name) {
|
||||||
|
// This will later be enabled intelligently
|
||||||
|
if std::env::var("BAT_INCLUDE_SYNTAX_DEPENDENTS").is_ok() {
|
||||||
|
syntaxes_to_add.extend(dependents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for syntax_to_add in syntaxes_to_add {
|
||||||
|
if let Some(syntax_to_add) = other_syntax_lookup.get(syntax_to_add) {
|
||||||
|
self.add_with_dependencies(
|
||||||
|
syntax_to_add,
|
||||||
|
other_syntax_lookup,
|
||||||
|
syntax_to_dependencies,
|
||||||
|
syntax_to_dependents,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_syntax_already_added(&self, name: &str) -> bool {
|
||||||
|
self.syntax_set_builder
|
||||||
|
.syntaxes()
|
||||||
|
.iter()
|
||||||
|
.any(|syntax| syntax.name == name)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build(self) -> SyntaxSet {
|
||||||
|
self.syntax_set_builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn asset_to_contents<T: serde::Serialize>(
|
||||||
asset: &T,
|
asset: &T,
|
||||||
description: &str,
|
description: &str,
|
||||||
compressed: bool,
|
compressed: bool,
|
||||||
@@ -174,3 +485,16 @@ fn asset_to_cache<T: serde::Serialize>(
|
|||||||
println!("okay");
|
println!("okay");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn remove_explicit_context_sanity() {
|
||||||
|
// Example from Objective-C++.sublime-syntax
|
||||||
|
let scope = Scope::new("source.c++#unique-variables").unwrap();
|
||||||
|
let expected = Scope::new("source.c++").unwrap();
|
||||||
|
assert_eq!(remove_explicit_context(scope), expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,219 +0,0 @@
|
|||||||
use std::fs::read_to_string;
|
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
|
|
||||||
use walkdir::DirEntry;
|
|
||||||
|
|
||||||
use crate::error::*;
|
|
||||||
|
|
||||||
struct PathAndStem {
|
|
||||||
path: PathBuf,
|
|
||||||
stem: String,
|
|
||||||
relative_path: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Looks for LICENSE and NOTICE files in `source_dir`, does some rudimentary
|
|
||||||
/// analysis, and compiles them together in a single string that is meant to be
|
|
||||||
/// used in the output to `--acknowledgements`
|
|
||||||
pub fn build_acknowledgements(
|
|
||||||
source_dir: &Path,
|
|
||||||
include_acknowledgements: bool,
|
|
||||||
) -> Result<Option<String>> {
|
|
||||||
if !include_acknowledgements {
|
|
||||||
return Ok(None);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut acknowledgements = format!("{}\n\n", include_str!("../../../NOTICE"));
|
|
||||||
|
|
||||||
// Sort entries so the order is stable over time
|
|
||||||
let entries = walkdir::WalkDir::new(source_dir).sort_by(|a, b| a.path().cmp(b.path()));
|
|
||||||
for path_and_stem in entries
|
|
||||||
.into_iter()
|
|
||||||
.flatten()
|
|
||||||
.flat_map(|entry| to_path_and_stem(source_dir, entry))
|
|
||||||
{
|
|
||||||
if let Some(license_text) = handle_file(&path_and_stem)? {
|
|
||||||
append_to_acknowledgements(
|
|
||||||
&mut acknowledgements,
|
|
||||||
&path_and_stem.relative_path,
|
|
||||||
&license_text,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Some(acknowledgements))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_path_and_stem(source_dir: &Path, entry: DirEntry) -> Option<PathAndStem> {
|
|
||||||
let path = entry.path();
|
|
||||||
|
|
||||||
Some(PathAndStem {
|
|
||||||
path: path.to_owned(),
|
|
||||||
stem: path.file_stem().map(|s| s.to_string_lossy().to_string())?,
|
|
||||||
relative_path: path
|
|
||||||
.strip_prefix(source_dir)
|
|
||||||
.map(|p| p.to_string_lossy().to_string())
|
|
||||||
.ok()?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_file(path_and_stem: &PathAndStem) -> Result<Option<String>> {
|
|
||||||
if path_and_stem.stem == "NOTICE" {
|
|
||||||
handle_notice(&path_and_stem.path)
|
|
||||||
} else if path_and_stem.stem.to_ascii_uppercase() == "LICENSE" {
|
|
||||||
handle_license(&path_and_stem.path)
|
|
||||||
} else {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_notice(path: &Path) -> Result<Option<String>> {
|
|
||||||
// Assume NOTICE as defined by Apache License 2.0. These must be part of acknowledgements.
|
|
||||||
Ok(Some(read_to_string(path)?))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_license(path: &Path) -> Result<Option<String>> {
|
|
||||||
let license_text = read_to_string(path)?;
|
|
||||||
|
|
||||||
if include_license_in_acknowledgments(&license_text) {
|
|
||||||
Ok(Some(license_text))
|
|
||||||
} else if license_not_needed_in_acknowledgements(&license_text) {
|
|
||||||
Ok(None)
|
|
||||||
} else {
|
|
||||||
Err(format!("ERROR: License is of unknown type: {:?}", path).into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn include_license_in_acknowledgments(license_text: &str) -> bool {
|
|
||||||
let markers = vec![
|
|
||||||
// MIT
|
|
||||||
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
|
|
||||||
|
|
||||||
// BSD
|
|
||||||
"Redistributions in binary form must reproduce the above copyright notice,",
|
|
||||||
|
|
||||||
// Apache 2.0
|
|
||||||
"Apache License Version 2.0, January 2004 http://www.apache.org/licenses/",
|
|
||||||
"Licensed under the Apache License, Version 2.0 (the \"License\");",
|
|
||||||
];
|
|
||||||
|
|
||||||
license_contains_marker(license_text, &markers)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn license_not_needed_in_acknowledgements(license_text: &str) -> bool {
|
|
||||||
let markers = vec![
|
|
||||||
// Public domain
|
|
||||||
"This is free and unencumbered software released into the public domain.",
|
|
||||||
|
|
||||||
// Special license of assets/syntaxes/01_Packages/LICENSE
|
|
||||||
"Permission to copy, use, modify, sell and distribute this software is granted. This software is provided \"as is\" without express or implied warranty, and with no claim as to its suitability for any purpose."
|
|
||||||
];
|
|
||||||
|
|
||||||
license_contains_marker(license_text, &markers)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn license_contains_marker(license_text: &str, markers: &[&str]) -> bool {
|
|
||||||
let normalized_license_text = normalize_license_text(license_text);
|
|
||||||
markers.iter().any(|m| normalized_license_text.contains(m))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn append_to_acknowledgements(
|
|
||||||
acknowledgements: &mut String,
|
|
||||||
relative_path: &str,
|
|
||||||
license_text: &str,
|
|
||||||
) {
|
|
||||||
acknowledgements.push_str(&format!("## {}\n\n{}", relative_path, license_text));
|
|
||||||
|
|
||||||
// Make sure the last char is a newline to not mess up formatting later
|
|
||||||
if acknowledgements
|
|
||||||
.chars()
|
|
||||||
.last()
|
|
||||||
.expect("acknowledgements is not the empty string")
|
|
||||||
!= '\n'
|
|
||||||
{
|
|
||||||
acknowledgements.push('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add two more newlines to make it easy to distinguish where this text ends
|
|
||||||
// and the next starts
|
|
||||||
acknowledgements.push_str("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Replaces newlines with a space character, and replaces multiple spaces with one space.
|
|
||||||
/// This makes the text easier to analyze.
|
|
||||||
fn normalize_license_text(license_text: &str) -> String {
|
|
||||||
use regex::Regex;
|
|
||||||
|
|
||||||
let whitespace_and_newlines = Regex::new(r"\s").unwrap();
|
|
||||||
let as_single_line = whitespace_and_newlines.replace_all(license_text, " ");
|
|
||||||
|
|
||||||
let many_spaces = Regex::new(" +").unwrap();
|
|
||||||
many_spaces.replace_all(&as_single_line, " ").to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
#[cfg(test)]
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_normalize_license_text() {
|
|
||||||
let license_text = "This is a license text with these terms:
|
|
||||||
* Complicated multi-line
|
|
||||||
term with indentation";
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
"This is a license text with these terms: * Complicated multi-line term with indentation".to_owned(),
|
|
||||||
normalize_license_text(license_text),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_normalize_license_text_with_windows_line_endings() {
|
|
||||||
let license_text = "This license text includes windows line endings\r
|
|
||||||
and we need to handle that.";
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
"This license text includes windows line endings and we need to handle that."
|
|
||||||
.to_owned(),
|
|
||||||
normalize_license_text(license_text),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_append_to_acknowledgements_adds_newline_if_missing() {
|
|
||||||
let mut acknowledgements = "preamble\n\n\n".to_owned();
|
|
||||||
|
|
||||||
append_to_acknowledgements(&mut acknowledgements, "some/path", "line without newline");
|
|
||||||
assert_eq!(
|
|
||||||
"preamble
|
|
||||||
|
|
||||||
|
|
||||||
## some/path
|
|
||||||
|
|
||||||
line without newline
|
|
||||||
|
|
||||||
|
|
||||||
",
|
|
||||||
acknowledgements
|
|
||||||
);
|
|
||||||
|
|
||||||
append_to_acknowledgements(&mut acknowledgements, "another/path", "line with newline\n");
|
|
||||||
assert_eq!(
|
|
||||||
"preamble
|
|
||||||
|
|
||||||
|
|
||||||
## some/path
|
|
||||||
|
|
||||||
line without newline
|
|
||||||
|
|
||||||
|
|
||||||
## another/path
|
|
||||||
|
|
||||||
line with newline
|
|
||||||
|
|
||||||
|
|
||||||
",
|
|
||||||
acknowledgements
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
41
src/assets/build_assets/graphviz_utils.rs
Normal file
41
src/assets/build_assets/graphviz_utils.rs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub(crate) fn try_syntax_dependencies_to_graphviz_dot_file(
|
||||||
|
other_syntax_lookup: &OtherSyntaxLookup,
|
||||||
|
syntax_to_dependencies: &SyntaxToDependencies,
|
||||||
|
dot_file_path: &str,
|
||||||
|
) {
|
||||||
|
match syntax_dependencies_to_graphviz_dot_file(
|
||||||
|
other_syntax_lookup,
|
||||||
|
syntax_to_dependencies,
|
||||||
|
dot_file_path,
|
||||||
|
) {
|
||||||
|
Ok(_) => println!("Wrote graphviz dot file to {}", dot_file_path),
|
||||||
|
Err(e) => eprintln!(
|
||||||
|
"Failed to write graphviz dot file to {}: {}",
|
||||||
|
dot_file_path, e
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn syntax_dependencies_to_graphviz_dot_file(
|
||||||
|
other_syntax_lookup: &OtherSyntaxLookup,
|
||||||
|
syntax_to_dependencies: &SyntaxToDependencies,
|
||||||
|
dot_file_path: &str,
|
||||||
|
) -> Result<()> {
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
let mut dot_file = std::fs::File::create(dot_file_path)?;
|
||||||
|
|
||||||
|
writeln!(dot_file, "digraph BatSyntaxDependencies {{")?;
|
||||||
|
for (key, dependencies) in syntax_to_dependencies {
|
||||||
|
for dependency in dependencies {
|
||||||
|
if let Some(dep) = other_syntax_lookup.get(dependency) {
|
||||||
|
writeln!(dot_file, " \"{}\" -> \"{}\"", key, dep.name)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeln!(dot_file, "}}")?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
42
src/assets/ignored_suffixes.rs
Normal file
42
src/assets/ignored_suffixes.rs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
use std::ffi::OsStr;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use crate::error::*;
|
||||||
|
|
||||||
|
const IGNORED_SUFFIXES: [&str; 13] = [
|
||||||
|
// Editor etc backups
|
||||||
|
"~",
|
||||||
|
".bak",
|
||||||
|
".old",
|
||||||
|
".orig",
|
||||||
|
// Debian and derivatives apt/dpkg/ucf backups
|
||||||
|
".dpkg-dist",
|
||||||
|
".dpkg-old",
|
||||||
|
".ucf-dist",
|
||||||
|
".ucf-new",
|
||||||
|
".ucf-old",
|
||||||
|
// Red Hat and derivatives rpm backups
|
||||||
|
".rpmnew",
|
||||||
|
".rpmorig",
|
||||||
|
".rpmsave",
|
||||||
|
// Build system input/template files
|
||||||
|
".in",
|
||||||
|
];
|
||||||
|
|
||||||
|
/// If we find an ignored suffix on the file name, e.g. '~', we strip it and
|
||||||
|
/// then try again without it.
|
||||||
|
pub fn try_with_stripped_suffix<T, F>(file_name: &OsStr, func: F) -> Result<Option<T>>
|
||||||
|
where
|
||||||
|
F: Fn(&OsStr) -> Result<Option<T>>,
|
||||||
|
{
|
||||||
|
let mut from_stripped = None;
|
||||||
|
if let Some(file_str) = Path::new(file_name).to_str() {
|
||||||
|
for suffix in &IGNORED_SUFFIXES {
|
||||||
|
if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
|
||||||
|
from_stripped = func(OsStr::new(stripped_filename))?;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(from_stripped)
|
||||||
|
}
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
use super::*;
|
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
use serde::Deserialize;
|
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
use once_cell::unsync::OnceCell;
|
|
||||||
|
|
||||||
use syntect::highlighting::{Theme, ThemeSet};
|
|
||||||
|
|
||||||
/// Same structure as a [`syntect::highlighting::ThemeSet`] but with themes
|
|
||||||
/// stored in raw serialized form, and deserialized on demand.
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
|
||||||
pub struct LazyThemeSet {
|
|
||||||
/// This is a [`BTreeMap`] because that's what [`syntect::highlighting::ThemeSet`] uses
|
|
||||||
themes: BTreeMap<String, LazyTheme>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Stores raw serialized data for a theme with methods to lazily deserialize
|
|
||||||
/// (load) the theme.
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
struct LazyTheme {
|
|
||||||
serialized: Vec<u8>,
|
|
||||||
|
|
||||||
#[serde(skip, default = "OnceCell::new")]
|
|
||||||
deserialized: OnceCell<syntect::highlighting::Theme>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LazyThemeSet {
|
|
||||||
/// Lazily load the given theme
|
|
||||||
pub fn get(&self, name: &str) -> Option<&Theme> {
|
|
||||||
self.themes.get(name).and_then(|lazy_theme| {
|
|
||||||
lazy_theme
|
|
||||||
.deserialized
|
|
||||||
.get_or_try_init(|| lazy_theme.deserialize())
|
|
||||||
.ok()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the name of all themes.
|
|
||||||
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
|
||||||
self.themes.keys().map(|name| name.as_ref())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LazyTheme {
|
|
||||||
fn deserialize(&self) -> Result<Theme> {
|
|
||||||
asset_from_contents(
|
|
||||||
&self.serialized[..],
|
|
||||||
"lazy-loaded theme",
|
|
||||||
COMPRESS_LAZY_THEMES,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<LazyThemeSet> for ThemeSet {
|
|
||||||
type Error = Error;
|
|
||||||
|
|
||||||
/// Since the user might want to add custom themes to bat, we need a way to
|
|
||||||
/// convert from a `LazyThemeSet` to a regular [`ThemeSet`] so that more
|
|
||||||
/// themes can be added. This function does that pretty straight-forward
|
|
||||||
/// conversion.
|
|
||||||
fn try_from(lazy_theme_set: LazyThemeSet) -> Result<Self> {
|
|
||||||
let mut theme_set = ThemeSet::default();
|
|
||||||
|
|
||||||
for (name, lazy_theme) in lazy_theme_set.themes {
|
|
||||||
theme_set.themes.insert(name, lazy_theme.deserialize()?);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(theme_set)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "build-assets")]
|
|
||||||
impl TryFrom<ThemeSet> for LazyThemeSet {
|
|
||||||
type Error = Error;
|
|
||||||
|
|
||||||
/// To collect themes, a [`ThemeSet`] is needed. Once all desired themes
|
|
||||||
/// have been added, we need a way to convert that into [`LazyThemeSet`] so
|
|
||||||
/// that themes can be lazy-loaded later. This function does that
|
|
||||||
/// conversion.
|
|
||||||
fn try_from(theme_set: ThemeSet) -> Result<Self> {
|
|
||||||
let mut lazy_theme_set = LazyThemeSet::default();
|
|
||||||
|
|
||||||
for (name, theme) in theme_set.themes {
|
|
||||||
// All we have to do is to serialize the theme
|
|
||||||
let lazy_theme = LazyTheme {
|
|
||||||
serialized: crate::assets::build_assets::asset_to_contents(
|
|
||||||
&theme,
|
|
||||||
&format!("theme {}", name),
|
|
||||||
COMPRESS_LAZY_THEMES,
|
|
||||||
)?,
|
|
||||||
deserialized: OnceCell::new(),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Ok done, now we can add it
|
|
||||||
lazy_theme_set.themes.insert(name, lazy_theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(lazy_theme_set)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
72
src/assets/minimal_assets.rs
Normal file
72
src/assets/minimal_assets.rs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use lazycell::LazyCell;
|
||||||
|
|
||||||
|
use syntect::parsing::SyntaxSet;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub(crate) struct MinimalAssets {
|
||||||
|
minimal_syntaxes: MinimalSyntaxes,
|
||||||
|
|
||||||
|
/// Lazily load serialized [SyntaxSet]s from [Self.minimal_syntaxes]. The
|
||||||
|
/// index in this vec matches the index in
|
||||||
|
/// [Self.minimal_syntaxes.serialized_syntax_sets]
|
||||||
|
deserialized_minimal_syntaxes: Vec<LazyCell<SyntaxSet>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Stores and allows lookup of minimal [SyntaxSet]s. The [SyntaxSet]s are
|
||||||
|
/// stored in serialized form, and are deserialized on-demand. This gives good
|
||||||
|
/// startup performance since only the necessary [SyntaxReference]s needs to be
|
||||||
|
/// deserialized.
|
||||||
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||||
|
pub(crate) struct MinimalSyntaxes {
|
||||||
|
/// Lookup the index into `serialized_syntax_sets` of a [SyntaxSet] by the
|
||||||
|
/// name of any [SyntaxReference] inside the [SyntaxSet]
|
||||||
|
/// (We will later add `by_extension`, `by_first_line`, etc.)
|
||||||
|
pub(crate) by_name: HashMap<String, usize>,
|
||||||
|
|
||||||
|
/// Serialized [SyntaxSet]s. Whether or not this data is compressed is
|
||||||
|
/// decided by [COMPRESS_SERIALIZED_MINIMAL_SYNTAXES]
|
||||||
|
pub(crate) serialized_syntax_sets: Vec<Vec<u8>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MinimalAssets {
|
||||||
|
pub(crate) fn new(minimal_syntaxes: MinimalSyntaxes) -> Self {
|
||||||
|
// Prepare so we can lazily load minimal syntaxes without a mut reference
|
||||||
|
let deserialized_minimal_syntaxes =
|
||||||
|
vec![LazyCell::new(); minimal_syntaxes.serialized_syntax_sets.len()];
|
||||||
|
|
||||||
|
Self {
|
||||||
|
minimal_syntaxes,
|
||||||
|
deserialized_minimal_syntaxes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_syntax_set_by_name(&self, name: &str) -> Option<&SyntaxSet> {
|
||||||
|
self.minimal_syntaxes
|
||||||
|
.by_name
|
||||||
|
.get(&name.to_ascii_lowercase())
|
||||||
|
.and_then(|index| self.get_minimal_syntax_set_with_index(*index))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_minimal_syntax_set_with_index(&self, index: usize) -> Result<SyntaxSet> {
|
||||||
|
let serialized_syntax_set = &self.minimal_syntaxes.serialized_syntax_sets[index];
|
||||||
|
asset_from_contents(
|
||||||
|
&serialized_syntax_set[..],
|
||||||
|
&format!("minimal syntax set {}", index),
|
||||||
|
COMPRESS_SERIALIZED_MINIMAL_SYNTAXES,
|
||||||
|
)
|
||||||
|
.map_err(|_| format!("Could not parse minimal syntax set {}", index).into())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_minimal_syntax_set_with_index(&self, index: usize) -> Option<&SyntaxSet> {
|
||||||
|
self.deserialized_minimal_syntaxes
|
||||||
|
.get(index)
|
||||||
|
.and_then(|cell| {
|
||||||
|
cell.try_borrow_with(|| self.load_minimal_syntax_set_with_index(index))
|
||||||
|
.ok()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -107,12 +107,6 @@ impl App {
|
|||||||
|
|
||||||
let mut syntax_mapping = SyntaxMapping::builtin();
|
let mut syntax_mapping = SyntaxMapping::builtin();
|
||||||
|
|
||||||
if let Some(values) = self.matches.values_of("ignored-suffix") {
|
|
||||||
for suffix in values {
|
|
||||||
syntax_mapping.insert_ignored_suffix(suffix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(values) = self.matches.values_of("map-syntax") {
|
if let Some(values) = self.matches.values_of("map-syntax") {
|
||||||
for from_to in values {
|
for from_to in values {
|
||||||
let parts: Vec<_> = from_to.split(':').collect();
|
let parts: Vec<_> = from_to.split(':').collect();
|
||||||
@@ -307,7 +301,7 @@ impl App {
|
|||||||
.map(|style_str| {
|
.map(|style_str| {
|
||||||
style_str
|
style_str
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(StyleComponent::from_str)
|
.map(|x| StyleComponent::from_str(x))
|
||||||
.collect::<Result<Vec<StyleComponent>>>()
|
.collect::<Result<Vec<StyleComponent>>>()
|
||||||
})
|
})
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io;
|
|
||||||
|
|
||||||
use clap::crate_version;
|
use clap::crate_version;
|
||||||
|
|
||||||
@@ -21,6 +20,7 @@ pub fn cache_dir() -> Cow<'static, str> {
|
|||||||
pub fn clear_assets() {
|
pub fn clear_assets() {
|
||||||
clear_asset("themes.bin", "theme set cache");
|
clear_asset("themes.bin", "theme set cache");
|
||||||
clear_asset("syntaxes.bin", "syntax set cache");
|
clear_asset("syntaxes.bin", "syntax set cache");
|
||||||
|
clear_asset("minimal_syntaxes.bin", "minimal syntax sets cache");
|
||||||
clear_asset("metadata.yaml", "metadata file");
|
clear_asset("metadata.yaml", "metadata file");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,14 +52,6 @@ pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<Highlighti
|
|||||||
|
|
||||||
fn clear_asset(filename: &str, description: &str) {
|
fn clear_asset(filename: &str, description: &str) {
|
||||||
print!("Clearing {} ... ", description);
|
print!("Clearing {} ... ", description);
|
||||||
let path = PROJECT_DIRS.cache_dir().join(filename);
|
fs::remove_file(PROJECT_DIRS.cache_dir().join(filename)).ok();
|
||||||
match fs::remove_file(&path) {
|
println!("okay");
|
||||||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
|
||||||
println!("skipped (not present)");
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
println!("could not remove the cache file {:?}: {}", &path, err);
|
|
||||||
}
|
|
||||||
Ok(_) => println!("okay"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,7 @@
|
|||||||
use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
static VERSION: Lazy<String> = Lazy::new(|| {
|
|
||||||
#[cfg(feature = "bugreport")]
|
|
||||||
let git_version = bugreport::git_version!(fallback = "");
|
|
||||||
#[cfg(not(feature = "bugreport"))]
|
|
||||||
let git_version = "";
|
|
||||||
|
|
||||||
if git_version.is_empty() {
|
|
||||||
crate_version!().to_string()
|
|
||||||
} else {
|
|
||||||
format!("{} ({})", crate_version!(), git_version)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||||
let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
|
let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
|
||||||
AppSettings::ColoredHelp
|
AppSettings::ColoredHelp
|
||||||
@@ -24,7 +10,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut app = ClapApp::new(crate_name!())
|
let mut app = ClapApp::new(crate_name!())
|
||||||
.version(VERSION.as_str())
|
.version(crate_version!())
|
||||||
.global_setting(clap_color_setting)
|
.global_setting(clap_color_setting)
|
||||||
.global_setting(AppSettings::DeriveDisplayOrder)
|
.global_setting(AppSettings::DeriveDisplayOrder)
|
||||||
.global_setting(AppSettings::UnifiedHelpMessage)
|
.global_setting(AppSettings::UnifiedHelpMessage)
|
||||||
@@ -349,18 +335,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
)
|
)
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
|
||||||
Arg::with_name("ignored-suffix")
|
|
||||||
.number_of_values(1)
|
|
||||||
.multiple(true)
|
|
||||||
.takes_value(true)
|
|
||||||
.long("ignored-suffix")
|
|
||||||
.hidden_short_help(true)
|
|
||||||
.help(
|
|
||||||
"Ignore extension. For example:\n \
|
|
||||||
'bat --ignored-suffix \".dev\" my_file.json.dev' will use JSON syntax, and ignore '.dev'"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("theme")
|
Arg::with_name("theme")
|
||||||
.long("theme")
|
.long("theme")
|
||||||
@@ -520,12 +494,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.hidden_short_help(true)
|
.hidden_short_help(true)
|
||||||
.help("Show diagnostic information for bug reports.")
|
.help("Show diagnostic information for bug reports.")
|
||||||
)
|
)
|
||||||
.arg(
|
|
||||||
Arg::with_name("acknowledgements")
|
|
||||||
.long("acknowledgements")
|
|
||||||
.hidden_short_help(true)
|
|
||||||
.help("Show acknowledgements."),
|
|
||||||
)
|
|
||||||
.help_message("Print this help message.")
|
.help_message("Print this help message.")
|
||||||
.version_message("Show version information.");
|
.version_message("Show version information.");
|
||||||
|
|
||||||
@@ -584,12 +552,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
"Create completely new syntax and theme sets \
|
"Create completely new syntax and theme sets \
|
||||||
(instead of appending to the default sets).",
|
(instead of appending to the default sets).",
|
||||||
),
|
),
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("acknowledgements")
|
|
||||||
.long("acknowledgements")
|
|
||||||
.requires("build")
|
|
||||||
.help("Build acknowledgements.bin."),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ fn get_args_from_str(content: &str) -> Result<Vec<OsString>, shell_words::ParseE
|
|||||||
.map(|line| line.trim())
|
.map(|line| line.trim())
|
||||||
.filter(|line| !line.is_empty())
|
.filter(|line| !line.is_empty())
|
||||||
.filter(|line| !line.starts_with('#'))
|
.filter(|line| !line.starts_with('#'))
|
||||||
.map(shell_words::split)
|
.map(|line| shell_words::split(line))
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
Ok(args_per_line
|
Ok(args_per_line
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
||||||
/// The `XDG_CACHE_HOME` environment variable is checked first. `BAT_CONFIG_DIR`
|
/// The `XDG_CACHE_HOME` environment variable is checked first. `BAT_CONFIG_DIR`
|
||||||
@@ -68,5 +68,7 @@ impl BatProjectDirs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static PROJECT_DIRS: Lazy<BatProjectDirs> =
|
lazy_static! {
|
||||||
Lazy::new(|| BatProjectDirs::new().expect("Could not get home directory"));
|
pub static ref PROJECT_DIRS: BatProjectDirs =
|
||||||
|
BatProjectDirs::new().expect("Could not get home directory");
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,13 +47,9 @@ fn build_assets(matches: &clap::ArgMatches) -> Result<()> {
|
|||||||
.map(Path::new)
|
.map(Path::new)
|
||||||
.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
||||||
|
|
||||||
bat::assets::build(
|
let blank = matches.is_present("blank");
|
||||||
source_dir,
|
|
||||||
!matches.is_present("blank"),
|
bat::assets::build(source_dir, !blank, target_dir, clap::crate_version!())
|
||||||
matches.is_present("acknowledgements"),
|
|
||||||
target_dir,
|
|
||||||
clap::crate_version!(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
||||||
@@ -74,11 +70,14 @@ fn get_syntax_mapping_to_paths<'a>(
|
|||||||
) -> HashMap<&'a str, Vec<String>> {
|
) -> HashMap<&'a str, Vec<String>> {
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
for mapping in mappings {
|
for mapping in mappings {
|
||||||
if let (matcher, MappingTarget::MapTo(s)) = mapping {
|
match mapping {
|
||||||
|
(_, MappingTarget::MapToUnknown) => {}
|
||||||
|
(matcher, MappingTarget::MapTo(s)) => {
|
||||||
let globs = map.entry(*s).or_insert_with(Vec::new);
|
let globs = map.entry(*s).or_insert_with(Vec::new);
|
||||||
globs.push(matcher.glob().glob().into());
|
globs.push(matcher.glob().glob().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,9 +323,6 @@ fn run() -> Result<bool> {
|
|||||||
} else if app.matches.is_present("cache-dir") {
|
} else if app.matches.is_present("cache-dir") {
|
||||||
writeln!(io::stdout(), "{}", cache_dir())?;
|
writeln!(io::stdout(), "{}", cache_dir())?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if app.matches.is_present("acknowledgements") {
|
|
||||||
writeln!(io::stdout(), "{}", bat::assets::get_acknowledgements())?;
|
|
||||||
Ok(true)
|
|
||||||
} else {
|
} else {
|
||||||
run_controller(inputs, &config)
|
run_controller(inputs, &config)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::io::{self, BufRead, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
use crate::assets::HighlightingAssets;
|
use crate::assets::HighlightingAssets;
|
||||||
use crate::config::{Config, VisibleLines};
|
use crate::config::{Config, VisibleLines};
|
||||||
@@ -14,7 +14,7 @@ use crate::output::OutputType;
|
|||||||
use crate::paging::PagingMode;
|
use crate::paging::PagingMode;
|
||||||
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||||
|
|
||||||
use clircle::{Clircle, Identifier};
|
use clircle::Clircle;
|
||||||
|
|
||||||
pub struct Controller<'a> {
|
pub struct Controller<'a> {
|
||||||
config: &'a Config<'a>,
|
config: &'a Config<'a>,
|
||||||
@@ -76,39 +76,23 @@ impl<'b> Controller<'b> {
|
|||||||
|
|
||||||
let writer = output_type.handle()?;
|
let writer = output_type.handle()?;
|
||||||
let mut no_errors: bool = true;
|
let mut no_errors: bool = true;
|
||||||
|
|
||||||
let stderr = io::stderr();
|
let stderr = io::stderr();
|
||||||
|
let print_error = |error: &Error, write: &mut dyn Write| {
|
||||||
|
if attached_to_pager {
|
||||||
|
handle_error(error, write);
|
||||||
|
} else {
|
||||||
|
handle_error(error, &mut stderr.lock());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for (index, input) in inputs.into_iter().enumerate() {
|
for (index, input) in inputs.into_iter().enumerate() {
|
||||||
let identifier = stdout_identifier.as_ref();
|
match input.open(io::stdin().lock(), stdout_identifier.as_ref()) {
|
||||||
let is_first = index == 0;
|
Err(error) => {
|
||||||
let result = if input.is_stdin() {
|
print_error(&error, writer);
|
||||||
self.print_input(input, writer, io::stdin().lock(), identifier, is_first)
|
|
||||||
} else {
|
|
||||||
// Use dummy stdin since stdin is actually not used (#1902)
|
|
||||||
self.print_input(input, writer, io::empty(), identifier, is_first)
|
|
||||||
};
|
|
||||||
if let Err(error) = result {
|
|
||||||
if attached_to_pager {
|
|
||||||
handle_error(&error, writer);
|
|
||||||
} else {
|
|
||||||
handle_error(&error, &mut stderr.lock());
|
|
||||||
}
|
|
||||||
no_errors = false;
|
no_errors = false;
|
||||||
}
|
}
|
||||||
}
|
Ok(mut opened_input) => {
|
||||||
|
|
||||||
Ok(no_errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn print_input<R: BufRead>(
|
|
||||||
&self,
|
|
||||||
input: Input,
|
|
||||||
writer: &mut dyn Write,
|
|
||||||
stdin: R,
|
|
||||||
stdout_identifier: Option<&Identifier>,
|
|
||||||
is_first: bool,
|
|
||||||
) -> Result<()> {
|
|
||||||
let mut opened_input = input.open(stdin, stdout_identifier)?;
|
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
let line_changes = if self.config.visible_lines.diff_mode()
|
let line_changes = if self.config.visible_lines.diff_mode()
|
||||||
|| (!self.config.loop_through && self.config.style_components.changes())
|
|| (!self.config.loop_through && self.config.style_components.changes())
|
||||||
@@ -124,14 +108,14 @@ impl<'b> Controller<'b> {
|
|||||||
.map(|changes| changes.is_empty())
|
.map(|changes| changes.is_empty())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
return Ok(());
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff
|
diff
|
||||||
}
|
}
|
||||||
_ if self.config.visible_lines.diff_mode() => {
|
_ if self.config.visible_lines.diff_mode() => {
|
||||||
// Skip non-file inputs in diff mode
|
// Skip non-file inputs in diff mode
|
||||||
return Ok(());
|
continue;
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
@@ -151,14 +135,24 @@ impl<'b> Controller<'b> {
|
|||||||
)?)
|
)?)
|
||||||
};
|
};
|
||||||
|
|
||||||
self.print_file(
|
let result = self.print_file(
|
||||||
&mut *printer,
|
&mut *printer,
|
||||||
writer,
|
writer,
|
||||||
&mut opened_input,
|
&mut opened_input,
|
||||||
!is_first,
|
index != 0,
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
&line_changes,
|
&line_changes,
|
||||||
)
|
);
|
||||||
|
|
||||||
|
if let Err(error) = result {
|
||||||
|
print_error(&error, writer);
|
||||||
|
no_errors = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(no_errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_file(
|
fn print_file(
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ pub(crate) mod printer;
|
|||||||
pub mod style;
|
pub mod style;
|
||||||
pub(crate) mod syntax_mapping;
|
pub(crate) mod syntax_mapping;
|
||||||
mod terminal;
|
mod terminal;
|
||||||
mod vscreen;
|
|
||||||
pub(crate) mod wrapping;
|
pub(crate) mod wrapping;
|
||||||
|
|
||||||
pub use pretty_printer::{Input, PrettyPrinter};
|
pub use pretty_printer::{Input, PrettyPrinter};
|
||||||
|
|||||||
@@ -47,24 +47,12 @@ impl LineRange {
|
|||||||
}
|
}
|
||||||
2 => {
|
2 => {
|
||||||
new_range.lower = line_numbers[0].parse()?;
|
new_range.lower = line_numbers[0].parse()?;
|
||||||
let first_byte = line_numbers[1].bytes().next();
|
|
||||||
|
|
||||||
new_range.upper = if first_byte == Some(b'+') {
|
new_range.upper = if line_numbers[1].bytes().next() == Some(b'+') {
|
||||||
let more_lines = &line_numbers[1][1..]
|
let more_lines = &line_numbers[1][1..]
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(|_| "Invalid character after +")?;
|
.map_err(|_| "Invalid character after +")?;
|
||||||
new_range.lower + more_lines
|
new_range.lower + more_lines
|
||||||
} else if first_byte == Some(b'-') {
|
|
||||||
// this will prevent values like "-+5" even though "+5" is valid integer
|
|
||||||
if line_numbers[1][1..].bytes().next() == Some(b'+') {
|
|
||||||
return Err("Invalid character after -".into());
|
|
||||||
}
|
|
||||||
let prior_lines = &line_numbers[1][1..]
|
|
||||||
.parse()
|
|
||||||
.map_err(|_| "Invalid character after -")?;
|
|
||||||
let prev_lower = new_range.lower;
|
|
||||||
new_range.lower = new_range.lower.saturating_sub(*prior_lines);
|
|
||||||
prev_lower
|
|
||||||
} else {
|
} else {
|
||||||
line_numbers[1].parse()?
|
line_numbers[1].parse()?
|
||||||
};
|
};
|
||||||
@@ -138,36 +126,6 @@ fn test_parse_plus_fail() {
|
|||||||
assert!(range.is_err());
|
assert!(range.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_minus_success() {
|
|
||||||
let range = LineRange::from("40:-10").expect("Shouldn't fail on test!");
|
|
||||||
assert_eq!(30, range.lower);
|
|
||||||
assert_eq!(40, range.upper);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_minus_edge_cases_success() {
|
|
||||||
let range = LineRange::from("5:-4").expect("Shouldn't fail on test!");
|
|
||||||
assert_eq!(1, range.lower);
|
|
||||||
assert_eq!(5, range.upper);
|
|
||||||
let range = LineRange::from("5:-5").expect("Shouldn't fail on test!");
|
|
||||||
assert_eq!(0, range.lower);
|
|
||||||
assert_eq!(5, range.upper);
|
|
||||||
let range = LineRange::from("5:-100").expect("Shouldn't fail on test!");
|
|
||||||
assert_eq!(0, range.lower);
|
|
||||||
assert_eq!(5, range.upper);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_minus_fail() {
|
|
||||||
let range = LineRange::from("40:-z");
|
|
||||||
assert!(range.is_err());
|
|
||||||
let range = LineRange::from("40:-+10");
|
|
||||||
assert!(range.is_err());
|
|
||||||
let range = LineRange::from("40:-");
|
|
||||||
assert!(range.is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
pub enum RangeCheckResult {
|
pub enum RangeCheckResult {
|
||||||
// Within one of the given ranges
|
// Within one of the given ranges
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ use crate::input::OpenedInput;
|
|||||||
use crate::line_range::RangeCheckResult;
|
use crate::line_range::RangeCheckResult;
|
||||||
use crate::preprocessor::{expand_tabs, replace_nonprintable};
|
use crate::preprocessor::{expand_tabs, replace_nonprintable};
|
||||||
use crate::terminal::{as_terminal_escaped, to_ansi_color};
|
use crate::terminal::{as_terminal_escaped, to_ansi_color};
|
||||||
use crate::vscreen::AnsiStyle;
|
|
||||||
use crate::wrapping::WrappingMode;
|
use crate::wrapping::WrappingMode;
|
||||||
|
|
||||||
pub(crate) trait Printer {
|
pub(crate) trait Printer {
|
||||||
@@ -119,7 +118,7 @@ pub(crate) struct InteractivePrinter<'a> {
|
|||||||
config: &'a Config<'a>,
|
config: &'a Config<'a>,
|
||||||
decorations: Vec<Box<dyn Decoration>>,
|
decorations: Vec<Box<dyn Decoration>>,
|
||||||
panel_width: usize,
|
panel_width: usize,
|
||||||
ansi_style: AnsiStyle,
|
ansi_prefix_sgr: String,
|
||||||
content_type: Option<ContentType>,
|
content_type: Option<ContentType>,
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
pub line_changes: &'a Option<LineChanges>,
|
pub line_changes: &'a Option<LineChanges>,
|
||||||
@@ -203,7 +202,7 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
config,
|
config,
|
||||||
decorations,
|
decorations,
|
||||||
content_type: input.reader.content_type,
|
content_type: input.reader.content_type,
|
||||||
ansi_style: AnsiStyle::new(),
|
ansi_prefix_sgr: String::new(),
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
line_changes,
|
line_changes,
|
||||||
highlighter_from_set,
|
highlighter_from_set,
|
||||||
@@ -445,26 +444,14 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
let italics = self.config.use_italic_text;
|
let italics = self.config.use_italic_text;
|
||||||
|
|
||||||
for &(style, region) in ®ions {
|
for &(style, region) in ®ions {
|
||||||
let ansi_iterator = AnsiCodeIterator::new(region);
|
let text = &*self.preprocess(region, &mut cursor_total);
|
||||||
for chunk in ansi_iterator {
|
|
||||||
match chunk {
|
|
||||||
// ANSI escape passthrough.
|
|
||||||
(ansi, true) => {
|
|
||||||
self.ansi_style.update(ansi);
|
|
||||||
write!(handle, "{}", ansi)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Regular text.
|
|
||||||
(text, false) => {
|
|
||||||
let text = &*self.preprocess(text, &mut cursor_total);
|
|
||||||
let text_trimmed = text.trim_end_matches(|c| c == '\r' || c == '\n');
|
let text_trimmed = text.trim_end_matches(|c| c == '\r' || c == '\n');
|
||||||
|
|
||||||
write!(
|
write!(
|
||||||
handle,
|
handle,
|
||||||
"{}",
|
"{}",
|
||||||
as_terminal_escaped(
|
as_terminal_escaped(
|
||||||
style,
|
style,
|
||||||
&format!("{}{}", self.ansi_style, text_trimmed),
|
text_trimmed,
|
||||||
true_color,
|
true_color,
|
||||||
colored_output,
|
colored_output,
|
||||||
italics,
|
italics,
|
||||||
@@ -478,7 +465,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
background: to_ansi_color(background_color, true_color),
|
background: to_ansi_color(background_color, true_color),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let width = if cursor_total <= cursor_max {
|
let width = if cursor_total <= cursor_max {
|
||||||
cursor_max - cursor_total + 1
|
cursor_max - cursor_total + 1
|
||||||
} else {
|
} else {
|
||||||
@@ -489,9 +475,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
write!(handle, "{}", &text[text_trimmed.len()..])?;
|
write!(handle, "{}", &text[text_trimmed.len()..])?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.config.style_components.plain() && line.bytes().next_back() != Some(b'\n') {
|
if !self.config.style_components.plain() && line.bytes().next_back() != Some(b'\n') {
|
||||||
writeln!(handle)?;
|
writeln!(handle)?;
|
||||||
@@ -499,12 +482,31 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
} else {
|
} else {
|
||||||
for &(style, region) in ®ions {
|
for &(style, region) in ®ions {
|
||||||
let ansi_iterator = AnsiCodeIterator::new(region);
|
let ansi_iterator = AnsiCodeIterator::new(region);
|
||||||
|
let mut ansi_prefix: String = String::new();
|
||||||
for chunk in ansi_iterator {
|
for chunk in ansi_iterator {
|
||||||
match chunk {
|
match chunk {
|
||||||
// ANSI escape passthrough.
|
// ANSI escape passthrough.
|
||||||
(ansi, true) => {
|
(text, true) => {
|
||||||
self.ansi_style.update(ansi);
|
let is_ansi_csi = text.starts_with("\x1B[");
|
||||||
write!(handle, "{}", ansi)?;
|
|
||||||
|
if is_ansi_csi && text.ends_with('m') {
|
||||||
|
// It's an ANSI SGR sequence.
|
||||||
|
// We should be mostly safe to just append these together.
|
||||||
|
ansi_prefix.push_str(text);
|
||||||
|
if text == "\x1B[0m" {
|
||||||
|
self.ansi_prefix_sgr = "\x1B[0m".to_owned();
|
||||||
|
} else {
|
||||||
|
self.ansi_prefix_sgr.push_str(text);
|
||||||
|
}
|
||||||
|
} else if is_ansi_csi {
|
||||||
|
// It's a regular CSI sequence.
|
||||||
|
// We should be mostly safe to just append these together.
|
||||||
|
ansi_prefix.push_str(text);
|
||||||
|
} else {
|
||||||
|
// It's probably a VT100 code.
|
||||||
|
// Passing it through is the safest bet.
|
||||||
|
write!(handle, "{}", text)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regular text.
|
// Regular text.
|
||||||
@@ -554,7 +556,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
"{}\n{}",
|
"{}\n{}",
|
||||||
as_terminal_escaped(
|
as_terminal_escaped(
|
||||||
style,
|
style,
|
||||||
&*format!("{}{}", self.ansi_style, line_buf),
|
&*format!(
|
||||||
|
"{}{}{}",
|
||||||
|
self.ansi_prefix_sgr, ansi_prefix, line_buf
|
||||||
|
),
|
||||||
self.config.true_color,
|
self.config.true_color,
|
||||||
self.config.colored_output,
|
self.config.colored_output,
|
||||||
self.config.use_italic_text,
|
self.config.use_italic_text,
|
||||||
@@ -580,13 +585,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
"{}",
|
"{}",
|
||||||
as_terminal_escaped(
|
as_terminal_escaped(
|
||||||
style,
|
style,
|
||||||
&*format!("{}{}", self.ansi_style, line_buf),
|
&*format!(
|
||||||
|
"{}{}{}",
|
||||||
|
self.ansi_prefix_sgr, ansi_prefix, line_buf
|
||||||
|
),
|
||||||
self.config.true_color,
|
self.config.true_color,
|
||||||
self.config.colored_output,
|
self.config.colored_output,
|
||||||
self.config.use_italic_text,
|
self.config.use_italic_text,
|
||||||
background_color
|
background_color
|
||||||
)
|
)
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
// Clear the ANSI prefix buffer.
|
||||||
|
ansi_prefix.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,18 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::error::Result;
|
use crate::error::Result;
|
||||||
use ignored_suffixes::IgnoredSuffixes;
|
|
||||||
|
|
||||||
use globset::{Candidate, GlobBuilder, GlobMatcher};
|
use globset::{Candidate, GlobBuilder, GlobMatcher};
|
||||||
|
|
||||||
pub mod ignored_suffixes;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
#[non_exhaustive]
|
|
||||||
pub enum MappingTarget<'a> {
|
pub enum MappingTarget<'a> {
|
||||||
/// For mapping a path to a specific syntax.
|
|
||||||
MapTo(&'a str),
|
MapTo(&'a str),
|
||||||
|
|
||||||
/// For mapping a path (typically an extension-less file name) to an unknown
|
|
||||||
/// syntax. This typically means later using the contents of the first line
|
|
||||||
/// of the file to determine what syntax to use.
|
|
||||||
MapToUnknown,
|
MapToUnknown,
|
||||||
|
|
||||||
/// For mapping a file extension (e.g. `*.conf`) to an unknown syntax. This
|
|
||||||
/// typically means later using the contents of the first line of the file
|
|
||||||
/// to determine what syntax to use. However, if a syntax handles a file
|
|
||||||
/// name that happens to have the given file extension (e.g. `resolv.conf`),
|
|
||||||
/// then that association will have higher precedence, and the mapping will
|
|
||||||
/// be ignored.
|
|
||||||
MapExtensionToUnknown,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct SyntaxMapping<'a> {
|
pub struct SyntaxMapping<'a> {
|
||||||
mappings: Vec<(GlobMatcher, MappingTarget<'a>)>,
|
mappings: Vec<(GlobMatcher, MappingTarget<'a>)>,
|
||||||
pub(crate) ignored_suffixes: IgnoredSuffixes<'a>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SyntaxMapping<'a> {
|
impl<'a> SyntaxMapping<'a> {
|
||||||
@@ -72,7 +54,12 @@ impl<'a> SyntaxMapping<'a> {
|
|||||||
// Nginx and Apache syntax files both want to style all ".conf" files
|
// Nginx and Apache syntax files both want to style all ".conf" files
|
||||||
// see #1131 and #1137
|
// see #1131 and #1137
|
||||||
mapping
|
mapping
|
||||||
.insert("*.conf", MappingTarget::MapExtensionToUnknown)
|
.insert("*.conf", MappingTarget::MapToUnknown)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
// Re-insert a mapping for resolv.conf, see #1510
|
||||||
|
mapping
|
||||||
|
.insert("resolv.conf", MappingTarget::MapTo("resolv"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
for glob in &[
|
for glob in &[
|
||||||
@@ -177,10 +164,6 @@ impl<'a> SyntaxMapping<'a> {
|
|||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_ignored_suffix(&mut self, suffix: &'a str) {
|
|
||||||
self.ignored_suffixes.add_suffix(suffix);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
use std::ffi::OsStr;
|
|
||||||
use std::fmt::Debug;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use crate::error::*;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct IgnoredSuffixes<'a> {
|
|
||||||
values: Vec<&'a str>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for IgnoredSuffixes<'_> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
values: vec![
|
|
||||||
// Editor etc backups
|
|
||||||
"~",
|
|
||||||
".bak",
|
|
||||||
".old",
|
|
||||||
".orig",
|
|
||||||
// Debian and derivatives apt/dpkg/ucf backups
|
|
||||||
".dpkg-dist",
|
|
||||||
".dpkg-old",
|
|
||||||
".ucf-dist",
|
|
||||||
".ucf-new",
|
|
||||||
".ucf-old",
|
|
||||||
// Red Hat and derivatives rpm backups
|
|
||||||
".rpmnew",
|
|
||||||
".rpmorig",
|
|
||||||
".rpmsave",
|
|
||||||
// Build system input/template files
|
|
||||||
".in",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> IgnoredSuffixes<'a> {
|
|
||||||
pub fn add_suffix(&mut self, suffix: &'a str) {
|
|
||||||
self.values.push(suffix)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn strip_suffix(&self, file_name: &'a str) -> Option<&'a str> {
|
|
||||||
for suffix in self.values.iter() {
|
|
||||||
if let Some(stripped_file_name) = file_name.strip_suffix(suffix) {
|
|
||||||
return Some(stripped_file_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// If we find an ignored suffix on the file name, e.g. '~', we strip it and
|
|
||||||
/// then try again without it.
|
|
||||||
pub fn try_with_stripped_suffix<T, F>(&self, file_name: &'a OsStr, func: F) -> Result<Option<T>>
|
|
||||||
where
|
|
||||||
F: Fn(&'a OsStr) -> Result<Option<T>>,
|
|
||||||
{
|
|
||||||
if let Some(file_str) = Path::new(file_name).to_str() {
|
|
||||||
if let Some(stripped_file_name) = self.strip_suffix(file_str) {
|
|
||||||
return func(OsStr::new(stripped_file_name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn internal_suffixes() {
|
|
||||||
let ignored_suffixes = IgnoredSuffixes::default();
|
|
||||||
|
|
||||||
let file_names = ignored_suffixes
|
|
||||||
.values
|
|
||||||
.iter()
|
|
||||||
.map(|suffix| format!("test.json{}", suffix));
|
|
||||||
for file_name_str in file_names {
|
|
||||||
let file_name = OsStr::new(&file_name_str);
|
|
||||||
let expected_stripped_file_name = OsStr::new("test.json");
|
|
||||||
let stripped_file_name = ignored_suffixes
|
|
||||||
.try_with_stripped_suffix(file_name, |stripped_file_name| Ok(Some(stripped_file_name)));
|
|
||||||
assert_eq!(
|
|
||||||
expected_stripped_file_name,
|
|
||||||
stripped_file_name.unwrap().unwrap()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn external_suffixes() {
|
|
||||||
let mut ignored_suffixes = IgnoredSuffixes::default();
|
|
||||||
ignored_suffixes.add_suffix(".development");
|
|
||||||
ignored_suffixes.add_suffix(".production");
|
|
||||||
|
|
||||||
let file_names = ignored_suffixes
|
|
||||||
.values
|
|
||||||
.iter()
|
|
||||||
.map(|suffix| format!("test.json{}", suffix));
|
|
||||||
for file_name_str in file_names {
|
|
||||||
let file_name = OsStr::new(&file_name_str);
|
|
||||||
let expected_stripped_file_name = OsStr::new("test.json");
|
|
||||||
let stripped_file_name = ignored_suffixes
|
|
||||||
.try_with_stripped_suffix(file_name, |stripped_file_name| Ok(Some(stripped_file_name)));
|
|
||||||
assert_eq!(
|
|
||||||
expected_stripped_file_name,
|
|
||||||
stripped_file_name.unwrap().unwrap()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
212
src/vscreen.rs
212
src/vscreen.rs
@@ -1,212 +0,0 @@
|
|||||||
use std::fmt::{Display, Formatter};
|
|
||||||
|
|
||||||
// Wrapper to avoid unnecessary branching when input doesn't have ANSI escape sequences.
|
|
||||||
pub struct AnsiStyle {
|
|
||||||
attributes: Option<Attributes>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AnsiStyle {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
AnsiStyle { attributes: None }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn update(&mut self, sequence: &str) -> bool {
|
|
||||||
match &mut self.attributes {
|
|
||||||
Some(a) => a.update(sequence),
|
|
||||||
None => {
|
|
||||||
self.attributes = Some(Attributes::new());
|
|
||||||
self.attributes.as_mut().unwrap().update(sequence)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for AnsiStyle {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
||||||
match self.attributes {
|
|
||||||
Some(ref a) => a.fmt(f),
|
|
||||||
None => Ok(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Attributes {
|
|
||||||
foreground: String,
|
|
||||||
background: String,
|
|
||||||
underlined: String,
|
|
||||||
|
|
||||||
/// The character set to use.
|
|
||||||
/// REGEX: `\^[()][AB0-3]`
|
|
||||||
charset: String,
|
|
||||||
|
|
||||||
/// A buffer for unknown sequences.
|
|
||||||
unknown_buffer: String,
|
|
||||||
|
|
||||||
/// ON: ^[1m
|
|
||||||
/// OFF: ^[22m
|
|
||||||
bold: String,
|
|
||||||
|
|
||||||
/// ON: ^[2m
|
|
||||||
/// OFF: ^[22m
|
|
||||||
dim: String,
|
|
||||||
|
|
||||||
/// ON: ^[4m
|
|
||||||
/// OFF: ^[24m
|
|
||||||
underline: String,
|
|
||||||
|
|
||||||
/// ON: ^[3m
|
|
||||||
/// OFF: ^[23m
|
|
||||||
italic: String,
|
|
||||||
|
|
||||||
/// ON: ^[9m
|
|
||||||
/// OFF: ^[29m
|
|
||||||
strike: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Attributes {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Attributes {
|
|
||||||
foreground: "".to_owned(),
|
|
||||||
background: "".to_owned(),
|
|
||||||
underlined: "".to_owned(),
|
|
||||||
charset: "".to_owned(),
|
|
||||||
unknown_buffer: "".to_owned(),
|
|
||||||
bold: "".to_owned(),
|
|
||||||
dim: "".to_owned(),
|
|
||||||
underline: "".to_owned(),
|
|
||||||
italic: "".to_owned(),
|
|
||||||
strike: "".to_owned(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update the attributes with an escape sequence.
|
|
||||||
/// Returns `false` if the sequence is unsupported.
|
|
||||||
pub fn update(&mut self, sequence: &str) -> bool {
|
|
||||||
let mut chars = sequence.char_indices().skip(1);
|
|
||||||
|
|
||||||
if let Some((_, t)) = chars.next() {
|
|
||||||
match t {
|
|
||||||
'(' => self.update_with_charset('(', chars.map(|(_, c)| c)),
|
|
||||||
')' => self.update_with_charset(')', chars.map(|(_, c)| c)),
|
|
||||||
'[' => {
|
|
||||||
if let Some((i, last)) = chars.last() {
|
|
||||||
// SAFETY: Always starts with ^[ and ends with m.
|
|
||||||
self.update_with_csi(last, &sequence[2..i])
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => self.update_with_unsupported(sequence),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sgr_reset(&mut self) {
|
|
||||||
self.foreground.clear();
|
|
||||||
self.background.clear();
|
|
||||||
self.underlined.clear();
|
|
||||||
self.bold.clear();
|
|
||||||
self.dim.clear();
|
|
||||||
self.underline.clear();
|
|
||||||
self.italic.clear();
|
|
||||||
self.strike.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_with_sgr(&mut self, parameters: &str) -> bool {
|
|
||||||
let mut iter = parameters
|
|
||||||
.split(';')
|
|
||||||
.map(|p| if p.is_empty() { "0" } else { p })
|
|
||||||
.map(|p| p.parse::<u16>())
|
|
||||||
.map(|p| p.unwrap_or(0)); // Treat errors as 0.
|
|
||||||
|
|
||||||
while let Some(p) = iter.next() {
|
|
||||||
match p {
|
|
||||||
0 => self.sgr_reset(),
|
|
||||||
1 => self.bold = format!("\x1B[{}m", parameters),
|
|
||||||
2 => self.dim = format!("\x1B[{}m", parameters),
|
|
||||||
3 => self.italic = format!("\x1B[{}m", parameters),
|
|
||||||
4 => self.underline = format!("\x1B[{}m", parameters),
|
|
||||||
23 => self.italic.clear(),
|
|
||||||
24 => self.underline.clear(),
|
|
||||||
22 => {
|
|
||||||
self.bold.clear();
|
|
||||||
self.dim.clear();
|
|
||||||
}
|
|
||||||
30..=39 => self.foreground = Self::parse_color(p, &mut iter),
|
|
||||||
40..=49 => self.background = Self::parse_color(p, &mut iter),
|
|
||||||
58..=59 => self.underlined = Self::parse_color(p, &mut iter),
|
|
||||||
90..=97 => self.foreground = Self::parse_color(p, &mut iter),
|
|
||||||
100..=107 => self.foreground = Self::parse_color(p, &mut iter),
|
|
||||||
_ => {
|
|
||||||
// Unsupported SGR sequence.
|
|
||||||
// Be compatible and pretend one just wasn't was provided.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_with_csi(&mut self, finalizer: char, sequence: &str) -> bool {
|
|
||||||
if finalizer == 'm' {
|
|
||||||
self.update_with_sgr(sequence)
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_with_unsupported(&mut self, sequence: &str) -> bool {
|
|
||||||
self.unknown_buffer.push_str(sequence);
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_with_charset(&mut self, kind: char, set: impl Iterator<Item = char>) -> bool {
|
|
||||||
self.charset = format!("\x1B{}{}", kind, set.take(1).collect::<String>());
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_color(color: u16, parameters: &mut dyn Iterator<Item = u16>) -> String {
|
|
||||||
match color % 10 {
|
|
||||||
8 => match parameters.next() {
|
|
||||||
Some(5) /* 256-color */ => format!("\x1B[{};5;{}m", color, join(";", 1, parameters)),
|
|
||||||
Some(2) /* 24-bit color */ => format!("\x1B[{};2;{}m", color, join(";", 3, parameters)),
|
|
||||||
Some(c) => format!("\x1B[{};{}m", color, c),
|
|
||||||
_ => "".to_owned(),
|
|
||||||
},
|
|
||||||
9 => "".to_owned(),
|
|
||||||
_ => format!("\x1B[{}m", color),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for Attributes {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"{}{}{}{}{}{}{}{}{}",
|
|
||||||
self.foreground,
|
|
||||||
self.background,
|
|
||||||
self.underlined,
|
|
||||||
self.charset,
|
|
||||||
self.bold,
|
|
||||||
self.dim,
|
|
||||||
self.underline,
|
|
||||||
self.italic,
|
|
||||||
self.strike,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn join(
|
|
||||||
delimiter: &str,
|
|
||||||
limit: usize,
|
|
||||||
iterator: &mut dyn Iterator<Item = impl ToString>,
|
|
||||||
) -> String {
|
|
||||||
iterator
|
|
||||||
.take(limit)
|
|
||||||
.map(|i| i.to_string())
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join(delimiter)
|
|
||||||
}
|
|
||||||
1
tests/benchmarks/.gitignore
vendored
1
tests/benchmarks/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/benchmark-results
|
|
||||||
33
tests/benchmarks/comparison.sh
vendored
Executable file
33
tests/benchmarks/comparison.sh
vendored
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||||
|
|
||||||
|
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||||
|
echo "'hyperfine' does not seem to be installed."
|
||||||
|
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SRC="test-src/jquery-3.3.1.js"
|
||||||
|
|
||||||
|
|
||||||
|
cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
|
||||||
|
cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
|
||||||
|
cmd_pygmentize="pygmentize -g '$SRC'"
|
||||||
|
cmd_highlight="highlight -O truecolor '$SRC'"
|
||||||
|
cmd_ccat="ccat --color=always '$SRC'"
|
||||||
|
cmd_source_highlight="source-highlight --failsafe --infer-lang -f esc -i '$SRC'"
|
||||||
|
cmd_hicat="hicat '$SRC'"
|
||||||
|
cmd_coderay="coderay '$SRC'"
|
||||||
|
cmd_rouge="rougify '$SRC'"
|
||||||
|
|
||||||
|
hyperfine --warmup 3 \
|
||||||
|
"$cmd_bat" \
|
||||||
|
"$cmd_bat_simple" \
|
||||||
|
"$cmd_pygmentize" \
|
||||||
|
"$cmd_highlight" \
|
||||||
|
"$cmd_ccat" \
|
||||||
|
"$cmd_source_highlight" \
|
||||||
|
"$cmd_hicat" \
|
||||||
|
"$cmd_coderay" \
|
||||||
|
"$cmd_rouge" \
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
122
tests/benchmarks/run-benchmarks.sh
vendored
122
tests/benchmarks/run-benchmarks.sh
vendored
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||||
|
|
||||||
# Check that Hyperfine is installed.
|
# Check that Hyperfine is installed.
|
||||||
@@ -9,53 +8,27 @@ if ! command -v hyperfine > /dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that jq is installed.
|
# Determine the target directories.
|
||||||
if ! command -v jq > /dev/null 2>&1; then
|
get_target_dir() {
|
||||||
echo "'jq' does not seem to be installed."
|
if [[ -f "$HOME/.cargo/config" ]]; then
|
||||||
echo "You can get it here: https://stedolan.github.io/jq"
|
grep 'target-dir[[:space:]]*=' "$HOME/.cargo/config" \
|
||||||
exit 1
|
| sed 's/^[[:space:]]*target-dir[[:space:]]*=//; s/^[[:space:]]*"//; s/"[[:space:]]*$//' \
|
||||||
fi
|
&& return 0
|
||||||
|
fi
|
||||||
|
|
||||||
get_cargo_target_dir() {
|
echo "../../target"
|
||||||
cargo metadata --no-deps --format-version 1 | jq -r .target_directory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
heading() {
|
TARGET_DIR="$(get_target_dir)"
|
||||||
bold=$(tput bold)$(tput setaf 220)
|
TARGET_DEBUG="${TARGET_DIR}/debug/bat"
|
||||||
normal=$(tput sgr0)
|
|
||||||
echo
|
|
||||||
printf "\n%s%s%s\n\n" "$bold" "$1" "$normal"
|
|
||||||
|
|
||||||
echo -e "\n### $1\n" >> "$REPORT"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Clean up environment
|
|
||||||
unset BAT_CACHE_PATH
|
|
||||||
unset BAT_CONFIG_DIR
|
|
||||||
unset BAT_CONFIG_PATH
|
|
||||||
unset BAT_OPTS
|
|
||||||
unset BAT_PAGER
|
|
||||||
unset BAT_STYLE
|
|
||||||
unset BAT_TABS
|
|
||||||
unset BAT_THEME
|
|
||||||
unset COLORTERM
|
|
||||||
unset NO_COLOR
|
|
||||||
unset PAGER
|
|
||||||
|
|
||||||
|
|
||||||
RESULT_DIR="benchmark-results"
|
|
||||||
REPORT="$RESULT_DIR/report.md"
|
|
||||||
|
|
||||||
TARGET_DIR="$(get_cargo_target_dir)"
|
|
||||||
TARGET_RELEASE="${TARGET_DIR}/release/bat"
|
TARGET_RELEASE="${TARGET_DIR}/release/bat"
|
||||||
|
|
||||||
WARMUP_COUNT=3
|
|
||||||
|
|
||||||
# Determine which target to benchmark.
|
# Determine which target to benchmark.
|
||||||
BAT=''
|
BAT=''
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
--system) BAT="bat" ;;
|
--system) BAT="bat" ;;
|
||||||
|
--debug) BAT="$TARGET_DEBUG" ;;
|
||||||
--release) BAT="$TARGET_RELEASE" ;;
|
--release) BAT="$TARGET_RELEASE" ;;
|
||||||
--bat=*) BAT="${arg:6}" ;;
|
--bat=*) BAT="${arg:6}" ;;
|
||||||
esac
|
esac
|
||||||
@@ -63,76 +36,37 @@ done
|
|||||||
|
|
||||||
if [[ -z "$BAT" ]]; then
|
if [[ -z "$BAT" ]]; then
|
||||||
echo "A build of 'bat' must be specified for benchmarking."
|
echo "A build of 'bat' must be specified for benchmarking."
|
||||||
echo "You can use '--system', '--release' or '--bat=path/to/bat'."
|
echo "You can use '--system', '--debug', or '--release'."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ensure that the target is built.
|
||||||
if ! command -v "$BAT" &>/dev/null; then
|
if ! command -v "$BAT" &>/dev/null; then
|
||||||
echo "Could not find the build of bat to benchmark ($BAT)."
|
echo "Could not find the build of bat to benchmark."
|
||||||
case "$BAT" in
|
case "$BAT" in
|
||||||
"bat") echo "Make you sure to symlink 'batcat' as 'bat'." ;;
|
"bat") echo "Make you sure to symlink 'batcat' as 'bat'." ;;
|
||||||
|
"$TARGET_DEBUG") echo "Make you sure to 'cargo build' first." ;;
|
||||||
"$TARGET_RELEASE") echo "Make you sure to 'cargo build --release' first." ;;
|
"$TARGET_RELEASE") echo "Make you sure to 'cargo build --release' first." ;;
|
||||||
esac
|
esac
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the benchmarks
|
# Run the benchmark.
|
||||||
mkdir -p "$RESULT_DIR"
|
echo "### Startup time"
|
||||||
rm -f "$RESULT_DIR"/*.md
|
echo
|
||||||
|
|
||||||
echo "## \`bat\` benchmark results" >> "$REPORT"
|
hyperfine --warmup 3 "$BAT"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "### Plain text"
|
||||||
|
echo
|
||||||
|
|
||||||
heading "Startup time"
|
hyperfine --warmup 3 "$(printf "%q" "$BAT") --language txt --paging=never 'test-src/jquery-3.3.1.js'"
|
||||||
hyperfine \
|
|
||||||
"$(printf "%q" "$BAT") --no-config" \
|
|
||||||
--command-name "bat" \
|
|
||||||
--warmup "$WARMUP_COUNT" \
|
|
||||||
--export-markdown "$RESULT_DIR/startup-time.md" \
|
|
||||||
--export-json "$RESULT_DIR/startup-time.json"
|
|
||||||
cat "$RESULT_DIR/startup-time.md" >> "$REPORT"
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "### Time to syntax-highlight large files"
|
||||||
|
echo
|
||||||
|
|
||||||
heading "Startup time with syntax highlighting"
|
for SRC in test-src/*; do
|
||||||
hyperfine \
|
hyperfine --warmup 3 "$(printf "%q" "$BAT") --style=full --color=always --paging=never $(printf "%q" "$SRC")"
|
||||||
"$(printf "%q" "$BAT") --no-config --color=always startup-time-src/small-CpuInfo-file.cpuinfo" \
|
|
||||||
--command-name "bat … small-CpuInfo-file.cpuinfo" \
|
|
||||||
--warmup "$WARMUP_COUNT" \
|
|
||||||
--export-markdown "$RESULT_DIR/startup-time-with-syntax-highlighting.md" \
|
|
||||||
--export-json "$RESULT_DIR/startup-time-with-syntax-highlighting.json"
|
|
||||||
cat "$RESULT_DIR/startup-time-with-syntax-highlighting.md" >> "$REPORT"
|
|
||||||
|
|
||||||
|
|
||||||
heading "Startup time with syntax with dependencies"
|
|
||||||
hyperfine \
|
|
||||||
"$(printf "%q" "$BAT") --no-config --color=always startup-time-src/small-Markdown-file.md" \
|
|
||||||
--command-name "bat … small-Markdown-file.md" \
|
|
||||||
--warmup "$WARMUP_COUNT" \
|
|
||||||
--export-markdown "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" \
|
|
||||||
--export-json "$RESULT_DIR/startup-time-with-syntax-with-dependencies.json"
|
|
||||||
cat "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" >> "$REPORT"
|
|
||||||
|
|
||||||
|
|
||||||
heading "Plain-text speed"
|
|
||||||
hyperfine \
|
|
||||||
"$(printf "%q" "$BAT") --no-config --language=txt --style=plain highlighting-speed-src/numpy_test_multiarray.py" \
|
|
||||||
--command-name 'bat … --language=txt numpy_test_multiarray.py' \
|
|
||||||
--warmup "$WARMUP_COUNT" \
|
|
||||||
--export-markdown "$RESULT_DIR/plain-text-speed.md" \
|
|
||||||
--export-json "$RESULT_DIR/plain-text-speed.json"
|
|
||||||
cat "$RESULT_DIR/plain-text-speed.md" >> "$REPORT"
|
|
||||||
|
|
||||||
|
|
||||||
for wrap in character never; do
|
|
||||||
for SRC in highlighting-speed-src/*; do
|
|
||||||
filename="$(basename "$SRC")"
|
|
||||||
|
|
||||||
heading "Syntax highlighting speed --wrap=${wrap}: \`$filename\`"
|
|
||||||
hyperfine --warmup "$WARMUP_COUNT" \
|
|
||||||
"$(printf "%q" "$BAT") --no-config --style=full --color=always --wrap=${wrap} --terminal-width=80 '$SRC'" \
|
|
||||||
--command-name "bat … ${filename}" \
|
|
||||||
--export-markdown "$RESULT_DIR/syntax-highlighting-speed-${filename}.md" \
|
|
||||||
--export-json "$RESULT_DIR/syntax-highlighting-speed-${filename}.json"
|
|
||||||
cat "$RESULT_DIR/syntax-highlighting-speed-${filename}.md" >> "$REPORT"
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
OneColor : AnotherColor
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Keep this file small, we want to measure bat startup time, not speed of Markdown highlighting!
|
|
||||||
|
|
||||||
The Markdown syntax definition references ~18 other syntaxes, so without lazy-loading, it will be slow to load.
|
|
||||||
2
tests/benchmarks/test-src/jquery-3.3.1.min.js
vendored
Normal file
2
tests/benchmarks/test-src/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
tests/examples/test.json.suffix
vendored
1
tests/examples/test.json.suffix
vendored
@@ -1 +0,0 @@
|
|||||||
{"test": "value"}
|
|
||||||
1
tests/examples/test.json~
vendored
1
tests/examples/test.json~
vendored
@@ -1 +0,0 @@
|
|||||||
{"test": "value"}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
use assert_cmd::cargo::CommandCargoExt;
|
use assert_cmd::cargo::CommandCargoExt;
|
||||||
use predicates::boolean::PredicateBooleanExt;
|
|
||||||
use predicates::{prelude::predicate, str::PredicateStrExt};
|
use predicates::{prelude::predicate, str::PredicateStrExt};
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -1226,89 +1225,3 @@ fn grid_for_file_without_newline() {
|
|||||||
)
|
)
|
||||||
.stderr("");
|
.stderr("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that ANSI passthrough is emitted properly for both wrapping and non-wrapping printer.
|
|
||||||
#[test]
|
|
||||||
fn ansi_passthrough_emit() {
|
|
||||||
for wrapping in &["never", "character"] {
|
|
||||||
bat()
|
|
||||||
.arg("--paging=never")
|
|
||||||
.arg("--color=never")
|
|
||||||
.arg("--terminal-width=80")
|
|
||||||
.arg(format!("--wrap={}", wrapping))
|
|
||||||
.arg("--decorations=always")
|
|
||||||
.arg("--style=plain")
|
|
||||||
.write_stdin("\x1B[33mColor\nColor \x1B[m\nPlain\n")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout("\x1B[33m\x1B[33mColor\n\x1B[33mColor \x1B[m\nPlain\n")
|
|
||||||
.stderr("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn ignored_suffix_arg() {
|
|
||||||
bat()
|
|
||||||
.arg("-f")
|
|
||||||
.arg("-p")
|
|
||||||
.arg("test.json~")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout("\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mtest\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;186mvalue\u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;231m}\u{1b}[0m")
|
|
||||||
.stderr("");
|
|
||||||
|
|
||||||
bat()
|
|
||||||
.arg("-f")
|
|
||||||
.arg("-p")
|
|
||||||
.arg("--ignored-suffix=.suffix")
|
|
||||||
.arg("test.json.suffix")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout("\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mtest\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;186mvalue\u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;231m}\u{1b}[0m")
|
|
||||||
.stderr("");
|
|
||||||
|
|
||||||
bat()
|
|
||||||
.arg("-f")
|
|
||||||
.arg("-p")
|
|
||||||
.arg("test.json.suffix")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout("\u{1b}[38;5;231m{\"test\": \"value\"}\u{1b}[0m")
|
|
||||||
.stderr("");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn acknowledgements() {
|
|
||||||
bat()
|
|
||||||
.arg("--acknowledgements")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout(
|
|
||||||
// Just some sanity checking that avoids names of persons, except our own Keith Hall :)
|
|
||||||
predicate::str::contains(
|
|
||||||
"Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).",
|
|
||||||
)
|
|
||||||
.and(predicate::str::contains(
|
|
||||||
"Copyright (c) 2012-2020 The Sublime CMake authors",
|
|
||||||
))
|
|
||||||
.and(predicate::str::contains(
|
|
||||||
"Copyright 2014-2015 SaltStack Team",
|
|
||||||
))
|
|
||||||
.and(predicate::str::contains(
|
|
||||||
"Copyright (c) 2013-present Dracula Theme",
|
|
||||||
))
|
|
||||||
.and(predicate::str::contains(
|
|
||||||
"## syntaxes/01_Packages/Rust/LICENSE.txt",
|
|
||||||
))
|
|
||||||
.and(predicate::str::contains(
|
|
||||||
"## syntaxes/02_Extra/http-request-response/LICENSE",
|
|
||||||
))
|
|
||||||
.and(predicate::str::contains(
|
|
||||||
"## themes/dracula-sublime/LICENSE",
|
|
||||||
))
|
|
||||||
.and(predicate::str::contains("Copyright (c) 2017 b123400"))
|
|
||||||
.and(predicate::str::contains("Copyright (c) 2021 Keith Hall"))
|
|
||||||
.and(predicate::str::contains("Copyright 2014 Clams")),
|
|
||||||
)
|
|
||||||
.stderr("");
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Make sure that we don't accidentally include GPL licenced files
|
|
||||||
gpl_term="General Public License"
|
|
||||||
gpl_excludes=(
|
|
||||||
# Snippet expands to GPL, but is not under GPL
|
|
||||||
":(exclude)assets/syntaxes/01_Packages/Matlab/Snippets/Octave-function.sublime-snippet"
|
|
||||||
|
|
||||||
# 'gpl_term' matches itself :D
|
|
||||||
":(exclude)tests/scripts/license-checks.sh"
|
|
||||||
|
|
||||||
# Contains a reference to GPL, but is not under GPL
|
|
||||||
":(exclude)tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md"
|
|
||||||
)
|
|
||||||
gpl_occurances=$(git grep --recurse-submodules "${gpl_term}" -- "${gpl_excludes[@]}" || true)
|
|
||||||
|
|
||||||
if [ -z "${gpl_occurances}" ]; then
|
|
||||||
echo "PASS: No files under GPL were found"
|
|
||||||
else
|
|
||||||
echo "FAIL: GPL:ed code is not compatible with bat, but occurances of '${gpl_term}' were found:"
|
|
||||||
echo "${gpl_occurances}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -91,7 +91,7 @@ def create_highlighted_versions(output_basepath):
|
|||||||
p.map(create_highlighted_version, sources)
|
p.map(create_highlighted_version, sources)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
print(
|
print(
|
||||||
"=== Error: Could not highlight source file:\n" + " ".join(err.cmd),
|
"=== Error: Could not highlight source file '{}".format(source),
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mObject[0m[38;2;248;248;242m([0m
|
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mObject[0m[38;2;248;248;242m([0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Not highlighted as a comment[0m
|
|
||||||
[38;2;248;248;242m )[0m
|
|
||||||
[38;2;248;248;242m)[0m
|
|
||||||
104
tests/syntax-tests/highlighted/Dart/test.dart
vendored
104
tests/syntax-tests/highlighted/Dart/test.dart
vendored
@@ -1,45 +1,45 @@
|
|||||||
[38;2;117;113;94m/* array sorting alogorithm */[0m
|
[38;2;117;113;94m/* array sorting alogorithm */[0m
|
||||||
[3;38;2;166;226;46mint[0m[38;2;248;248;242m [0m[38;2;166;226;46mpartition[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m low[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m high) {[0m
|
[3;38;2;102;217;239mint[0m[38;2;248;248;242m [0m[38;2;248;248;242mpartition[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m list, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m low, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m high)[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (list [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;249;38;114m|[0m[38;2;248;248;242m list[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (list [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;249;38;114m|[0m[38;2;248;248;242m list.length [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m pivot [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[high][0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m pivot [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[high][0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m low [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m low [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;166;226;46mswap[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m i[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m j) {[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;248;248;242mswap[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m list, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m i, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m j)[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m temp [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[i][0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m temp [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[i][0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m list[i] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[j][0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m list[i] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[j][0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m list[j] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m temp[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m list[j] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m temp[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m j [0m[38;2;249;38;114m=[0m[38;2;248;248;242m low[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j [0m[38;2;249;38;114m<[0m[38;2;248;248;242m high[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j[0m[38;2;249;38;114m++[0m[38;2;248;248;242m) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m j [0m[38;2;249;38;114m=[0m[38;2;248;248;242m low[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j [0m[38;2;249;38;114m<[0m[38;2;248;248;242m high[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j[0m[38;2;249;38;114m++[0m[38;2;248;248;242m) {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (list[j] [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m pivot) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (list[j] [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m pivot) {[0m
|
||||||
[38;2;248;248;242m i[0m[38;2;249;38;114m++[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m i[0m[38;2;249;38;114m++[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mswap[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m i[0m[38;2;248;248;242m,[0m[38;2;248;248;242m j)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m swap(list, i, j)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mswap[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m high)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m swap(list, i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, high)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;166;226;46mquickSort[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m low[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m high) {[0m
|
[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;248;248;242mquickSort[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m list, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m low, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m high)[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (low [0m[38;2;249;38;114m<[0m[38;2;248;248;242m high) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (low [0m[38;2;249;38;114m<[0m[38;2;248;248;242m high) {[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m pi [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;166;226;46mpartition[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m low[0m[38;2;248;248;242m,[0m[38;2;248;248;242m high)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m pi [0m[38;2;249;38;114m=[0m[38;2;248;248;242m partition(list, low, high)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mquickSort[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m low[0m[38;2;248;248;242m,[0m[38;2;248;248;242m pi [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m quickSort(list, low, pi [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mquickSort[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m pi [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m high)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m quickSort(list, pi [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, high)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;166;226;46mmerge[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m leftIndex[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m middleIndex[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m rightIndex) {[0m
|
[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;248;248;242mmerge[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m list, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m leftIndex, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m middleIndex, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m rightIndex)[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m leftSize [0m[38;2;249;38;114m=[0m[38;2;248;248;242m middleIndex [0m[38;2;249;38;114m-[0m[38;2;248;248;242m leftIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m leftSize [0m[38;2;249;38;114m=[0m[38;2;248;248;242m middleIndex [0m[38;2;249;38;114m-[0m[38;2;248;248;242m leftIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m rightSize [0m[38;2;249;38;114m=[0m[38;2;248;248;242m rightIndex [0m[38;2;249;38;114m-[0m[38;2;248;248;242m middleIndex[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m rightSize [0m[38;2;249;38;114m=[0m[38;2;248;248;242m rightIndex [0m[38;2;249;38;114m-[0m[38;2;248;248;242m middleIndex[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m leftList [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m(leftSize)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m leftList [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m(leftSize)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m rightList [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m(rightSize)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m rightList [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m(rightSize)[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m[38;2;248;248;242m i [0m[38;2;249;38;114m<[0m[38;2;248;248;242m leftSize[0m[38;2;248;248;242m;[0m[38;2;248;248;242m i[0m[38;2;249;38;114m++[0m[38;2;248;248;242m) leftList[i] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[leftIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m i][0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m[38;2;248;248;242m i [0m[38;2;249;38;114m<[0m[38;2;248;248;242m leftSize[0m[38;2;248;248;242m;[0m[38;2;248;248;242m i[0m[38;2;249;38;114m++[0m[38;2;248;248;242m) leftList[i] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[leftIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m i][0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m j [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j [0m[38;2;249;38;114m<[0m[38;2;248;248;242m rightSize[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j[0m[38;2;249;38;114m++[0m[38;2;248;248;242m) rightList[j] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[middleIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m j [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m j [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j [0m[38;2;249;38;114m<[0m[38;2;248;248;242m rightSize[0m[38;2;248;248;242m;[0m[38;2;248;248;242m j[0m[38;2;249;38;114m++[0m[38;2;248;248;242m) rightList[j] [0m[38;2;249;38;114m=[0m[38;2;248;248;242m list[middleIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m j [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m[38;2;248;248;242m j [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m, j [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m k [0m[38;2;249;38;114m=[0m[38;2;248;248;242m leftIndex[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m k [0m[38;2;249;38;114m=[0m[38;2;248;248;242m leftIndex[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhile[0m[38;2;248;248;242m (i [0m[38;2;249;38;114m<[0m[38;2;248;248;242m leftSize [0m[38;2;249;38;114m&[0m[38;2;249;38;114m&[0m[38;2;248;248;242m j [0m[38;2;249;38;114m<[0m[38;2;248;248;242m rightSize) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhile[0m[38;2;248;248;242m (i [0m[38;2;249;38;114m<[0m[38;2;248;248;242m leftSize [0m[38;2;249;38;114m&[0m[38;2;249;38;114m&[0m[38;2;248;248;242m j [0m[38;2;249;38;114m<[0m[38;2;248;248;242m rightSize) {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (leftList[i] [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m rightList[j]) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (leftList[i] [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m rightList[j]) {[0m
|
||||||
@@ -65,14 +65,14 @@
|
|||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;166;226;46mmergeSort[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mList[0m[38;2;248;248;242m list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m leftIndex[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m rightIndex) {[0m
|
[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;248;248;242mmergeSort[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mList[0m[38;2;248;248;242m list, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m leftIndex, [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m rightIndex)[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (leftIndex [0m[38;2;249;38;114m<[0m[38;2;248;248;242m rightIndex) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (leftIndex [0m[38;2;249;38;114m<[0m[38;2;248;248;242m rightIndex) {[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m middleIndex [0m[38;2;249;38;114m=[0m[38;2;248;248;242m (rightIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m leftIndex) [0m[38;2;249;38;114m~[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m middleIndex [0m[38;2;249;38;114m=[0m[38;2;248;248;242m (rightIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m leftIndex) [0m[38;2;249;38;114m~[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mmergeSort[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m leftIndex[0m[38;2;248;248;242m,[0m[38;2;248;248;242m middleIndex)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m mergeSort(list, leftIndex, middleIndex)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mmergeSort[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m middleIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m rightIndex)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m mergeSort(list, middleIndex [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, rightIndex)[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mmerge[0m[38;2;248;248;242m(list[0m[38;2;248;248;242m,[0m[38;2;248;248;242m leftIndex[0m[38;2;248;248;242m,[0m[38;2;248;248;242m middleIndex[0m[38;2;248;248;242m,[0m[38;2;248;248;242m rightIndex)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m merge(list, leftIndex, middleIndex, rightIndex)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
@@ -80,54 +80,54 @@
|
|||||||
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m name [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m'Voyager I'[0m[38;2;248;248;242m;[0m
|
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m name [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m'Voyager I'[0m[38;2;248;248;242m;[0m
|
||||||
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m year [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1977[0m[38;2;248;248;242m;[0m
|
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m year [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1977[0m[38;2;248;248;242m;[0m
|
||||||
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m antennaDiameter [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m3.7[0m[38;2;248;248;242m;[0m
|
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m antennaDiameter [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m3.7[0m[38;2;248;248;242m;[0m
|
||||||
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m flybyObjects [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [[0m[38;2;230;219;116m'Jupiter'[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m'Saturn'[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m'Uranus'[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m'Neptune'[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m flybyObjects [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [[0m[38;2;230;219;116m'Jupiter'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'Saturn'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'Uranus'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'Neptune'[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||||
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m image [0m[38;2;249;38;114m=[0m[38;2;248;248;242m {[0m
|
[3;38;2;102;217;239mvar[0m[38;2;248;248;242m image [0m[38;2;249;38;114m=[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m'tags'[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [[0m[38;2;230;219;116m'saturn'[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m'tags'[0m[38;2;248;248;242m: [[0m[38;2;230;219;116m'saturn'[0m[38;2;248;248;242m],[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m'url'[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m'//path/to/saturn.jpg'[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m'url'[0m[38;2;248;248;242m: [0m[38;2;230;219;116m'//path/to/saturn.jpg'[0m
|
||||||
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;117;113;94m/*classes */[0m
|
[38;2;117;113;94m/*classes */[0m
|
||||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSpacecraft[0m[38;2;248;248;242m {[0m
|
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;248;248;242mSpacecraft[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mString[0m[38;2;248;248;242m name[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mString[0m[38;2;248;248;242m name[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mDateTime[0m[38;2;248;248;242m launchDate[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m DateTime launchDate[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mSpacecraft[0m[38;2;248;248;242m([0m[38;2;255;255;255mthis[0m[38;2;248;248;242m.[0m[38;2;248;248;242mname[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mthis[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlaunchDate) {}[0m
|
[38;2;248;248;242m Spacecraft([0m[38;2;255;255;255mthis[0m[38;2;248;248;242m.name, [0m[38;2;255;255;255mthis[0m[38;2;248;248;242m.launchDate) {}[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Named constructor that forwards to the default one.[0m
|
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Named constructor that forwards to the default one.[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mSpacecraft[0m[38;2;248;248;242m.[0m[38;2;166;226;46munlaunched[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mString[0m[38;2;248;248;242m name) [0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;255;255;255mthis[0m[38;2;248;248;242m(name[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m Spacecraft.unlaunched([0m[3;38;2;102;217;239mString[0m[38;2;248;248;242m name)[0m[38;2;249;38;114m : [0m[38;2;255;255;255mthis[0m[38;2;248;248;242m(name, [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m [0m[38;2;249;38;114mget[0m[38;2;248;248;242m [0m[38;2;166;226;46mlaunchYear[0m[38;2;248;248;242m => launchDate[0m[38;2;249;38;114m?[0m[38;2;248;248;242m.[0m[38;2;248;248;242myear[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m [0m[38;2;249;38;114mget[0m[38;2;248;248;242m [0m[38;2;248;248;242mlaunchYear[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;249;38;114m>[0m[38;2;248;248;242m launchDate?.year[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;166;226;46mdescribe[0m[38;2;248;248;242m() {[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;248;248;242mdescribe[0m[38;2;248;248;242m()[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mprint[0m[38;2;248;248;242m([0m[38;2;230;219;116m'Spacecraft: $[0m[3;38;2;253;151;31mname[0m[38;2;230;219;116m'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m print([0m[38;2;230;219;116m'Spacecraft: [0m[38;2;249;38;114m$[0m[3;38;2;253;151;31mname[0m[38;2;230;219;116m'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (launchDate [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (launchDate [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m) {[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mint[0m[38;2;248;248;242m years [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mDateTime[0m[38;2;248;248;242m.[0m[38;2;166;226;46mnow[0m[38;2;248;248;242m()[0m[38;2;248;248;242m.[0m[38;2;166;226;46mdifference[0m[38;2;248;248;242m(launchDate)[0m[38;2;248;248;242m.[0m[38;2;248;248;242minDays [0m[38;2;249;38;114m~[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m365[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mint[0m[38;2;248;248;242m years [0m[38;2;249;38;114m=[0m[38;2;248;248;242m DateTime.now().difference(launchDate).inDays [0m[38;2;249;38;114m~[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m365[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mprint[0m[38;2;248;248;242m([0m[38;2;230;219;116m'Launched: $[0m[3;38;2;253;151;31mlaunchYear[0m[38;2;230;219;116m ($[0m[3;38;2;253;151;31myears[0m[38;2;230;219;116m years ago)'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m print([0m[38;2;230;219;116m'Launched: [0m[38;2;249;38;114m$[0m[3;38;2;253;151;31mlaunchYear[0m[38;2;230;219;116m ([0m[38;2;249;38;114m$[0m[3;38;2;253;151;31myears[0m[38;2;230;219;116m years ago)'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m } [0m[38;2;249;38;114melse[0m[38;2;248;248;242m {[0m
|
[38;2;248;248;242m } [0m[38;2;249;38;114melse[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mprint[0m[38;2;248;248;242m([0m[38;2;230;219;116m'Unlaunched'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m print([0m[38;2;230;219;116m'Unlaunched'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[38;2;117;113;94m/* Mixins */[0m
|
[38;2;117;113;94m/* Mixins */[0m
|
||||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mPilotedCraft[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSpacecraft[0m[38;2;248;248;242m [0m[38;2;249;38;114mwith[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mPiloted[0m[38;2;248;248;242m {[0m
|
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;248;248;242mPilotedCraft[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[38;2;248;248;242mSpacecraft[0m[38;2;248;248;242m [0m[38;2;249;38;114mwith[0m[38;2;248;248;242m [0m[38;2;248;248;242mPiloted[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[38;2;117;113;94m// ···[0m
|
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m ···[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[38;2;117;113;94m/* Interfaces and abstract classes */[0m
|
[38;2;117;113;94m/* Interfaces and abstract classes */[0m
|
||||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mMockSpaceship[0m[38;2;248;248;242m [0m[38;2;249;38;114mimplements[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSpacecraft[0m[38;2;248;248;242m {[0m
|
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;248;248;242mMockSpaceship[0m[38;2;248;248;242m [0m[38;2;249;38;114mimplements[0m[38;2;248;248;242m [0m[38;2;248;248;242mSpacecraft[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[38;2;117;113;94m// ···[0m
|
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m ···[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[38;2;117;113;94m/* async */[0m
|
[38;2;117;113;94m/* async */[0m
|
||||||
[3;38;2;166;226;46mFuture[0m[38;2;249;38;114m<[0m[3;38;2;102;217;239mvoid[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;166;226;46mprintWithDelay[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mString[0m[38;2;248;248;242m message) {[0m
|
[38;2;248;248;242mFuture[0m[38;2;249;38;114m<[0m[3;38;2;102;217;239mvoid[0m[38;2;249;38;114m>[0m[38;2;248;248;242m printWithDelay([0m[3;38;2;102;217;239mString[0m[38;2;248;248;242m message) {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mFuture[0m[38;2;248;248;242m.[0m[38;2;166;226;46mdelayed[0m[38;2;248;248;242m([0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mDuration[0m[38;2;248;248;242m(seconds[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m))[0m[38;2;248;248;242m.[0m[38;2;166;226;46mthen[0m[38;2;248;248;242m((_) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Future.delayed([0m[38;2;249;38;114mconst[0m[38;2;248;248;242m Duration(seconds: [0m[38;2;190;132;255m2[0m[38;2;248;248;242m)).then((_) {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;166;226;46mprint[0m[38;2;248;248;242m(message)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m print(message)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m })[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m })[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[3;38;2;166;226;46mStream[0m[38;2;249;38;114m<[0m[3;38;2;166;226;46mString[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;166;226;46mreport[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mSpacecraft[0m[38;2;248;248;242m craft[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mIterable[0m[38;2;249;38;114m<[0m[3;38;2;166;226;46mString[0m[38;2;249;38;114m>[0m[38;2;248;248;242m objects) [0m[38;2;249;38;114masync[0m[38;2;249;38;114m*[0m[38;2;248;248;242m {[0m
|
[38;2;248;248;242mStream[0m[38;2;249;38;114m<[0m[3;38;2;102;217;239mString[0m[38;2;249;38;114m>[0m[38;2;248;248;242m report(Spacecraft craft, Iterable[0m[38;2;249;38;114m<[0m[3;38;2;102;217;239mString[0m[38;2;249;38;114m>[0m[38;2;248;248;242m objects) [0m[38;2;249;38;114masync[0m[38;2;249;38;114m*[0m[38;2;248;248;242m {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;102;217;239mvar[0m[38;2;248;248;242m object [0m[38;2;249;38;114min[0m[38;2;248;248;242m objects) {[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m ([0m[3;38;2;102;217;239mvar[0m[38;2;248;248;242m object [0m[38;2;249;38;114min[0m[38;2;248;248;242m objects) {[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mawait[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mFuture[0m[38;2;248;248;242m.[0m[38;2;166;226;46mdelayed[0m[38;2;248;248;242m([0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mDuration[0m[38;2;248;248;242m(seconds[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m))[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mawait[0m[38;2;248;248;242m Future.delayed([0m[38;2;249;38;114mconst[0m[38;2;248;248;242m Duration(seconds: [0m[38;2;190;132;255m2[0m[38;2;248;248;242m))[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114myield[0m[38;2;248;248;242m [0m[38;2;230;219;116m'${[0m[3;38;2;253;151;31mcraft.name[0m[38;2;230;219;116m} flies by $[0m[3;38;2;253;151;31mobject[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114myield[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;249;38;114m$[0m[38;2;249;38;114m{[0m[38;2;230;219;116mcraft.name[0m[38;2;249;38;114m}[0m[38;2;230;219;116m flies by [0m[38;2;249;38;114m$[0m[3;38;2;253;151;31mobject[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;248;248;242m }[0m
|
[38;2;248;248;242m }[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
[38;2;166;226;46ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
|
||||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;166;226;46mb[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m
|
|
||||||
[38;2;249;38;114mvar[0m[38;2;248;248;242m [0m[38;2;166;226;46mc[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~>[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m
|
|
||||||
[38;2;166;226;46md[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~~>[0m
|
|
||||||
[38;2;166;226;46me[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mb[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~>[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mc[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255md[0m[38;2;248;248;242m, [0m[38;2;102;217;239me[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~~>[0m[38;2;248;248;242m [0m[38;2;190;132;255m5[0m
|
|
||||||
[38;2;166;226;46mdashes-identifier[0m[38;2;166;226;46ms[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255mb[0m[38;2;248;248;242m [0m[38;2;249;38;114m--[0m[38;2;248;248;242m [0m[38;2;255;255;255mc[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255ma-[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;255;255;255ma[0m
|
|
||||||
|
|
||||||
[38;2;246;170;17m//abc [0m[38;2;246;170;17m#[0m[38;2;246;170;17meaze [0m[38;2;246;170;17m#[0m[38;2;246;170;17m@ //[0m
|
|
||||||
[38;2;246;170;17m//[0m
|
|
||||||
[38;2;246;170;17ma [0m[38;2;246;170;17m#[0m[38;2;246;170;17mbaze[0m
|
|
||||||
[38;2;246;170;17m//[0m
|
|
||||||
|
|
||||||
[38;2;255;255;255mpubli[0m
|
|
||||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;102;217;239mit[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m\[0m[38;2;230;219;116mabc[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;166;226;46m$-[0m[38;2;166;226;46my[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m![0m[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;248;248;242m,[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m~[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mmap[0m[38;2;248;248;242m [0m[38;2;246;170;17m//a[0m[38;2;246;170;17m#[0m[38;2;246;170;17m//[0m
|
|
||||||
[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m [0m[38;2;102;217;239mthat[0m[38;2;248;248;242m [0m[38;2;249;38;114m| _[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114motherwise[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;249;38;114mimplements[0m[38;2;248;248;242m [0m[38;2;248;248;242m$[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m#[0m[38;2;230;219;116mabc [0m[38;2;230;219;116m#[0m[38;2;230;219;116m@a[0m[38;2;230;219;116m"[0m[38;2;255;255;255m)[0m
|
|
||||||
|
|
||||||
[38;2;249;38;114mswitch[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;255;255;255ma[0m[38;2;249;38;114m=>[0m[38;2;255;255;255mb[0m
|
|
||||||
[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m
|
|
||||||
|
|
||||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;255;255;255mc[0m
|
|
||||||
|
|
||||||
[38;2;166;226;46munderscores_i$[0m[38;2;166;226;46md[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
|
||||||
[38;2;246;170;17m/regexp1/[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;246;170;17m//regexp2//g[0m
|
|
||||||
[38;2;230;219;116m'[0m[38;2;230;219;116mstrings[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mstrings[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;230;219;116m\[0m[38;2;230;219;116mstrings[0m
|
|
||||||
[38;2;255;255;255m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114mtil[0m[38;2;248;248;242m [0m[38;2;190;132;255m10[0m[38;2;248;248;242m] [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mto[0m[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;248;248;242m][0m[38;2;255;255;255m)[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;248;248;242mmap[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;255;255;255m)[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;248;248;242mfilter[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m5[0m[38;2;255;255;255m)[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;248;248;242mfold[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m+[0m[3;38;2;102;217;239m)[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242msetTimeout[0m[38;2;248;248;242m [0m[38;2;102;217;239m_[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3000[0m[38;2;248;248;242m [0m[38;2;249;38;114m<|[0m[38;2;248;248;242m [0m[38;2;255;255;255mdo-stuff[0m
|
|
||||||
[38;2;102;217;239m_[0m[38;2;248;248;242m.[0m[38;2;102;217;239mmap[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;255;255;255m_abc[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;255;255;255m__[0m
|
|
||||||
|
|
||||||
|
|
||||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;255;255;255mClass[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[38;2;255;255;255mAnc-est-or[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255margs[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
|
||||||
|
|
||||||
[38;2;166;226;46mcop[0m[38;2;166;226;46my[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m, [0m[38;2;249;38;114mto[0m[38;2;248;248;242m, [0m[38;2;255;255;255mcallback[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m, [0m[38;2;255;255;255mdata[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m<-[0m[38;2;248;248;242m [0m[38;2;248;248;242mread[0m[38;2;248;248;242m [0m[38;2;255;255;255mfile[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;248;248;242mcallback[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;249;38;114m?[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m<~[0m[38;2;248;248;242m [0m[38;2;248;248;242mwrite[0m[38;2;248;248;242m [0m[38;2;255;255;255mfile[0m[38;2;248;248;242m, [0m[38;2;255;255;255mdata[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;248;248;242mcallback[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;249;38;114m?[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;248;248;242mcallback[0m[38;2;248;248;242m([0m[38;2;255;255;255m)[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242m$[0m[38;2;248;248;242m([0m[38;2;230;219;116m\[0m[38;2;230;219;116m#gafBr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtext[0m[38;2;248;248;242m [0m[38;2;255;255;255m$t[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfmtFloat[0m[38;2;248;248;242m([0m[38;2;255;255;255mefb[0m[38;2;248;248;242m.[0m[38;2;255;255;255mgaf[0m[38;2;255;255;255m)[0m
|
|
||||||
|
|
||||||
[3;38;2;102;217;239m->[0m
|
|
||||||
[3;38;2;102;217;239m~>[0m
|
|
||||||
[3;38;2;102;217;239m~~>[0m
|
|
||||||
[3;38;2;102;217;239m-->[0m
|
|
||||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Comment[0m
|
|
||||||
[38;2;117;113;94m/*[0m[38;2;117;113;94m Comment [0m[38;2;117;113;94m*/[0m
|
|
||||||
[38;2;117;113;94m#[0m[38;2;117;113;94m error, data <- read file[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;117;113;94m/*[0m[38;2;117;113;94m error, data <- read file [0m[38;2;117;113;94m*/[0m
|
|
||||||
|
|
||||||
[38;2;166;226;46mad[0m[38;2;166;226;46md[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;248;248;242ma[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mb[0m[38;2;249;38;114m=[0m[38;2;190;132;255m2[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m
|
|
||||||
[38;2;248;248;242madd[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m
|
|
||||||
[38;2;248;248;242mdo-stuff[0m[38;2;249;38;114m![0m
|
|
||||||
[38;2;255;255;255mdo-stuff[0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m
|
|
||||||
[38;2;248;248;242mdo-stuff[0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
|
||||||
[38;2;255;255;255mdo-stuff[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
|
||||||
[38;2;255;255;255m@[0m[38;2;248;248;242mdo-stuff[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m
|
|
||||||
[38;2;255;255;255m@[0m[38;2;255;255;255mdo-stuff[0m[38;2;248;248;242m [0m[38;2;249;38;114m/[0m[38;2;190;132;255m1[0m
|
|
||||||
[38;2;248;248;242ma[0m[38;2;248;248;242m [0m[38;2;248;248;242mb[0m[38;2;248;248;242m [0m[38;2;255;255;255mc[0m[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;255;255;255md[0m[38;2;248;248;242m [0m[38;2;249;38;114m<|[0m[38;2;248;248;242m [0m[38;2;248;248;242me[0m[38;2;248;248;242m [0m[38;2;248;248;242mf[0m[38;2;248;248;242m([0m[38;2;255;255;255mg[0m[38;2;255;255;255m)[0m
|
|
||||||
[38;2;230;219;116m'[0m[38;2;230;219;116mcats[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mcats[0m[38;2;230;219;116m'[0m
|
|
||||||
[38;2;230;219;116m'[0m[38;2;230;219;116mcats[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114m`[0m[38;2;102;217;239m_[0m[38;2;248;248;242m.[0m[38;2;248;248;242mis-insensitive[0m[38;2;249;38;114m`[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mCATS[0m[38;2;230;219;116m'[0m
|
|
||||||
[38;2;248;248;242msetTimeout[0m[38;2;248;248;242m [0m[38;2;102;217;239m_[0m[38;2;248;248;242m, [0m[38;2;190;132;255m1000[0m[38;2;248;248;242m [0m[38;2;249;38;114m<|[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m!->[0m[38;2;248;248;242m [0m[38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlog[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mWho summoned me[0m[38;2;230;219;116m'[0m
|
|
||||||
[38;2;248;248;242mprivate-list[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114myield[0m[38;2;248;248;242m [0m[38;2;255;255;255m@[0m[38;2;248;248;242mget-private-list[0m[38;2;249;38;114m![0m
|
|
||||||
[38;2;249;38;114mswitch[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m#[0m[38;2;230;219;116m@@spaghetti[0m[38;2;230;219;116m"[0m
|
|
||||||
[3;38;2;102;217;239m~function[0m[38;2;248;248;242m [0m[38;2;166;226;46madd[0m[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mb[0m[38;2;249;38;114m=[0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m
|
|
||||||
[38;2;255;255;255mrow[0m[38;2;248;248;242m.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m.[0m[38;2;255;255;255m_id[0m
|
|
||||||
[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[38;2;166;226;46mSpaghetti[0m
|
|
||||||
[38;2;255;255;255m([0m[38;2;249;38;114m++[0m[38;2;255;255;255ma[0m[38;2;249;38;114m++[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;249;38;114m++[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m++[0m[38;2;255;255;255m)[0m
|
|
||||||
[3;38;2;102;217;239m([0m[38;2;248;248;242m.[0m[38;2;255;255;255mcool[0m[38;2;248;248;242m.[0m[3;38;2;102;217;239m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[3;38;2;102;217;239m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[3;38;2;102;217;239m)[0m
|
|
||||||
[38;2;255;255;255m([0m[38;2;248;248;242mina[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[3;38;2;102;217;239m)[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;255;255;255m)[0m
|
|
||||||
[38;2;255;255;255m([0m[38;2;255;255;255mina[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;255;255;255m$a[0m[38;2;255;255;255m)[0m
|
|
||||||
[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;255;255;255mis-in[0m[38;2;255;255;255m)[0m
|
|
||||||
[3;38;2;102;217;239m([0m[38;2;249;38;114min[0m[3;38;2;102;217;239m)[0m
|
|
||||||
[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[3;38;2;102;217;239m([0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m([0m[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
[38;2;253;151;31m=[0m[38;2;253;151;31m Heading 1 [0m[38;2;253;151;31m=[0m
|
|
||||||
[38;2;253;151;31m==[0m[38;2;253;151;31m Heading 2 [0m[38;2;253;151;31m==[0m
|
|
||||||
[38;2;253;151;31m===[0m[38;2;253;151;31m Heading 3 [0m[38;2;253;151;31m===[0m
|
|
||||||
[38;2;253;151;31m====[0m[38;2;253;151;31m Heading 4 [0m[38;2;253;151;31m====[0m
|
|
||||||
[38;2;253;151;31m=====[0m[38;2;253;151;31m Heading 5 [0m[38;2;253;151;31m=====[0m
|
|
||||||
[38;2;248;248;242m====== Heading 6 ======[0m
|
|
||||||
|
|
||||||
[38;2;253;151;31m==[0m[38;2;253;151;31m Lists [0m[38;2;253;151;31m==[0m
|
|
||||||
[38;2;248;248;242m*[0m[38;2;248;248;242m Unordered[0m
|
|
||||||
[38;2;248;248;242m*[0m[38;2;248;248;242m lists[0m
|
|
||||||
[38;2;248;248;242m**[0m[38;2;248;248;242m with nested[0m
|
|
||||||
[38;2;248;248;242m***[0m[38;2;248;248;242m elements[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242m#[0m[38;2;248;248;242m Ordered[0m
|
|
||||||
[38;2;248;248;242m#[0m[38;2;248;248;242m lists[0m
|
|
||||||
[38;2;248;248;242m##[0m[38;2;248;248;242m with nested[0m
|
|
||||||
[38;2;248;248;242m###[0m[38;2;248;248;242m elements[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242m;[0m[38;2;248;248;242m Description [0m[38;2;248;248;242m:[0m[38;2;248;248;242m lists with single definition[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242m;[0m[38;2;248;248;242m Description[0m
|
|
||||||
[38;2;248;248;242m:[0m[38;2;248;248;242m lists[0m
|
|
||||||
[38;2;248;248;242m:[0m[38;2;248;248;242m with more[0m
|
|
||||||
[38;2;248;248;242m:[0m[38;2;248;248;242m definitions[0m
|
|
||||||
|
|
||||||
[38;2;253;151;31m==[0m[38;2;253;151;31m Text formatting [0m[38;2;253;151;31m==[0m
|
|
||||||
[38;2;248;248;242m''[0m[3;38;2;228;46;112mitalic text[0m[38;2;248;248;242m''[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242m'''[0m[1;38;2;249;38;114mbold text[0m[38;2;248;248;242m'''[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242m'''[0m[1;38;2;249;38;114m''[0m[3;38;2;228;46;112mbold italic text[0m[1;38;2;249;38;114m''[0m[38;2;248;248;242m'''[0m
|
|
||||||
|
|
||||||
[38;2;253;151;31m==[0m[38;2;253;151;31m Links [0m[38;2;253;151;31m==[0m
|
|
||||||
[38;2;248;248;242m[[0m[4;38;2;166;226;46mhttps://www.wikipedia.org/[0m[38;2;248;248;242m [0m[38;2;230;219;116mWikipedia[0m[38;2;248;248;242m][0m
|
|
||||||
|
|
||||||
[38;2;253;151;31m==[0m[38;2;253;151;31m Images [0m[38;2;253;151;31m==[0m
|
|
||||||
[38;2;248;248;242m[[[0m[38;2;190;132;255mFile[0m[38;2;255;255;255m:[0m[38;2;190;132;255mMediaWiki-2020-logo.svg[0m[38;2;255;255;255m|[0m[38;2;249;38;114mthumb[0m[38;2;255;255;255m|[0m[38;2;230;219;116mMediaWiki logo[0m[38;2;248;248;242m]][0m
|
|
||||||
@@ -20,6 +20,6 @@
|
|||||||
[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mPath does not contain Rust[0m[38;2;230;219;116m'[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mPath does not contain Rust[0m[38;2;230;219;116m'[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[38;2;248;248;242m([0m[38;2;190;132;255m5[0m[38;2;249;38;114m..[0m[38;2;190;132;255m30[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m-eq[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;230;219;116m"[0m[38;2;230;219;116mIn {0} minutes, the time will be {1}.[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m-f[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m_[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;249;38;114m$[0m[38;2;248;248;242m([0m[38;2;248;248;242m [0m[38;2;102;217;239mGet-FutureTime[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m_[0m[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m}[0m
|
[38;2;248;248;242m([0m[38;2;190;132;255m5[0m[38;2;249;38;114m..[0m[38;2;190;132;255m30[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m-eq[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;230;219;116m"[0m[38;2;230;219;116mIn {0} minutes, the time will be {1}.[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m-f[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m_[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m([0m[38;2;248;248;242m [0m[38;2;102;217;239mGet-FutureTime[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;248;248;242m_[0m[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m}[0m
|
||||||
[38;2;255;255;255m$[0m[38;2;255;255;255mlater[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mGet-FutureTime[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mMinutes [0m[38;2;249;38;114m$[0m[38;2;248;248;242m([0m[38;2;248;248;242m [0m[38;2;102;217;239mGet-Random[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mMinimum [0m[38;2;190;132;255m60[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mMaximum [0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[38;2;248;248;242m)[0m
|
[38;2;255;255;255m$[0m[38;2;255;255;255mlater[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mGet-FutureTime[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mMinutes [0m[38;2;255;255;255m$[0m[38;2;248;248;242m([0m[38;2;248;248;242m [0m[38;2;102;217;239mGet-Random[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mMinimum [0m[38;2;190;132;255m60[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mMaximum [0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[38;2;248;248;242m)[0m
|
||||||
[38;2;230;219;116m"[0m[38;2;230;219;116mThe time will be [0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mlater[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m later.[0m[38;2;230;219;116m"[0m
|
[38;2;230;219;116m"[0m[38;2;230;219;116mThe time will be [0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mlater[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m later.[0m[38;2;230;219;116m"[0m
|
||||||
|
|||||||
8
tests/syntax-tests/highlighted/RequirementsTXT/requirements.txt
vendored
Normal file
8
tests/syntax-tests/highlighted/RequirementsTXT/requirements.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94mthis is a sample requirements.txt file[0m
|
||||||
|
|
||||||
|
[38;2;230;219;116mdjango[0m[38;2;249;38;114m==[0m[38;2;190;132;255m11.2.0[0m
|
||||||
|
[38;2;230;219;116mpywheels[0m[38;2;249;38;114m>=[0m[38;2;190;132;255m12.4[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94ma whitespace followed by comments[0m
|
||||||
|
[38;2;230;219;116mNuitka[0m[38;2;249;38;114m<[0m[38;2;190;132;255m0.6.8.4[0m
|
||||||
|
[38;2;230;219;116mwxPython[0m[38;2;249;38;114m>=[0m[38;2;190;132;255m1.0[0m[38;2;248;248;242m, [0m[38;2;249;38;114m<[0m[38;2;248;248;242m=[0m[38;2;190;132;255m2.1[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94mthis is another comment[0m
|
||||||
32
tests/syntax-tests/highlighted/SCSS/example.scss
vendored
32
tests/syntax-tests/highlighted/SCSS/example.scss
vendored
@@ -1,20 +1,20 @@
|
|||||||
[38;2;249;38;114m@[0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mfonts[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
[38;2;249;38;114m@[0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mfonts[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_dark[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_dark[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;230;219;116mnull[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
||||||
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_main[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_main[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-size[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m3[0m[38;2;190;132;255mem[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-size[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m3[0m[38;2;249;38;114mem[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;102;217;239mblack[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;102;217;239mblack[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m36ad[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m36ad[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-background[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255md6f[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-background[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255md6f[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m11121212[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m11121212[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-padding[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m1[0m[38;2;190;132;255mrem[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-padding[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m1[0m[38;2;249;38;114mrem[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-margin[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m0[0m[38;2;190;132;255m.[0m[38;2;190;132;255m5[0m[38;2;190;132;255min[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-margin[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m0[0m[38;2;190;132;255m.[0m[38;2;190;132;255m5[0m[38;2;249;38;114min[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-width[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m600[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-width[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m600[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-height[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m100[0m[38;2;190;132;255mvh[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-height[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m100[0m[38;2;249;38;114mvh[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255mdedbef[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255mdedbef[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mi-ran-out-of-placeholders-for-units[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;255;255;255m([0m[38;2;190;132;255m1[0m[38;2;190;132;255mvw[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;190;132;255m%[0m[38;2;248;248;242m [0m[38;2;190;132;255m60[0m[38;2;190;132;255mpt[0m[38;2;255;255;255m)[0m[38;2;248;248;242m,[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mi-ran-out-of-placeholders-for-units[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;255;255;255m([0m[38;2;190;132;255m1[0m[38;2;249;38;114mvw[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;190;132;255m60[0m[38;2;249;38;114mpt[0m[38;2;255;255;255m)[0m[38;2;248;248;242m,[0m
|
||||||
[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
||||||
|
|
||||||
[38;2;255;255;255m$[0m[38;2;248;248;242mcurrent_theme[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mtheme_main[0m[38;2;255;255;255m;[0m
|
[38;2;255;255;255m$[0m[38;2;248;248;242mcurrent_theme[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mtheme_main[0m[38;2;255;255;255m;[0m
|
||||||
@@ -51,12 +51,12 @@
|
|||||||
[38;2;248;248;242m [0m[38;2;249;38;114mheader[0m[38;2;248;248;242m[[0m[38;2;166;226;46mdata-selectable[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mfalse[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mheader[0m[38;2;248;248;242m[[0m[38;2;166;226;46mdata-selectable[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mfalse[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46m-webkit-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;166;226;46m-webkit-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;255;255;255m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46m-moz-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;166;226;46m-moz-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;255;255;255m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46m-ms-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;249;38;114m/[0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;230;219;116mCSS[0m[38;2;248;248;242m [0m[38;2;230;219;116mcomment[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;166;226;46m-ms-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;117;113;94m/*[0m[38;2;117;113;94m CSS comment [0m[38;2;117;113;94m*/[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;255;255;255m;[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcursor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mdefault[0m[38;2;248;248;242m [0m[38;2;249;38;114m!important[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m SCSS comment[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mcursor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mdefault[0m[38;2;248;248;242m [0m[38;2;249;38;114m!important[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m SCSS comment[0m
|
||||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||||
[38;2;248;248;242m [0m
|
[38;2;248;248;242m [0m
|
||||||
[38;2;248;248;242m [0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;249;38;114mdiv[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;248;248;242m [0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;249;38;114mdiv[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mborder[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m04f[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;102;217;239msolid[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mborder[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m04f[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;102;217;239msolid[0m[38;2;255;255;255m;[0m
|
||||||
[38;2;248;248;242m [0m
|
[38;2;248;248;242m [0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;166;226;46m::[0m[38;2;166;226;46mafter[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;166;226;46m::[0m[38;2;166;226;46mafter[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcontent[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mPseudo[0m[38;2;230;219;116m'[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mcontent[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mPseudo[0m[38;2;230;219;116m'[0m[38;2;255;255;255m;[0m
|
||||||
@@ -67,12 +67,12 @@
|
|||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[38;2;249;38;114m@[0m[38;2;249;38;114mkeyframes[0m[38;2;248;248;242m [0m[38;2;166;226;46mrotate[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;249;38;114m@[0m[38;2;249;38;114mkeyframes[0m[38;2;248;248;242m [0m[38;2;166;226;46mrotate[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;190;132;255mdeg[0m[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;249;38;114mdeg[0m[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
||||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;190;132;255m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m180[0m[38;2;190;132;255mdeg[0m[38;2;255;255;255m)[0m[38;2;248;248;242m}[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m180[0m[38;2;249;38;114mdeg[0m[38;2;255;255;255m)[0m[38;2;248;248;242m}[0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;190;132;255m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;190;132;255mrad[0m[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m[38;2;248;248;242m}[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;249;38;114mrad[0m[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m[38;2;248;248;242m}[0m
|
||||||
[38;2;248;248;242m}[0m
|
[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
[38;2;249;38;114m@[0m[38;2;249;38;114mfont-face[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
[38;2;249;38;114m@[0m[38;2;249;38;114mfont-face[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
|||||||
36
tests/syntax-tests/highlighted/Sass/example.sass
vendored
36
tests/syntax-tests/highlighted/Sass/example.sass
vendored
@@ -1,22 +1,22 @@
|
|||||||
[38;2;249;38;114m@[0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mfonts[0m[38;2;230;219;116m"[0m
|
[38;2;249;38;114m@[0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mfonts[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_dark[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_dark[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255mnull[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;230;219;116mnull[0m
|
||||||
[38;2;255;255;255m)[0m
|
[38;2;255;255;255m)[0m
|
||||||
|
|
||||||
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_main[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
[38;2;255;255;255m$[0m[38;2;248;248;242mtheme_main[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-size[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m3[0m[38;2;190;132;255mem[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-size[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m3[0m[38;2;249;38;114mem[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;102;217;239mblack[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;102;217;239mblack[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m36ad[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;190;132;255mpx[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mtext-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m36ad[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;249;38;114mpx[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-background[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255md6f[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-background[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255md6f[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m11121212[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;190;132;255mpx[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-shadow[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255m11121212[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mpx[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-padding[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m1[0m[38;2;190;132;255mrem[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-padding[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m1[0m[38;2;249;38;114mrem[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-margin[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m0[0m[38;2;190;132;255m.[0m[38;2;190;132;255m5[0m[38;2;190;132;255min[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcard-margin[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m0[0m[38;2;190;132;255m.[0m[38;2;190;132;255m5[0m[38;2;249;38;114min[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-width[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m600[0m[38;2;190;132;255mpx[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-width[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m600[0m[38;2;249;38;114mpx[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-height[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m100[0m[38;2;190;132;255mvh[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mimage-height[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m100[0m[38;2;249;38;114mvh[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255mdedbef[0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbackground-color[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;190;132;255m#[0m[38;2;190;132;255mdedbef[0m
|
||||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mi-ran-out-of-placeholders-for-units[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;255;255;255m([0m
|
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mi-ran-out-of-placeholders-for-units[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;255;255;255m([0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;190;132;255mvw[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;190;132;255m%[0m[38;2;248;248;242m [0m[38;2;190;132;255m60[0m[38;2;190;132;255mpt[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mvw[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m[38;2;248;248;242m [0m[38;2;190;132;255m60[0m[38;2;249;38;114mpt[0m
|
||||||
[38;2;248;248;242m [0m[38;2;255;255;255m)[0m
|
[38;2;248;248;242m [0m[38;2;255;255;255m)[0m
|
||||||
[38;2;255;255;255m)[0m
|
[38;2;255;255;255m)[0m
|
||||||
|
|
||||||
@@ -49,12 +49,12 @@
|
|||||||
[38;2;248;248;242m [0m[38;2;249;38;114mheader[0m[38;2;248;248;242m[[0m[38;2;166;226;46mdata-selectable[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mfalse[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mheader[0m[38;2;248;248;242m[[0m[38;2;166;226;46mdata-selectable[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mfalse[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46m-webkit-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m
|
[38;2;248;248;242m [0m[3;38;2;166;226;46m-webkit-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46m-moz-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m
|
[38;2;248;248;242m [0m[3;38;2;166;226;46m-moz-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;166;226;46m-ms-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;249;38;114m/[0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;230;219;116mCSS[0m[38;2;248;248;242m [0m[38;2;230;219;116mcomment[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m
|
[38;2;248;248;242m [0m[3;38;2;166;226;46m-ms-[0m[3;38;2;102;217;239muser-select[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;117;113;94m/*[0m[38;2;117;113;94m CSS comment [0m[38;2;117;113;94m*/[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcursor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mdefault[0m[38;2;248;248;242m [0m[38;2;249;38;114m!important[0m[38;2;248;248;242m [0m[38;2;249;38;114m/[0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;230;219;116mSass[0m[38;2;248;248;242m [0m[38;2;230;219;116mcomment[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mcursor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mdefault[0m[38;2;248;248;242m [0m[38;2;249;38;114m!important[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Sass comment[0m
|
||||||
|
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;249;38;114mdiv[0m
|
[38;2;248;248;242m [0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;249;38;114mdiv[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mborder[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m04f[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;190;132;255mpx[0m[38;2;248;248;242m [0m[38;2;102;217;239msolid[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mborder[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m04f[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mpx[0m[38;2;248;248;242m [0m[38;2;102;217;239msolid[0m
|
||||||
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;166;226;46m::[0m[38;2;166;226;46mafter[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;166;226;46m::[0m[38;2;166;226;46mafter[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcontent[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mPseudo[0m[38;2;230;219;116m"[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mcontent[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mPseudo[0m[38;2;230;219;116m"[0m
|
||||||
@@ -62,12 +62,12 @@
|
|||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mbox-sizing[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mborder-box[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mbox-sizing[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mborder-box[0m
|
||||||
|
|
||||||
[38;2;249;38;114m@[0m[38;2;249;38;114mkeyframes[0m[38;2;248;248;242m [0m[38;2;166;226;46mrotate[0m
|
[38;2;249;38;114m@[0m[38;2;249;38;114mkeyframes[0m[38;2;248;248;242m [0m[38;2;166;226;46mrotate[0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255m%[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m%[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;190;132;255mdeg[0m[38;2;255;255;255m)[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;249;38;114mdeg[0m[38;2;255;255;255m)[0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;190;132;255m%[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;249;38;114m%[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m180[0m[38;2;190;132;255mdeg[0m[38;2;255;255;255m)[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m180[0m[38;2;249;38;114mdeg[0m[38;2;255;255;255m)[0m
|
||||||
[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;190;132;255m%[0m
|
[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;190;132;255mrad[0m[38;2;255;255;255m)[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mtransform[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrotate[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;249;38;114mrad[0m[38;2;255;255;255m)[0m
|
||||||
|
|
||||||
[38;2;249;38;114m@[0m[38;2;249;38;114mfont-face[0m
|
[38;2;249;38;114m@[0m[38;2;249;38;114mfont-face[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfont-family[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mExample Font[0m[38;2;230;219;116m"[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mfont-family[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mExample Font[0m[38;2;230;219;116m"[0m
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
[38;2;248;248;242m [0m[38;2;248;248;242monMount[0m[38;2;255;255;255m([0m[38;2;255;255;255mhashchange[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
[38;2;248;248;242m [0m[38;2;248;248;242monMount[0m[38;2;255;255;255m([0m[38;2;255;255;255mhashchange[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
[38;2;255;255;255m</[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
[38;2;255;255;255m</[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
||||||
|
|
||||||
[38;2;255;255;255m<[0m[3;38;2;249;38;114mscript[0m[38;2;248;248;242m [0m[38;2;166;226;46mtype[0m[38;2;166;226;46m=[0m[38;2;255;255;255m"[0m[38;2;230;219;116mtext/livescript[0m[38;2;255;255;255m"[0m[38;2;255;255;255m>[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;246;170;17m// This block is a regression test for a bat panic when a LiveScript syntax definition is missing[0m
|
|
||||||
[38;2;255;255;255m</[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
|
||||||
|
|
||||||
[38;2;255;255;255m<[0m[38;2;249;38;114mstyle[0m[38;2;255;255;255m>[0m
|
[38;2;255;255;255m<[0m[38;2;249;38;114mstyle[0m[38;2;255;255;255m>[0m
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mmain[0m[38;2;248;248;242m [0m[38;2;255;255;255m{[0m
|
[38;2;248;248;242m [0m[38;2;249;38;114mmain[0m[38;2;248;248;242m [0m[38;2;255;255;255m{[0m
|
||||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mposition[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrelative[0m[38;2;255;255;255m;[0m
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mposition[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrelative[0m[38;2;255;255;255m;[0m
|
||||||
|
|||||||
23
tests/syntax-tests/highlighted/nim/test.nimble
vendored
23
tests/syntax-tests/highlighted/nim/test.nimble
vendored
@@ -1,23 +0,0 @@
|
|||||||
[38;2;248;248;242mversion = [0m[38;2;230;219;116m"0.1.0"[0m
|
|
||||||
[38;2;248;248;242mauthor = [0m[38;2;230;219;116m"creator_name"[0m
|
|
||||||
[38;2;248;248;242mdescription = [0m[38;2;230;219;116m"Tests nimble syntax highlighting"[0m
|
|
||||||
[38;2;248;248;242mlicense = [0m[38;2;230;219;116m"custom"[0m
|
|
||||||
|
|
||||||
[38;2;248;248;242mbin = @[[0m[38;2;230;219;116m"test"[0m[38;2;248;248;242m][0m
|
|
||||||
[38;2;248;248;242msrcdir = [0m[38;2;230;219;116m"src"[0m
|
|
||||||
[38;2;248;248;242minstallExt = @[[0m[38;2;230;219;116m"nim"[0m[38;2;248;248;242m][0m
|
|
||||||
|
|
||||||
[38;2;117;113;94m# [0m[38;2;117;113;94mDependencies[0m
|
|
||||||
|
|
||||||
[38;2;102;217;239mrequires[0m[38;2;248;248;242m [0m[38;2;230;219;116m"nim >= 1.6.2"[0m
|
|
||||||
|
|
||||||
[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mdefined[0m[38;2;248;248;242m(nimdistros)[0m[38;2;249;38;114m:[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mimport[0m[38;2;248;248;242m distros[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;102;217;239mdetectOs[0m[38;2;248;248;242m([0m[3;38;2;166;226;46mUbuntu[0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;102;217;239mforeignDep[0m[38;2;248;248;242m [0m[38;2;230;219;116m"external_lib"[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m:[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;102;217;239mforeignDep[0m[38;2;248;248;242m [0m[38;2;230;219;116m"other_lib"[0m
|
|
||||||
|
|
||||||
[38;2;102;217;239mtask[0m[38;2;248;248;242m test, [0m[38;2;230;219;116m"Runs a task called 'test'"[0m[38;2;249;38;114m:[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;102;217;239mwithDir[0m[38;2;248;248;242m [0m[38;2;230;219;116m"tests"[0m[38;2;249;38;114m:[0m
|
|
||||||
[38;2;248;248;242m [0m[38;2;102;217;239mexec[0m[38;2;248;248;242m [0m[38;2;230;219;116m"nim c -r tester"[0m
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
return Object(
|
|
||||||
Object(
|
|
||||||
// Not highlighted as a comment
|
|
||||||
)
|
|
||||||
)
|
|
||||||
23
tests/syntax-tests/source/LiveScript/LICENSE.md
vendored
23
tests/syntax-tests/source/LiveScript/LICENSE.md
vendored
@@ -1,23 +0,0 @@
|
|||||||
The `livescript-demo.ls` file has been added from https://github.com/paulmillr/LiveScript.tmbundle under the following license:
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2012 Paul Miller (http://paulmillr.com/), Jeremy Ashkenas
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
a = -> 1
|
|
||||||
const b = --> 2
|
|
||||||
var c = ~> 3
|
|
||||||
d = ~~>
|
|
||||||
e = (a) -> (b) ~> (c) --> (d, e) ~~> 5
|
|
||||||
dashes-identifiers = ->
|
|
||||||
a - a
|
|
||||||
b -- c
|
|
||||||
1-1 1- -1
|
|
||||||
a- a
|
|
||||||
a -a
|
|
||||||
|
|
||||||
//abc #eaze #@ //
|
|
||||||
//
|
|
||||||
a #baze
|
|
||||||
//
|
|
||||||
|
|
||||||
publi
|
|
||||||
if it is \abc and ($-y = !(a,) ->) ~= map //a#//
|
|
||||||
then match that | _ | otherwise => implements $("#abc #@a")
|
|
||||||
|
|
||||||
switch |a=>b
|
|
||||||
| a then b
|
|
||||||
|
|
||||||
if a => b else c
|
|
||||||
|
|
||||||
underscores_i$d = ->
|
|
||||||
/regexp1/ and //regexp2//g
|
|
||||||
'strings' and "strings" and \strings
|
|
||||||
([2 til 10] or [1 to 50])
|
|
||||||
|> map (* 2)
|
|
||||||
|> filter (> 5)
|
|
||||||
|> fold (+)
|
|
||||||
|
|
||||||
setTimeout _, 3000 <| do-stuff
|
|
||||||
_.map; _abc; __
|
|
||||||
|
|
||||||
|
|
||||||
class Class extends Anc-est-or
|
|
||||||
(args) ->
|
|
||||||
|
|
||||||
copy = (from, to, callback) -->
|
|
||||||
error, data <- read file
|
|
||||||
return callback error if error?
|
|
||||||
error <~ write file, data
|
|
||||||
return callback error if error?
|
|
||||||
callback()
|
|
||||||
|
|
||||||
$(\#gafBr).text $t.fmtFloat(efb.gaf)
|
|
||||||
|
|
||||||
->
|
|
||||||
~>
|
|
||||||
~~>
|
|
||||||
-->
|
|
||||||
# Comment
|
|
||||||
/* Comment */
|
|
||||||
# error, data <- read file
|
|
||||||
/* error, data <- read file */
|
|
||||||
|
|
||||||
add = (a=1, b=2) --> a + b
|
|
||||||
add 1 2
|
|
||||||
do-stuff!
|
|
||||||
do-stuff? #
|
|
||||||
do-stuff? 1
|
|
||||||
do-stuff + 1
|
|
||||||
@do-stuff +1
|
|
||||||
@do-stuff /1
|
|
||||||
a b c |> d <| e f(g)
|
|
||||||
'cats' is 'cats'
|
|
||||||
'cats' `_.is-insensitive` 'CATS'
|
|
||||||
setTimeout _, 1000 <| !-> console.log 'Who summoned me'
|
|
||||||
private-list = yield @get-private-list!
|
|
||||||
switch | true => "#@@spaghetti"
|
|
||||||
~function add a=1, b=2 => a + b
|
|
||||||
row.0._id
|
|
||||||
new Spaghetti
|
|
||||||
(++a++) (++ 2 ++)
|
|
||||||
(.cool.) (+ a -) (/ 2 *)
|
|
||||||
(ina -a in) (-> a)
|
|
||||||
(ina in$a)
|
|
||||||
(a is-in)
|
|
||||||
(in)
|
|
||||||
((((((+ a((a))))))))
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
= Heading 1 =
|
|
||||||
== Heading 2 ==
|
|
||||||
=== Heading 3 ===
|
|
||||||
==== Heading 4 ====
|
|
||||||
===== Heading 5 =====
|
|
||||||
====== Heading 6 ======
|
|
||||||
|
|
||||||
== Lists ==
|
|
||||||
* Unordered
|
|
||||||
* lists
|
|
||||||
** with nested
|
|
||||||
*** elements
|
|
||||||
|
|
||||||
# Ordered
|
|
||||||
# lists
|
|
||||||
## with nested
|
|
||||||
### elements
|
|
||||||
|
|
||||||
; Description : lists with single definition
|
|
||||||
|
|
||||||
; Description
|
|
||||||
: lists
|
|
||||||
: with more
|
|
||||||
: definitions
|
|
||||||
|
|
||||||
== Text formatting ==
|
|
||||||
''italic text''
|
|
||||||
|
|
||||||
'''bold text'''
|
|
||||||
|
|
||||||
'''''bold italic text'''''
|
|
||||||
|
|
||||||
== Links ==
|
|
||||||
[https://www.wikipedia.org/ Wikipedia]
|
|
||||||
|
|
||||||
== Images ==
|
|
||||||
[[File:MediaWiki-2020-logo.svg|thumb|MediaWiki logo]]
|
|
||||||
8
tests/syntax-tests/source/RequirementsTXT/requirements.txt
vendored
Normal file
8
tests/syntax-tests/source/RequirementsTXT/requirements.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#this is a sample requirements.txt file
|
||||||
|
|
||||||
|
django==11.2.0
|
||||||
|
pywheels>=12.4 #a whitespace followed by comments
|
||||||
|
Nuitka<0.6.8.4
|
||||||
|
wxPython>=1.0, <=2.1
|
||||||
|
|
||||||
|
#this is another comment
|
||||||
23
tests/syntax-tests/source/nim/test.nimble
vendored
23
tests/syntax-tests/source/nim/test.nimble
vendored
@@ -1,23 +0,0 @@
|
|||||||
version = "0.1.0"
|
|
||||||
author = "creator_name"
|
|
||||||
description = "Tests nimble syntax highlighting"
|
|
||||||
license = "custom"
|
|
||||||
|
|
||||||
bin = @["test"]
|
|
||||||
srcdir = "src"
|
|
||||||
installExt = @["nim"]
|
|
||||||
|
|
||||||
# Dependencies
|
|
||||||
|
|
||||||
requires "nim >= 1.6.2"
|
|
||||||
|
|
||||||
when defined(nimdistros):
|
|
||||||
import distros
|
|
||||||
if detectOs(Ubuntu):
|
|
||||||
foreignDep "external_lib"
|
|
||||||
else:
|
|
||||||
foreignDep "other_lib"
|
|
||||||
|
|
||||||
task test, "Runs a task called 'test'":
|
|
||||||
withDir "tests":
|
|
||||||
exec "nim c -r tester"
|
|
||||||
Reference in New Issue
Block a user