on master help sign in
216 files changed+15451−1707
since splitsnapshots
unifiedsplit
.github/ISSUE_TEMPLATE/bug_report.md+19−2 .github/ISSUE_TEMPLATE/question.md+2 .github/workflows/CICD.yml+24−3 .gitmodules+11−6 CHANGELOG.md+106−15 CONTRIBUTING.md+22 Cargo.lock+222−246 Cargo.toml+18−18 NOTICE+6 README.md+38−6 assets/acknowledgements.bin assets/completions/_bat.ps1.in+1−1 assets/completions/bat.bash.in+15−2 assets/completions/bat.fish.in+1−1 assets/completions/bat.zsh.in+1−1 assets/create.sh+13−7 assets/manual/bat.1.in+4−1 assets/syntaxes.bin assets/syntaxes/02_Extra/Dart+1−1 assets/syntaxes/02_Extra/Dart.sublime-syntax+85−243 assets/syntaxes/02_Extra/Fish+1−1 assets/syntaxes/02_Extra/GLSL+1−1 assets/syntaxes/02_Extra/GraphQL+1−1 assets/syntaxes/02_Extra/INI.sublime-syntax+2−2 assets/syntaxes/02_Extra/MediaWiki+1−1 assets/syntaxes/02_Extra/Nginx+1−1 assets/syntaxes/02_Extra/Nim.sublime-syntax+1 assets/syntaxes/02_Extra/PowerShell+1−1 assets/syntaxes/02_Extra/PowerShell.sublime-syntax+58−48 assets/syntaxes/02_Extra/SCSS_Sass+1−1 assets/syntaxes/02_Extra/Stylus.sublime-syntax+2−2 assets/syntaxes/02_Extra/SublimeJQ+1 assets/syntaxes/02_Extra/TOML+1−1 assets/syntaxes/02_Extra/TypeScript+1−1 assets/syntaxes/02_Extra/TypeScript.sublime-syntax+206−148 assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax+896−477 assets/syntaxes/02_Extra/VimL+1−1 assets/syntaxes/02_Extra/Zig+1−1 assets/syntaxes/02_Extra/cmd-help+1 assets/syntaxes/02_Extra/log.sublime-syntax+30−6 assets/syntaxes/02_Extra/requirementstxt−1 assets/syntaxes/02_Extra/requirementstxt.sublime-syntax−19 assets/syntaxes/02_Extra/ssh-config+1−1 assets/themes.bin doc/README-ja.md+3−3 doc/README-ko.md+3−3 doc/README-ru.md+3−3 doc/README-zh.md+678 doc/alternatives.md+39 doc/release-checklist.md+33−18 doc/sponsors.md+14 doc/sponsors/workos-logo-white-bg.svg+11 rustfmt.toml+1 src/assets.rs+110−21 src/assets/build_assets.rs+31−7 src/assets/build_assets/acknowledgements.rs+222 src/assets/lazy_theme_set.rs+104 src/bin/bat/app.rs+2−2 src/bin/bat/clap_app.rs+53−30 src/bin/bat/config.rs+2−2 src/bin/bat/directories.rs+3−5 src/bin/bat/main.rs+24−10 src/error.rs+4−1 src/input.rs+9−2 src/less.rs+59−8 src/lib.rs+1 src/line_range.rs+43−1 src/output.rs+7−5 src/preprocessor.rs+10−3 src/pretty_printer.rs+6 src/printer.rs+147−95 src/style.rs+30−4 src/syntax_mapping.rs+25−2 src/vscreen.rs+212 tests/benchmarks/.gitignore+1 tests/benchmarks/comparison.sh−33 tests/benchmarks/highlighting-speed-src/grep-output-ansi-sequences.txt+2272 tests/benchmarks/test-src/jquery-3.3.1.js → tests/benchmarks/highlighting-speed-src/jquery.js tests/benchmarks/test-src/miniz.c → tests/benchmarks/highlighting-speed-src/miniz.c tests/benchmarks/highlighting-speed-src/numpy_test_multiarray.py+8471 tests/benchmarks/many-small-files/small-file-0.txt+1 tests/benchmarks/many-small-files/small-file-1.txt+1 tests/benchmarks/many-small-files/small-file-10.txt+1 tests/benchmarks/many-small-files/small-file-100.txt+1 tests/benchmarks/many-small-files/small-file-11.txt+1 tests/benchmarks/many-small-files/small-file-12.txt+1 tests/benchmarks/many-small-files/small-file-13.txt+1 tests/benchmarks/many-small-files/small-file-14.txt+1 tests/benchmarks/many-small-files/small-file-15.txt+1 tests/benchmarks/many-small-files/small-file-16.txt+1 tests/benchmarks/many-small-files/small-file-17.txt+1 tests/benchmarks/many-small-files/small-file-18.txt+1 tests/benchmarks/many-small-files/small-file-19.txt+1 tests/benchmarks/many-small-files/small-file-2.txt+1 tests/benchmarks/many-small-files/small-file-20.txt+1 tests/benchmarks/many-small-files/small-file-21.txt+1 tests/benchmarks/many-small-files/small-file-22.txt+1 tests/benchmarks/many-small-files/small-file-23.txt+1 tests/benchmarks/many-small-files/small-file-24.txt+1 tests/benchmarks/many-small-files/small-file-25.txt+1 tests/benchmarks/many-small-files/small-file-26.txt+1 tests/benchmarks/many-small-files/small-file-27.txt+1 tests/benchmarks/many-small-files/small-file-28.txt+1 tests/benchmarks/many-small-files/small-file-29.txt+1 tests/benchmarks/many-small-files/small-file-3.txt+1 tests/benchmarks/many-small-files/small-file-30.txt+1 tests/benchmarks/many-small-files/small-file-31.txt+1 tests/benchmarks/many-small-files/small-file-32.txt+1 tests/benchmarks/many-small-files/small-file-33.txt+1 tests/benchmarks/many-small-files/small-file-34.txt+1 tests/benchmarks/many-small-files/small-file-35.txt+1 tests/benchmarks/many-small-files/small-file-36.txt+1 tests/benchmarks/many-small-files/small-file-37.txt+1 tests/benchmarks/many-small-files/small-file-38.txt+1 tests/benchmarks/many-small-files/small-file-39.txt+1 tests/benchmarks/many-small-files/small-file-4.txt+1 tests/benchmarks/many-small-files/small-file-40.txt+1 tests/benchmarks/many-small-files/small-file-41.txt+1 tests/benchmarks/many-small-files/small-file-42.txt+1 tests/benchmarks/many-small-files/small-file-43.txt+1 tests/benchmarks/many-small-files/small-file-44.txt+1 tests/benchmarks/many-small-files/small-file-45.txt+1 tests/benchmarks/many-small-files/small-file-46.txt+1 tests/benchmarks/many-small-files/small-file-47.txt+1 tests/benchmarks/many-small-files/small-file-48.txt+1 tests/benchmarks/many-small-files/small-file-49.txt+1 tests/benchmarks/many-small-files/small-file-5.txt+1 tests/benchmarks/many-small-files/small-file-50.txt+1 tests/benchmarks/many-small-files/small-file-51.txt+1 tests/benchmarks/many-small-files/small-file-52.txt+1 tests/benchmarks/many-small-files/small-file-53.txt+1 tests/benchmarks/many-small-files/small-file-54.txt+1 tests/benchmarks/many-small-files/small-file-55.txt+1 tests/benchmarks/many-small-files/small-file-56.txt+1 tests/benchmarks/many-small-files/small-file-57.txt+1 tests/benchmarks/many-small-files/small-file-58.txt+1 tests/benchmarks/many-small-files/small-file-59.txt+1 tests/benchmarks/many-small-files/small-file-6.txt+1 tests/benchmarks/many-small-files/small-file-60.txt+1 tests/benchmarks/many-small-files/small-file-61.txt+1 tests/benchmarks/many-small-files/small-file-62.txt+1 tests/benchmarks/many-small-files/small-file-63.txt+1 tests/benchmarks/many-small-files/small-file-64.txt+1 tests/benchmarks/many-small-files/small-file-65.txt+1 tests/benchmarks/many-small-files/small-file-66.txt+1 tests/benchmarks/many-small-files/small-file-67.txt+1 tests/benchmarks/many-small-files/small-file-68.txt+1 tests/benchmarks/many-small-files/small-file-69.txt+1 tests/benchmarks/many-small-files/small-file-7.txt+1 tests/benchmarks/many-small-files/small-file-70.txt+1 tests/benchmarks/many-small-files/small-file-71.txt+1 tests/benchmarks/many-small-files/small-file-72.txt+1 tests/benchmarks/many-small-files/small-file-73.txt+1 tests/benchmarks/many-small-files/small-file-74.txt+1 tests/benchmarks/many-small-files/small-file-75.txt+1 tests/benchmarks/many-small-files/small-file-76.txt+1 tests/benchmarks/many-small-files/small-file-77.txt+1 tests/benchmarks/many-small-files/small-file-78.txt+1 tests/benchmarks/many-small-files/small-file-79.txt+1 tests/benchmarks/many-small-files/small-file-8.txt+1 tests/benchmarks/many-small-files/small-file-80.txt+1 tests/benchmarks/many-small-files/small-file-81.txt+1 tests/benchmarks/many-small-files/small-file-82.txt+1 tests/benchmarks/many-small-files/small-file-83.txt+1 tests/benchmarks/many-small-files/small-file-84.txt+1 tests/benchmarks/many-small-files/small-file-85.txt+1 tests/benchmarks/many-small-files/small-file-86.txt+1 tests/benchmarks/many-small-files/small-file-87.txt+1 tests/benchmarks/many-small-files/small-file-88.txt+1 tests/benchmarks/many-small-files/small-file-89.txt+1 tests/benchmarks/many-small-files/small-file-9.txt+1 tests/benchmarks/many-small-files/small-file-90.txt+1 tests/benchmarks/many-small-files/small-file-91.txt+1 tests/benchmarks/many-small-files/small-file-92.txt+1 tests/benchmarks/many-small-files/small-file-93.txt+1 tests/benchmarks/many-small-files/small-file-94.txt+1 tests/benchmarks/many-small-files/small-file-95.txt+1 tests/benchmarks/many-small-files/small-file-96.txt+1 tests/benchmarks/many-small-files/small-file-97.txt+1 tests/benchmarks/many-small-files/small-file-98.txt+1 tests/benchmarks/many-small-files/small-file-99.txt+1 tests/benchmarks/run-benchmarks.sh+104−28 tests/benchmarks/startup-time-src/small-CpuInfo-file.cpuinfo+1 tests/benchmarks/startup-time-src/small-Markdown-file.md+3 tests/benchmarks/test-src/jquery-3.3.1.min.js−2 tests/examples/git/.config/git/config+3 tests/examples/git/.gitconfig+3 tests/examples/longline.json+3 tests/integration_tests.rs+306−3 tests/scripts/license-checks.sh+24 tests/snapshots/output/full.snapshot.txt+1 tests/syntax-tests/highlighted/Dart/inner_comment.dart+5 tests/syntax-tests/highlighted/Dart/test.dart+52−52 tests/syntax-tests/highlighted/INI/test.inf+5 tests/syntax-tests/highlighted/JQ/sample.jq+60 tests/syntax-tests/highlighted/Log/example.log+1 tests/syntax-tests/highlighted/PowerShell/test.ps1+2−2 tests/syntax-tests/highlighted/RequirementsTXT/requirements.txt−8 tests/syntax-tests/highlighted/SCSS/example.scss+16−16 tests/syntax-tests/highlighted/Sass/example.sass+18−18 tests/syntax-tests/highlighted/Svelte/App.svelte+5−1 tests/syntax-tests/highlighted/Syslog/example.syslog+3−3 tests/syntax-tests/highlighted/Vue/example.vue+5 tests/syntax-tests/highlighted/Zig/example.zig+39−39 tests/syntax-tests/highlighted/cmd-help/test.cmd-help+54 tests/syntax-tests/highlighted/nim/test.nimble+23 tests/syntax-tests/source/Dart/inner_comment.dart+5 tests/syntax-tests/source/INI/test.inf+5 tests/syntax-tests/source/JQ/LICENSE.md+25 tests/syntax-tests/source/JQ/sample.jq+60 tests/syntax-tests/source/Log/example.log+1 tests/syntax-tests/source/RequirementsTXT/requirements.txt−8 tests/syntax-tests/source/Svelte/App.svelte+5−1 tests/syntax-tests/source/Vue/example.vue+5 tests/syntax-tests/source/cmd-help/test.cmd-help+54 tests/syntax-tests/source/nim/test.nimble+23
.github/ISSUE_TEMPLATE/bug_report.md+19−2
@@ -7,9 +7,26 @@ assignees: ''
77
88---
99
10−<!-- Hey there, thank you for creating an issue! -->
10+<!--
11+
12+Hey there, thank you for reporting a bug!
13+
14+Please note that the following bugs have already been reported:
15+
16+* dpkg: error processing archive /some/path/some-program.deb (--unpack):
17+ trying to overwrite '/usr/.crates2.json'
18+
19+ See https://github.com/sharkdp/bat/issues/938
20+
21+-->
22+
23+**What steps will reproduce the bug?**
24+
25+1. step 1
26+2. step 2
27+3. ...
1128
12−**Describe the bug you encountered:**
29+**What happens?**
1330
1431...
1532
.github/ISSUE_TEMPLATE/question.md+2
@@ -7,3 +7,5 @@ assignees: ''
77
88---
99
10+<!-- Using a normal ticket is still fine, but feel free to ask your
11+questions about bat on https://github.com/sharkdp/bat/discussions instead. -->
.github/workflows/CICD.yml+24−3
@@ -1,7 +1,7 @@
11name: CICD
22
33env:
4− MIN_SUPPORTED_RUST_VERSION: "1.46.0"
4+ MIN_SUPPORTED_RUST_VERSION: "1.51.0"
55 CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
66
77on:
@@ -27,6 +27,15 @@ jobs:
2727 - uses: actions/checkout@v2
2828 - run: cargo fmt -- --check
2929
30+ license_checks:
31+ name: License checks
32+ runs-on: ubuntu-20.04
33+ steps:
34+ - uses: actions/checkout@v2
35+ with:
36+ submodules: true # we especially want to perform license checks on submodules
37+ - run: tests/scripts/license-checks.sh
38+
3039 min_version:
3140 name: Minimum supported rust version
3241 runs-on: ubuntu-20.04
@@ -45,7 +54,7 @@ jobs:
4554 uses: actions-rs/cargo@v1
4655 with:
4756 command: clippy
48− args: --locked --all-targets --all-features -- --allow clippy::unknown_clippy_lints
57+ args: --locked --all-targets --all-features
4958 - name: Run tests
5059 uses: actions-rs/cargo@v1
5160 with:
@@ -109,6 +118,18 @@ jobs:
109118 toolchain: stable
110119 default: true
111120 profile: minimal
121+ - name: Print -h
122+ uses: actions-rs/cargo@v1
123+ with:
124+ command: run
125+ args: --locked -- -h
126+ - name: Print --help
127+ uses: actions-rs/cargo@v1
128+ with:
129+ command: run
130+ args: --locked -- --help
131+ - name: Show man page
132+ run: man $(find . -name bat.1)
112133 - name: Check documentation
113134 env:
114135 RUSTDOCFLAGS: -D warnings
@@ -133,7 +154,7 @@ jobs:
133154 - { target: x86_64-apple-darwin , os: macos-10.15 }
134155 - { target: x86_64-pc-windows-gnu , os: windows-2019 }
135156 - { target: x86_64-pc-windows-msvc , os: windows-2019 }
136− - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
157+ - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
137158 - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
138159 steps:
139160 - name: Checkout source code
.gitmodules+11−6
@@ -67,9 +67,6 @@
6767[submodule "assets/syntaxes/JavaScript (Babel)"]
6868 path = assets/syntaxes/02_Extra/JavaScript (Babel)
6969 url = https://github.com/babel/babel-sublime
70−[submodule "assets/syntaxes/Dart"]
71− path = assets/syntaxes/02_Extra/Dart
72− url = https://github.com/guillermooo/dart-sublime-bundle
7370[submodule "assets/syntaxes/FSharp"]
7471 path = assets/syntaxes/02_Extra/FSharp
7572 url = https://github.com/hoest/sublimetext-fsharp
@@ -113,9 +110,6 @@
113110[submodule "assets/syntaxes/Org mode"]
114111 path = assets/syntaxes/02_Extra/Org mode
115112 url = https://github.com/jezcope/Org.tmbundle.git
116−[submodule "assets/syntaxes/requirementstxt"]
117− path = assets/syntaxes/02_Extra/requirementstxt
118− url = https://github.com/wuub/requirementstxt
119113[submodule "assets/syntaxes/DotENV"]
120114 path = assets/syntaxes/02_Extra/DotENV
121115 url = https://github.com/zaynali53/DotENV
@@ -239,3 +233,14 @@
239233[submodule "assets/syntaxes/02_Extra/MediaWiki"]
240234 path = assets/syntaxes/02_Extra/MediaWiki
241235 url = https://github.com/tosher/Mediawiker.git
236+[submodule "assets/syntaxes/02_Extra/Dart"]
237+ path = assets/syntaxes/02_Extra/Dart
238+ url = https://github.com/elMuso/Dartlight.git
239+[submodule "assets/syntaxes/02_Extra/SublimeJQ"]
240+ path = assets/syntaxes/02_Extra/SublimeJQ
241+ url = https://github.com/zogwarg/SublimeJQ.git
242+[submodule "assets/syntaxes/02_Extra/cmd-help"]
243+ path = assets/syntaxes/02_Extra/cmd-help
244+ url = https://github.com/victor-gp/cmd-help-sublime-syntax.git
245+ branch = main
246+ shallow = true
CHANGELOG.md+106−15
@@ -2,26 +2,117 @@
22
33## Features
44
5+- Make the default macOS theme depend on Dark Mode. See #2197, #1746 (@Enselic)
6+
7+## Bugfixes
8+
9+## Other
10+
11+- Relaxed glibc requirements on amd64, see #2106 and #2194 (@sharkdp)
12+
13+## Syntaxes
14+
15+## Themes
16+
17+## `bat` as a library
18+
19+
20+# v0.21.0
21+
22+## Features
23+
24+- Correctly render tab stops in `--show-all`, see #2038 (@Synthetica9)
25+- Add a `--style=default` option and make it the default. It is less verbose than `full`, see #2061 (@IsaacHorvath)
26+- Enable BusyBox `less` as pager, see #2162 (@nfisher1226)
27+- File extensions are now matched case-insensitively. See #1854, #2181 (@Enselic)
28+
29+## Bugfixes
30+
31+- Bump `regex` dependency from 1.5.4 to 1.5.5 to fix [CVE-2022-24713](https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html), see #2145, #2139 (@Enselic)
32+- `bat` no longer crashes when encountering files that references missing syntaxes. See #915, #2181 (@Enselic)
33+
34+## Performance
35+
36+- Skip syntax highlighting on long lines (> 16384 chars) to help improve performance. See #2165 (@keith-hall)
37+- Vastly improve startup time by lazy-loading syntaxes via syntect 5.0.0. This makes bat display small files ~75% faster than before. See #951, #2181 (@Enselic)
38+
39+## Other
40+
41+- Include info about custom assets in `--diagnostics` if used. See #2107, #2144 (@Enselic)
42+
43+## Syntaxes
44+
45+- Mapped clang-format config file (.clang-format) to YAML syntax (@TruncatedDinosour)
46+- log syntax: improved handling of escape characters in double quoted strings. See #2123 (@keith-hall)
47+- Associate `/var/spool/mail/*` and `/var/mail/*` with the `Email` syntax. See #2156 (@cyqsimon)
48+- Added cmd-help syntax to scope --help messages. See #2148 (@victor-gp)
49+- Slightly adjust Zig syntax. See #2136 (@Enselic)
50+- Associate `.inf` files with the `INI` syntax. See #2190 (@Enselic)
51+
52+## `bat` as a library
53+
54+- Allow configuration of `show_nonprintable` with `PrettyPrinter`, see #2142
55+- The binary format of syntaxes.bin has been changed due to syntaxes now being lazy-loaded via syntect 5.0.0. See #2181 (@Enselic)
56+- Mark `bat::error::Error` enum as `#[non_exhaustive]` to allow adding new variants without future semver breakage. See #2181 (@Enselic)
57+- Change `Error::SyntectError(syntect::LoadingError)` to `Error::SyntectError(syntect::Error)`. See #2181 (@Enselic)
58+- Add `Error::SyntectLoadingError(syntect::LoadingError)` enum variant. See #2181 (@Enselic)
59+
60+
61+# v0.20.0
62+
63+## Features
64+
65+- New style component `header-filesize` to show size of the displayed file in the header. See #1988 (@mdibaiee)
66+- Use underline for line highlighting on ANSI, see #1730 (@mdibaiee)
67+
68+## Bugfixes
69+
70+- Fix bash completion on bash 3.x and bash-completion 1.x. See #2066 (@joshpencheon)
71+
72+## Syntaxes
73+
74+- `GraphQL`: Add support for interfaces implementing interfaces and consider ampersand an operator. See #2000
75+- Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002
76+- Associate `poetry.lock` files with the `TOML` syntax. See #2049
77+- Associate `.mesh`, `.task`, `.rgen`, `.rint`, `.rahit`, `.rchit`, `.rmiss`, and `.rcall` with the `GLSL` syntax. See #2050
78+- Added support for `JQ` syntax, see #2072
79+- Properly associate global git config files rooted in `$XDG_CONFIG_HOME/git/` or `$HOME/.config/git/`. See #2067 (@cyqsimon)
80+
81+## `bat` as a library
82+
83+- Exposed `get_syntax_set` and `get_theme` methods on `HighlightingAssets`. See #2030 (@dandavison)
84+- Added `HeaderFilename` and `HeaderFilesize` to `StyleComponent` enum, and mark it `#[non_exhaustive]`. See #1988 (@mdibaiee)
85+
86+
87+# v0.19.0
88+
89+## Performance
90+
91+- Reduce startup time in loop-through mode (e.g. when redirecting output) by 90%. See #1747 (@Enselic)
92+- Load themes lazily to make bat start 25% faster when disregarding syntax load time. See #1969 (@Enselic)
93+- Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall)
94+- Fix for poor performance when ANSI escape sequences are piped to `bat`, see #1596 (@eth-p)
95+- Fix for incorrect handling of ANSI escape sequences when using `--wrap=never`, see #1596 (@eth-p)
96+- Load custom assets as fast as integrated assets, see #1753 (@Enselic)
97+
98+## Features
99+
100+- Support for `x:-delta` (minus) syntax in line ranges (e.g. `20:-10`). See #1901 (@bojan88)
5101- Support for `--ignored-suffix` argument. See #1892 (@bojan88)
6102- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
7103- Support for `x:+delta` syntax in line ranges (e.g. `20:+10`). See #1810 (@bojan88)
104+- Add new `--acknowledgements` option that gives credit to theme and syntax definition authors. See #1971 (@Enselic)
105+- Include git hash in `bat -V` and `bat --version` output if present. See #1921 (@Enselic)
8106
9107## Bugfixes
10108
11−- Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall)
12109- First line not shown in diff context. See #1891 (@divagant-martian)
13110- Do not ignore syntaxes that handle file names with a `*.conf` extension. See #1703 (@cbolgiano)
14111
15−## Performance
16−
17−- Load cached assets as fast as integrated assets, see #1753 (@Enselic)
18−- 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)
19−
20112## Other
21113
22114- Add PowerShell completion, see #1826 (@rashil2000)
23−- Minimum supported Rust version (MSRV) bumped to 1.46
24−- Include git hash in `bat -V` and `bat --version` output if present. See #1921 (@Enselic)
115+- Minimum supported Rust version (MSRV) bumped to 1.51, see #1994 (@mdibaiee)
25116
26117## Syntaxes
27118
@@ -34,18 +125,18 @@
34125- Racket, see #1884 (@jubnzv)
35126- LiveScript, see #1915 (@Enselic)
36127- MediaWiki, see #1925 (@sorairolake)
37−
38−## New themes
39−
128+- The `requirements.txt` syntax has been removed due to incompatible license requirements.
129+- Dart, new highlighter, see #1959 (@Ersikan)
130+- SCSS and Sass syntaxes updated, see #1766 (@Enselic)
131+- PowerShell syntax updated, see #1935 (@Enselic)
132+- TypeScript syntax updated, see #1834 (@Enselic)
40133
41134## `bat` as a library
42135
43136- 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)
44−- 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)
137+- 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)
45138- 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)
46−- Add new `MappingTarget` enum variant `MapExtensionToUnknown`. Refer to its docummentation for more information. Clients are adviced to treat `MapExtensionToUnknown` the same as `MapToUnknown` in exhaustive matches. See #1703 (@cbolgiano)
47−
48−
139+- 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)
49140
50141
51142# v0.18.3
CONTRIBUTING.md+22
@@ -46,3 +46,25 @@ If you really think that a particular syntax or theme should be added for all
4646users, please read the corresponding
4747[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
4848first.
49+
50+
51+## Regression tests
52+
53+You are strongly encouraged to add regression tests. Regression tests are great,
54+not least because they:
55+
56+* ensure that your contribution will never completely stop working,
57+
58+* makes code review easier, because it becomes very clear what the code is
59+ supposed to do.
60+
61+For functional changes, you most likely want to add a test to
62+[`tests/integration_tests.rs`](https://github.com/sharkdp/bat/blob/master/tests/integration_tests.rs).
63+Look at existing tests to know how to write a new test. In short, you will
64+invoke the `bat` binary with a certain set of arguments, and then assert on
65+stdout/stderr.
66+
67+To learn how to write regression tests for theme and syntax changes, read the
68+[Syntax
69+tests](https://github.com/sharkdp/bat/blob/master/doc/assets.md#syntax-tests)
70+section in `assets.md`.
Cargo.lock+222−246
@@ -19,20 +19,11 @@ dependencies = [
1919
2020[[package]]
2121name = "ansi_colours"
22−version = "1.0.4"
22+version = "1.1.1"
2323source = "registry+https://github.com/rust-lang/crates.io-index"
24−checksum = "60e2fb6138a49ad9f1cb3c6d8f8ccbdd5e62b4dab317c1b435a47ecd7da1d28f"
24+checksum = "32678233b67f9056b0c144b39d46dc3218637e8d84ad6038ded339e08b19620d"
2525dependencies = [
26− "cc",
27−]
28−
29−[[package]]
30−name = "ansi_term"
31−version = "0.11.0"
32−source = "registry+https://github.com/rust-lang/crates.io-index"
33−checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
34−dependencies = [
35− "winapi",
26+ "rgb",
3627]
3728
3829[[package]]
@@ -46,9 +37,9 @@ dependencies = [
4637
4738[[package]]
4839name = "assert_cmd"
49−version = "2.0.2"
40+version = "2.0.4"
5041source = "registry+https://github.com/rust-lang/crates.io-index"
51−checksum = "e996dc7940838b7ef1096b882e29ec30a3149a3a443cdc8dba19ed382eca1fe2"
42+checksum = "93ae1ddd39efd67689deb1979d80bad3bf7f2b09c6e6117c8d1f2443b5e2f83e"
5243dependencies = [
5344 "bstr",
5445 "doc-comment",
@@ -83,14 +74,15 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
8374
8475[[package]]
8576name = "bat"
86−version = "0.18.3"
77+version = "0.21.0"
8778dependencies = [
8879 "ansi_colours",
89− "ansi_term 0.12.1",
80+ "ansi_term",
9081 "assert_cmd",
9182 "atty",
9283 "bincode",
9384 "bugreport",
85+ "bytesize",
9486 "clap",
9587 "clircle",
9688 "console",
@@ -101,11 +93,11 @@ dependencies = [
10193 "git2",
10294 "globset",
10395 "grep-cli",
104− "lazy_static",
105− "lazycell",
10696 "nix",
97+ "once_cell",
10798 "path_abs",
10899 "predicates",
100+ "regex",
109101 "semver",
110102 "serde",
111103 "serde_yaml",
@@ -116,6 +108,7 @@ dependencies = [
116108 "thiserror",
117109 "unicode-width",
118110 "wait-timeout",
111+ "walkdir",
119112 "wild",
120113]
121114
@@ -151,9 +144,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
151144
152145[[package]]
153146name = "bstr"
154−version = "0.2.16"
147+version = "0.2.17"
155148source = "registry+https://github.com/rust-lang/crates.io-index"
156−checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
149+checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
157150dependencies = [
158151 "lazy_static",
159152 "memchr",
@@ -162,9 +155,9 @@ dependencies = [
162155
163156[[package]]
164157name = "bugreport"
165−version = "0.4.1"
158+version = "0.5.0"
166159source = "registry+https://github.com/rust-lang/crates.io-index"
167−checksum = "0014b4b2b4f63bfe69c3838470121290cc437fdc79785d408a761a21e8b2404c"
160+checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9"
168161dependencies = [
169162 "git-version",
170163 "shell-escape",
@@ -172,16 +165,22 @@ dependencies = [
172165]
173166
174167[[package]]
175−name = "byteorder"
176−version = "1.4.3"
168+name = "bytemuck"
169+version = "1.7.3"
170+source = "registry+https://github.com/rust-lang/crates.io-index"
171+checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f"
172+
173+[[package]]
174+name = "bytesize"
175+version = "1.1.0"
177176source = "registry+https://github.com/rust-lang/crates.io-index"
178−checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
177+checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70"
179178
180179[[package]]
181180name = "cc"
182−version = "1.0.67"
181+version = "1.0.72"
183182source = "registry+https://github.com/rust-lang/crates.io-index"
184−checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
183+checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
185184dependencies = [
186185 "jobserver",
187186]
@@ -192,23 +191,13 @@ version = "1.0.0"
192191source = "registry+https://github.com/rust-lang/crates.io-index"
193192checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
194193
195−[[package]]
196−name = "chrono"
197−version = "0.4.19"
198−source = "registry+https://github.com/rust-lang/crates.io-index"
199−checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
200−dependencies = [
201− "num-integer",
202− "num-traits",
203−]
204−
205194[[package]]
206195name = "clap"
207−version = "2.33.3"
196+version = "2.34.0"
208197source = "registry+https://github.com/rust-lang/crates.io-index"
209−checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
198+checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
210199dependencies = [
211− "ansi_term 0.11.0",
200+ "ansi_term",
212201 "atty",
213202 "bitflags",
214203 "strsim",
@@ -256,9 +245,9 @@ dependencies = [
256245
257246[[package]]
258247name = "crc32fast"
259−version = "1.2.1"
248+version = "1.3.0"
260249source = "registry+https://github.com/rust-lang/crates.io-index"
261−checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
250+checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836"
262251dependencies = [
263252 "cfg-if",
264253]
@@ -296,12 +285,6 @@ version = "0.3.3"
296285source = "registry+https://github.com/rust-lang/crates.io-index"
297286checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
298287
299−[[package]]
300−name = "dtoa"
301−version = "0.4.8"
302−source = "registry+https://github.com/rust-lang/crates.io-index"
303−checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
304−
305288[[package]]
306289name = "either"
307290version = "1.6.1"
@@ -388,11 +371,20 @@ dependencies = [
388371 "regex",
389372]
390373
374+[[package]]
375+name = "fastrand"
376+version = "1.7.0"
377+source = "registry+https://github.com/rust-lang/crates.io-index"
378+checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
379+dependencies = [
380+ "instant",
381+]
382+
391383[[package]]
392384name = "flate2"
393−version = "1.0.22"
385+version = "1.0.23"
394386source = "registry+https://github.com/rust-lang/crates.io-index"
395−checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
387+checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af"
396388dependencies = [
397389 "cfg-if",
398390 "crc32fast",
@@ -427,9 +419,9 @@ dependencies = [
427419
428420[[package]]
429421name = "getrandom"
430−version = "0.2.2"
422+version = "0.2.3"
431423source = "registry+https://github.com/rust-lang/crates.io-index"
432−checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
424+checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
433425dependencies = [
434426 "cfg-if",
435427 "libc",
@@ -438,9 +430,9 @@ dependencies = [
438430
439431[[package]]
440432name = "git-version"
441−version = "0.3.4"
433+version = "0.3.5"
442434source = "registry+https://github.com/rust-lang/crates.io-index"
443−checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2"
435+checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899"
444436dependencies = [
445437 "git-version-macro",
446438 "proc-macro-hack",
@@ -448,9 +440,9 @@ dependencies = [
448440
449441[[package]]
450442name = "git-version-macro"
451−version = "0.3.4"
443+version = "0.3.5"
452444source = "registry+https://github.com/rust-lang/crates.io-index"
453−checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657"
445+checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f"
454446dependencies = [
455447 "proc-macro-hack",
456448 "proc-macro2",
@@ -460,9 +452,9 @@ dependencies = [
460452
461453[[package]]
462454name = "git2"
463−version = "0.13.20"
455+version = "0.14.2"
464456source = "registry+https://github.com/rust-lang/crates.io-index"
465−checksum = "d9831e983241f8c5591ed53f17d874833e2fa82cac2625f3888c50cbfe136cba"
457+checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c"
466458dependencies = [
467459 "bitflags",
468460 "libc",
@@ -509,15 +501,15 @@ dependencies = [
509501
510502[[package]]
511503name = "hashbrown"
512−version = "0.9.1"
504+version = "0.11.2"
513505source = "registry+https://github.com/rust-lang/crates.io-index"
514−checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
506+checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
515507
516508[[package]]
517509name = "hermit-abi"
518−version = "0.1.18"
510+version = "0.1.19"
519511source = "registry+https://github.com/rust-lang/crates.io-index"
520−checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
512+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
521513dependencies = [
522514 "libc",
523515]
@@ -535,9 +527,9 @@ dependencies = [
535527
536528[[package]]
537529name = "indexmap"
538−version = "1.6.2"
530+version = "1.7.0"
539531source = "registry+https://github.com/rust-lang/crates.io-index"
540−checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
532+checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
541533dependencies = [
542534 "autocfg",
543535 "hashbrown",
@@ -545,33 +537,39 @@ dependencies = [
545537
546538[[package]]
547539name = "instant"
548−version = "0.1.9"
540+version = "0.1.12"
549541source = "registry+https://github.com/rust-lang/crates.io-index"
550−checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
542+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
551543dependencies = [
552544 "cfg-if",
553545]
554546
555547[[package]]
556548name = "itertools"
557−version = "0.10.1"
549+version = "0.10.3"
558550source = "registry+https://github.com/rust-lang/crates.io-index"
559−checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
551+checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
560552dependencies = [
561553 "either",
562554]
563555
564556[[package]]
565557name = "itoa"
566−version = "0.4.7"
558+version = "0.4.8"
567559source = "registry+https://github.com/rust-lang/crates.io-index"
568−checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
560+checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
561+
562+[[package]]
563+name = "itoa"
564+version = "1.0.1"
565+source = "registry+https://github.com/rust-lang/crates.io-index"
566+checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
569567
570568[[package]]
571569name = "jobserver"
572−version = "0.1.22"
570+version = "0.1.24"
573571source = "registry+https://github.com/rust-lang/crates.io-index"
574−checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
572+checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
575573dependencies = [
576574 "libc",
577575]
@@ -582,23 +580,17 @@ version = "1.4.0"
582580source = "registry+https://github.com/rust-lang/crates.io-index"
583581checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
584582
585−[[package]]
586−name = "lazycell"
587−version = "1.3.0"
588−source = "registry+https://github.com/rust-lang/crates.io-index"
589−checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
590−
591583[[package]]
592584name = "libc"
593−version = "0.2.103"
585+version = "0.2.125"
594586source = "registry+https://github.com/rust-lang/crates.io-index"
595−checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"
587+checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
596588
597589[[package]]
598590name = "libgit2-sys"
599−version = "0.12.21+1.1.0"
591+version = "0.13.2+1.4.2"
600592source = "registry+https://github.com/rust-lang/crates.io-index"
601−checksum = "86271bacd72b2b9e854c3dcfb82efd538f15f870e4c11af66900effb462f6825"
593+checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b"
602594dependencies = [
603595 "cc",
604596 "libc",
@@ -635,9 +627,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
635627
636628[[package]]
637629name = "lock_api"
638−version = "0.4.4"
630+version = "0.4.5"
639631source = "registry+https://github.com/rust-lang/crates.io-index"
640−checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
632+checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
641633dependencies = [
642634 "scopeguard",
643635]
@@ -653,46 +645,34 @@ dependencies = [
653645
654646[[package]]
655647name = "matches"
656−version = "0.1.8"
648+version = "0.1.9"
657649source = "registry+https://github.com/rust-lang/crates.io-index"
658−checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
650+checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
659651
660652[[package]]
661653name = "memchr"
662−version = "2.4.0"
663−source = "registry+https://github.com/rust-lang/crates.io-index"
664−checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
665−
666−[[package]]
667−name = "memoffset"
668−version = "0.6.4"
654+version = "2.4.1"
669655source = "registry+https://github.com/rust-lang/crates.io-index"
670−checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
671−dependencies = [
672− "autocfg",
673−]
656+checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
674657
675658[[package]]
676659name = "miniz_oxide"
677−version = "0.4.4"
660+version = "0.5.1"
678661source = "registry+https://github.com/rust-lang/crates.io-index"
679−checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
662+checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
680663dependencies = [
681664 "adler",
682− "autocfg",
683665]
684666
685667[[package]]
686668name = "nix"
687−version = "0.23.0"
669+version = "0.24.1"
688670source = "registry+https://github.com/rust-lang/crates.io-index"
689−checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
671+checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
690672dependencies = [
691673 "bitflags",
692− "cc",
693674 "cfg-if",
694675 "libc",
695− "memoffset",
696676]
697677
698678[[package]]
@@ -701,16 +681,6 @@ version = "0.3.0"
701681source = "registry+https://github.com/rust-lang/crates.io-index"
702682checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
703683
704−[[package]]
705−name = "num-integer"
706−version = "0.1.44"
707−source = "registry+https://github.com/rust-lang/crates.io-index"
708−checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
709−dependencies = [
710− "autocfg",
711− "num-traits",
712−]
713−
714684[[package]]
715685name = "num-traits"
716686version = "0.2.14"
@@ -722,15 +692,15 @@ dependencies = [
722692
723693[[package]]
724694name = "once_cell"
725−version = "1.8.0"
695+version = "1.10.0"
726696source = "registry+https://github.com/rust-lang/crates.io-index"
727−checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
697+checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
728698
729699[[package]]
730700name = "onig"
731−version = "6.1.1"
701+version = "6.3.1"
732702source = "registry+https://github.com/rust-lang/crates.io-index"
733−checksum = "30b46fd9edbc018f0be4e366c24c46db44fac49cd01c039ae85308088b089dd5"
703+checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225"
734704dependencies = [
735705 "bitflags",
736706 "lazy_static",
@@ -740,9 +710,9 @@ dependencies = [
740710
741711[[package]]
742712name = "onig_sys"
743−version = "69.6.0"
713+version = "69.7.1"
744714source = "registry+https://github.com/rust-lang/crates.io-index"
745−checksum = "ed063c96cf4c0f2e5d09324409d158b38a0a85a7b90fbd68c8cad75c495d5775"
715+checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e"
746716dependencies = [
747717 "cc",
748718 "pkg-config",
@@ -750,9 +720,9 @@ dependencies = [
750720
751721[[package]]
752722name = "parking_lot"
753−version = "0.11.1"
723+version = "0.11.2"
754724source = "registry+https://github.com/rust-lang/crates.io-index"
755−checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
725+checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
756726dependencies = [
757727 "instant",
758728 "lock_api",
@@ -761,9 +731,9 @@ dependencies = [
761731
762732[[package]]
763733name = "parking_lot_core"
764−version = "0.8.3"
734+version = "0.8.5"
765735source = "registry+https://github.com/rust-lang/crates.io-index"
766−checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
736+checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
767737dependencies = [
768738 "cfg-if",
769739 "instant",
@@ -790,35 +760,29 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
790760
791761[[package]]
792762name = "pkg-config"
793−version = "0.3.19"
763+version = "0.3.24"
794764source = "registry+https://github.com/rust-lang/crates.io-index"
795−checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
765+checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
796766
797767[[package]]
798768name = "plist"
799−version = "1.1.0"
769+version = "1.3.1"
800770source = "registry+https://github.com/rust-lang/crates.io-index"
801−checksum = "679104537029ed2287c216bfb942bbf723f48ee98f0aef15611634173a74ef21"
771+checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225"
802772dependencies = [
803773 "base64",
804− "chrono",
805774 "indexmap",
806775 "line-wrap",
807776 "serde",
777+ "time",
808778 "xml-rs",
809779]
810780
811−[[package]]
812−name = "ppv-lite86"
813−version = "0.2.10"
814−source = "registry+https://github.com/rust-lang/crates.io-index"
815−checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
816−
817781[[package]]
818782name = "predicates"
819−version = "2.0.3"
783+version = "2.1.1"
820784source = "registry+https://github.com/rust-lang/crates.io-index"
821−checksum = "5c6ce811d0b2e103743eec01db1c50612221f173084ce2f7941053e94b6bb474"
785+checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c"
822786dependencies = [
823787 "difflib",
824788 "float-cmp",
@@ -836,83 +800,67 @@ checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451"
836800
837801[[package]]
838802name = "predicates-tree"
839−version = "1.0.2"
803+version = "1.0.4"
840804source = "registry+https://github.com/rust-lang/crates.io-index"
841−checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2"
805+checksum = "338c7be2905b732ae3984a2f40032b5e94fd8f52505b186c7d4d68d193445df7"
842806dependencies = [
843807 "predicates-core",
844− "treeline",
845−]
846−
847−[[package]]
848−name = "proc-macro-hack"
849−version = "0.5.19"
850−source = "registry+https://github.com/rust-lang/crates.io-index"
851−checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
852−
853−[[package]]
854−name = "proc-macro2"
855−version = "1.0.26"
856−source = "registry+https://github.com/rust-lang/crates.io-index"
857−checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
858−dependencies = [
859− "unicode-xid",
808+ "termtree",
860809]
861810
862811[[package]]
863−name = "quote"
864−version = "1.0.9"
812+name = "proc-macro-error"
813+version = "1.0.4"
865814source = "registry+https://github.com/rust-lang/crates.io-index"
866−checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
815+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
867816dependencies = [
817+ "proc-macro-error-attr",
868818 "proc-macro2",
819+ "quote",
820+ "syn",
821+ "version_check",
869822]
870823
871824[[package]]
872−name = "rand"
873−version = "0.8.3"
825+name = "proc-macro-error-attr"
826+version = "1.0.4"
874827source = "registry+https://github.com/rust-lang/crates.io-index"
875−checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
828+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
876829dependencies = [
877− "libc",
878− "rand_chacha",
879− "rand_core",
880− "rand_hc",
830+ "proc-macro2",
831+ "quote",
832+ "version_check",
881833]
882834
883835[[package]]
884−name = "rand_chacha"
885−version = "0.3.0"
836+name = "proc-macro-hack"
837+version = "0.5.19"
886838source = "registry+https://github.com/rust-lang/crates.io-index"
887−checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
888−dependencies = [
889− "ppv-lite86",
890− "rand_core",
891−]
839+checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
892840
893841[[package]]
894−name = "rand_core"
895−version = "0.6.2"
842+name = "proc-macro2"
843+version = "1.0.36"
896844source = "registry+https://github.com/rust-lang/crates.io-index"
897−checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
845+checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
898846dependencies = [
899− "getrandom",
847+ "unicode-xid",
900848]
901849
902850[[package]]
903−name = "rand_hc"
904−version = "0.3.0"
851+name = "quote"
852+version = "1.0.14"
905853source = "registry+https://github.com/rust-lang/crates.io-index"
906−checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
854+checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
907855dependencies = [
908− "rand_core",
856+ "proc-macro2",
909857]
910858
911859[[package]]
912860name = "redox_syscall"
913−version = "0.2.8"
861+version = "0.2.10"
914862source = "registry+https://github.com/rust-lang/crates.io-index"
915−checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
863+checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
916864dependencies = [
917865 "bitflags",
918866]
@@ -929,9 +877,9 @@ dependencies = [
929877
930878[[package]]
931879name = "regex"
932−version = "1.5.4"
880+version = "1.5.5"
933881source = "registry+https://github.com/rust-lang/crates.io-index"
934−checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
882+checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
935883dependencies = [
936884 "aho-corasick",
937885 "memchr",
@@ -940,12 +888,9 @@ dependencies = [
940888
941889[[package]]
942890name = "regex-automata"
943−version = "0.1.9"
891+version = "0.1.10"
944892source = "registry+https://github.com/rust-lang/crates.io-index"
945−checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4"
946−dependencies = [
947− "byteorder",
948−]
893+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
949894
950895[[package]]
951896name = "regex-syntax"
@@ -962,11 +907,26 @@ dependencies = [
962907 "winapi",
963908]
964909
910+[[package]]
911+name = "rgb"
912+version = "0.8.31"
913+source = "registry+https://github.com/rust-lang/crates.io-index"
914+checksum = "9a374af9a0e5fdcdd98c1c7b64f05004f9ea2555b6c75f211daa81268a3c50f1"
915+dependencies = [
916+ "bytemuck",
917+]
918+
919+[[package]]
920+name = "rustversion"
921+version = "1.0.6"
922+source = "registry+https://github.com/rust-lang/crates.io-index"
923+checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
924+
965925[[package]]
966926name = "ryu"
967−version = "1.0.5"
927+version = "1.0.9"
968928source = "registry+https://github.com/rust-lang/crates.io-index"
969−checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
929+checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
970930
971931[[package]]
972932name = "safemem"
@@ -991,24 +951,24 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
991951
992952[[package]]
993953name = "semver"
994−version = "1.0.4"
954+version = "1.0.7"
995955source = "registry+https://github.com/rust-lang/crates.io-index"
996−checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
956+checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
997957
998958[[package]]
999959name = "serde"
1000−version = "1.0.130"
960+version = "1.0.136"
1001961source = "registry+https://github.com/rust-lang/crates.io-index"
1002−checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
962+checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
1003963dependencies = [
1004964 "serde_derive",
1005965]
1006966
1007967[[package]]
1008968name = "serde_derive"
1009−version = "1.0.130"
969+version = "1.0.136"
1010970source = "registry+https://github.com/rust-lang/crates.io-index"
1011−checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
971+checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
1012972dependencies = [
1013973 "proc-macro2",
1014974 "quote",
@@ -1017,32 +977,32 @@ dependencies = [
1017977
1018978[[package]]
1019979name = "serde_json"
1020−version = "1.0.64"
980+version = "1.0.74"
1021981source = "registry+https://github.com/rust-lang/crates.io-index"
1022−checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
982+checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
1023983dependencies = [
1024− "itoa",
984+ "itoa 1.0.1",
1025985 "ryu",
1026986 "serde",
1027987]
1028988
1029989[[package]]
1030990name = "serde_yaml"
1031−version = "0.8.21"
991+version = "0.8.23"
1032992source = "registry+https://github.com/rust-lang/crates.io-index"
1033−checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af"
993+checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0"
1034994dependencies = [
1035− "dtoa",
1036995 "indexmap",
996+ "ryu",
1037997 "serde",
1038998 "yaml-rust",
1039999]
10401000
10411001[[package]]
10421002name = "serial_test"
1043−version = "0.5.1"
1003+version = "0.6.0"
10441004source = "registry+https://github.com/rust-lang/crates.io-index"
1045−checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
1005+checksum = "e5bcc41d18f7a1d50525d080fd3e953be87c4f9f1a974f3c21798ca00d54ec15"
10461006dependencies = [
10471007 "lazy_static",
10481008 "parking_lot",
@@ -1051,12 +1011,14 @@ dependencies = [
10511011
10521012[[package]]
10531013name = "serial_test_derive"
1054−version = "0.5.1"
1014+version = "0.6.0"
10551015source = "registry+https://github.com/rust-lang/crates.io-index"
1056−checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
1016+checksum = "2881bccd7d60fb32dfa3d7b3136385312f8ad75e2674aab2852867a09790cae8"
10571017dependencies = [
1018+ "proc-macro-error",
10581019 "proc-macro2",
10591020 "quote",
1021+ "rustversion",
10601022 "syn",
10611023]
10621024
@@ -1068,15 +1030,15 @@ checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
10681030
10691031[[package]]
10701032name = "shell-words"
1071−version = "1.0.0"
1033+version = "1.1.0"
10721034source = "registry+https://github.com/rust-lang/crates.io-index"
1073−checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074"
1035+checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
10741036
10751037[[package]]
10761038name = "smallvec"
1077−version = "1.6.1"
1039+version = "1.7.0"
10781040source = "registry+https://github.com/rust-lang/crates.io-index"
1079−checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
1041+checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
10801042
10811043[[package]]
10821044name = "std_prelude"
@@ -1092,9 +1054,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
10921054
10931055[[package]]
10941056name = "syn"
1095−version = "1.0.72"
1057+version = "1.0.85"
10961058source = "registry+https://github.com/rust-lang/crates.io-index"
1097−checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
1059+checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
10981060dependencies = [
10991061 "proc-macro2",
11001062 "quote",
@@ -1103,9 +1065,9 @@ dependencies = [
11031065
11041066[[package]]
11051067name = "syntect"
1106−version = "4.6.0"
1068+version = "5.0.0"
11071069source = "registry+https://github.com/rust-lang/crates.io-index"
1108−checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
1070+checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8"
11091071dependencies = [
11101072 "bincode",
11111073 "bitflags",
@@ -1113,22 +1075,23 @@ dependencies = [
11131075 "flate2",
11141076 "fnv",
11151077 "lazy_static",
1116− "lazycell",
1078+ "once_cell",
11171079 "onig",
11181080 "plist",
11191081 "regex-syntax",
11201082 "serde",
11211083 "serde_derive",
11221084 "serde_json",
1085+ "thiserror",
11231086 "walkdir",
11241087 "yaml-rust",
11251088]
11261089
11271090[[package]]
11281091name = "sys-info"
1129−version = "0.9.0"
1092+version = "0.9.1"
11301093source = "registry+https://github.com/rust-lang/crates.io-index"
1131−checksum = "33fcecee49339531cf6bd84ecf3ed94f9c8ef4a7e700f2a1cac9cc1ca485383a"
1094+checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c"
11321095dependencies = [
11331096 "cc",
11341097 "libc",
@@ -1136,13 +1099,13 @@ dependencies = [
11361099
11371100[[package]]
11381101name = "tempfile"
1139−version = "3.2.0"
1102+version = "3.3.0"
11401103source = "registry+https://github.com/rust-lang/crates.io-index"
1141−checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
1104+checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
11421105dependencies = [
11431106 "cfg-if",
1107+ "fastrand",
11441108 "libc",
1145− "rand",
11461109 "redox_syscall",
11471110 "remove_dir_all",
11481111 "winapi",
@@ -1169,14 +1132,20 @@ dependencies = [
11691132
11701133[[package]]
11711134name = "terminal_size"
1172−version = "0.1.16"
1135+version = "0.1.17"
11731136source = "registry+https://github.com/rust-lang/crates.io-index"
1174−checksum = "86ca8ced750734db02076f44132d802af0b33b09942331f4459dde8636fd2406"
1137+checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
11751138dependencies = [
11761139 "libc",
11771140 "winapi",
11781141]
11791142
1143+[[package]]
1144+name = "termtree"
1145+version = "0.2.3"
1146+source = "registry+https://github.com/rust-lang/crates.io-index"
1147+checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16"
1148+
11801149[[package]]
11811150name = "textwrap"
11821151version = "0.11.0"
@@ -1189,29 +1158,39 @@ dependencies = [
11891158
11901159[[package]]
11911160name = "thiserror"
1192−version = "1.0.30"
1161+version = "1.0.31"
11931162source = "registry+https://github.com/rust-lang/crates.io-index"
1194−checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
1163+checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
11951164dependencies = [
11961165 "thiserror-impl",
11971166]
11981167
11991168[[package]]
12001169name = "thiserror-impl"
1201−version = "1.0.30"
1170+version = "1.0.31"
12021171source = "registry+https://github.com/rust-lang/crates.io-index"
1203−checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
1172+checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
12041173dependencies = [
12051174 "proc-macro2",
12061175 "quote",
12071176 "syn",
12081177]
12091178
1179+[[package]]
1180+name = "time"
1181+version = "0.3.5"
1182+source = "registry+https://github.com/rust-lang/crates.io-index"
1183+checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad"
1184+dependencies = [
1185+ "itoa 0.4.8",
1186+ "libc",
1187+]
1188+
12101189[[package]]
12111190name = "tinyvec"
1212−version = "1.2.0"
1191+version = "1.5.1"
12131192source = "registry+https://github.com/rust-lang/crates.io-index"
1214−checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
1193+checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
12151194dependencies = [
12161195 "tinyvec_macros",
12171196]
@@ -1222,26 +1201,17 @@ version = "0.1.0"
12221201source = "registry+https://github.com/rust-lang/crates.io-index"
12231202checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
12241203
1225−[[package]]
1226−name = "treeline"
1227−version = "0.1.0"
1228−source = "registry+https://github.com/rust-lang/crates.io-index"
1229−checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
1230−
12311204[[package]]
12321205name = "unicode-bidi"
1233−version = "0.3.5"
1206+version = "0.3.7"
12341207source = "registry+https://github.com/rust-lang/crates.io-index"
1235−checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
1236−dependencies = [
1237− "matches",
1238−]
1208+checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
12391209
12401210[[package]]
12411211name = "unicode-normalization"
1242−version = "0.1.17"
1212+version = "0.1.19"
12431213source = "registry+https://github.com/rust-lang/crates.io-index"
1244−checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef"
1214+checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
12451215dependencies = [
12461216 "tinyvec",
12471217]
@@ -1272,9 +1242,9 @@ dependencies = [
12721242
12731243[[package]]
12741244name = "vcpkg"
1275−version = "0.2.12"
1245+version = "0.2.15"
12761246source = "registry+https://github.com/rust-lang/crates.io-index"
1277−checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d"
1247+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
12781248
12791249[[package]]
12801250name = "vec_map"
@@ -1282,6 +1252,12 @@ version = "0.8.2"
12821252source = "registry+https://github.com/rust-lang/crates.io-index"
12831253checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
12841254
1255+[[package]]
1256+name = "version_check"
1257+version = "0.9.4"
1258+source = "registry+https://github.com/rust-lang/crates.io-index"
1259+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
1260+
12851261[[package]]
12861262name = "wait-timeout"
12871263version = "0.2.0"
@@ -1350,9 +1326,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
13501326
13511327[[package]]
13521328name = "xml-rs"
1353−version = "0.8.3"
1329+version = "0.8.4"
13541330source = "registry+https://github.com/rust-lang/crates.io-index"
1355−checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"
1331+checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
13561332
13571333[[package]]
13581334name = "yaml-rust"
Cargo.toml+18−18
@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
66license = "MIT/Apache-2.0"
77name = "bat"
88repository = "https://github.com/sharkdp/bat"
9−version = "0.18.3"
9+version = "0.21.0"
1010exclude = ["assets/syntaxes/*", "assets/themes/*"]
1111build = "build.rs"
1212edition = '2018'
@@ -27,15 +27,13 @@ minimal-application = [
2727 "atty",
2828 "clap",
2929 "dirs-next",
30− "lazy_static",
3130 "paging",
3231 "regex-onig",
3332 "wild",
3433]
3534git = ["git2"] # Support indicating git modifications
3635paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
37−# Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
38−build-assets = ["syntect/yaml-load", "syntect/dump-create"]
36+build-assets = ["syntect/yaml-load", "syntect/plist-load", "regex", "walkdir"]
3937
4038# You need to use one of these if you depend on bat as a library:
4139regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
@@ -44,17 +42,16 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
4442[dependencies]
4543atty = { version = "0.2.14", optional = true }
4644ansi_term = "^0.12.1"
47−ansi_colours = "^1.0"
45+ansi_colours = "^1.1"
4846bincode = "1.0"
4947console = "0.15.0"
5048flate2 = "1.0"
51−lazy_static = { version = "1.4", optional = true }
52−lazycell = "1.0"
49+once_cell = "1.10"
5350thiserror = "1.0"
5451wild = { version = "2.0", optional = true }
5552content_inspector = "0.2.4"
5653encoding = "0.2"
57−shell-words = { version = "1.0.0", optional = true }
54+shell-words = { version = "1.1.0", optional = true }
5855unicode-width = "0.1.9"
5956globset = "0.4"
6057serde = { version = "1.0", features = ["derive"] }
@@ -62,38 +59,41 @@ serde_yaml = "0.8"
6259semver = "1.0"
6360path_abs = { version = "0.5", default-features = false }
6461clircle = "0.3"
65−bugreport = { version = "0.4", optional = true }
62+bugreport = { version = "0.5.0", optional = true }
6663dirs-next = { version = "2.0.0", optional = true }
6764grep-cli = { version = "0.1.6", optional = true }
65+regex = { version = "1.5.5", optional = true }
66+walkdir = { version = "2.0", optional = true }
67+bytesize = { version = "1.1.0" }
6868
6969[dependencies.git2]
70−version = "0.13"
70+version = "0.14"
7171optional = true
7272default-features = false
7373
7474[dependencies.syntect]
75−version = "4.6.0"
75+version = "5.0.0"
7676default-features = false
7777features = ["parsing"]
7878
7979[dependencies.clap]
80−version = "2.33"
80+version = "2.34"
8181optional = true
8282default-features = false
8383features = ["suggestions", "color", "wrap_help"]
8484
8585[dev-dependencies]
86−assert_cmd = "2.0.2"
87−serial_test = "0.5.1"
88−predicates = "2.0.3"
86+assert_cmd = "2.0.4"
87+serial_test = "0.6.0"
88+predicates = "2.1.1"
8989wait-timeout = "0.2.0"
90−tempfile = "3.2.0"
90+tempfile = "3.3.0"
9191
9292[target.'cfg(unix)'.dev-dependencies]
93−nix = "0.23.0"
93+nix = { version = "0.24.1", default-features = false, features = ["term"] }
9494
9595[build-dependencies]
96−clap = { version = "2.33", optional = true }
96+clap = { version = "2.34", optional = true }
9797
9898[profile.release]
9999lto = true
NOTICEnew file+6
@@ -0,0 +1,6 @@
1+Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
2+
3+bat is made available under the terms of either the MIT License or the Apache
4+License 2.0, at your option.
5+
6+See the LICENSE-APACHE and LICENSE-MIT files for license details.
README.md+38−6
@@ -13,12 +13,25 @@
1313 <a href="#customization">Customization</a> •
1414 <a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
1515 [English]
16− [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
16+ [<a href="doc/README-zh.md">中文</a>]
1717 [<a href="doc/README-ja.md">日本語</a>]
1818 [<a href="doc/README-ko.md">한국어</a>]
1919 [<a href="doc/README-ru.md">Русский</a>]
2020</p>
2121
22+### Sponsors
23+
24+A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br>
25+<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=bat&utm_source=github">
26+ <img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS">
27+ <br>
28+ <strong>Your app, enterprise-ready.</strong>
29+ <br>
30+ <sub>Start selling to enterprise customers with just a few lines of code.</sub>
31+ <br>
32+ <sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
33+</a>
34+
2235### Syntax highlighting
2336
2437`bat` supports syntax highlighting for a large number of programming and markup
@@ -158,7 +171,7 @@ You can combine `bat` with `git diff` to view lines around code changes with pro
158171highlighting:
159172```bash
160173batdiff() {
161− git diff --name-only --diff-filter=d | xargs bat --diff
174+ git diff --name-only --relative --diff-filter=d | xargs bat --diff
162175}
163176```
164177If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
@@ -199,6 +212,24 @@ Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145)
199212
200213The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) script is a wrapper that will format code and print it with `bat`.
201214
215+#### Highlighting `--help` messages
216+
217+You can use `bat` to colorize help text: `$ cp --help | bat -plhelp`
218+
219+You can also use a wrapper around this:
220+
221+```bash
222+# in your .bashrc/.zshrc/*rc
223+alias bathelp='bat --plain --language=help'
224+help() {
225+ "$@" --help 2>&1 | bathelp
226+}
227+```
228+
229+Then you can do `$ help cp` or `$ help git commit`.
230+
231+Please report any issues with the help syntax in [this repository](https://github.com/victor-gp/cmd-help-sublime-syntax).
232+
202233
203234## Installation
204235
@@ -387,7 +418,7 @@ binaries are also available: look for archives with `musl` in the file name.
387418
388419### From source
389420
390−If you want to build `bat` from source, you need Rust 1.46 or
421+If you want to build `bat` from source, you need Rust 1.51 or
391422higher. You can then use `cargo` to build everything:
392423
393424```bash
@@ -515,8 +546,9 @@ command line option. The option takes an argument of the form `pattern:syntax` w
515546the absolute file path. The `syntax` part is the full name of a supported language
516547(use `bat --list-languages` for an overview).
517548
518−Note: You probably want to use this option as an entry in `bat`s configuration file instead
519−of passing it on the command line (see below).
549+**Note:** You probably want to use this option as [an entry in `bat`'s configuration file](#configuration-file)
550+for persistence instead of passing it on the command line as a one-off. Generally
551+you'd just use `-l` if you want to manually specify a language for a file.
520552
521553Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
522554```bash
@@ -676,7 +708,7 @@ bat() {
676708
677709### Garbled output
678710
679−If an input file contains color codes or other ANSI escape sequences, `bat` will have problems
711+If an input file contains color codes or other ANSI escape sequences or control characters, `bat` will have problems
680712performing syntax highlighting and text wrapping, and thus the output can become garbled.
681713When displaying such files it is recommended to disable both syntax highlighting and wrapping by
682714passing the `--color=never --wrap=never` options to `bat`.
assets/acknowledgements.binnew file

Binary file not shown.

assets/completions/_bat.ps1.in+1−1
@@ -37,7 +37,7 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
3737 [CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
3838 [CompletionResult]::new('--map-syntax', 'map-syntax', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
3939 [CompletionResult]::new('--theme', 'theme', [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.')
40− [CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*auto*, full, plain, changes, header, grid, rule, numbers, snip).')
40+ [CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).')
4141 [CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
4242 [CompletionResult]::new('--line-range', 'line-range', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
4343 [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
assets/completions/bat.bash.in+15−2
@@ -2,9 +2,22 @@
22
33# Requires https://github.com/scop/bash-completion
44
5+# Macs have bash3 for which the bash-completion package doesn't include
6+# _init_completion. This is a minimal version of that function.
7+__bat_init_completion()
8+{
9+ COMPREPLY=()
10+ _get_comp_words_by_ref "$@" cur prev words cword
11+}
12+
513_bat() {
6− local cur prev words cword split
7− _init_completion -s || return 0
14+ local cur prev words cword split=false
15+ if declare -F _init_completion >/dev/null 2>&1; then
16+ _init_completion -s || return 0
17+ else
18+ __bat_init_completion -n "=" || return 0
19+ _split_longopt && split=true
20+ fi
821
922 if [[ ${words[1]-} == cache ]]; then
1023 case $prev in
assets/completions/bat.fish.in+1−1
@@ -56,7 +56,7 @@ complete -c {{PROJECT_EXECUTABLE}} -s P -d "Disable paging. Alias for '--paging=
5656
5757complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
5858
59−complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
59+complete -c {{PROJECT_EXECUTABLE}} -l style -xka "default auto full plain changes header header-filename header-filesize grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
6060
6161complete -c {{PROJECT_EXECUTABLE}} -l tabs -x -d "<T> Set the tab width to T spaces (width of 0 passes tabs through directly)" -n "not __fish_seen_subcommand_from cache"
6262
assets/completions/bat.zsh.in+1−1
@@ -75,7 +75,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
7575 ;;
7676
7777 style)
78− _values -s , 'style' auto full plain changes header grid rule numbers snip
78+ _values -s , 'style' default auto full plain changes header header-filename header-filesize grid rule numbers snip
7979 ;;
8080 esac
8181}
assets/create.sh+13−7
@@ -46,6 +46,7 @@ bat cache --clear
4646# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
4747# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
4848
49+# Apply patches
4950(
5051 cd "$ASSET_DIR"
5152 for patch in patches/*.patch; do
@@ -53,11 +54,16 @@ bat cache --clear
5354 done
5455)
5556
56−bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
57+reverse_patches() {
58+ (
59+ cd "$ASSET_DIR"
60+ for patch in patches/*.patch; do
61+ patch --strip=0 --reverse <"$patch"
62+ done
63+ )
64+}
5765
58−(
59− cd "$ASSET_DIR"
60− for patch in patches/*.patch; do
61− patch --strip=0 --reverse < "$patch"
62− done
63−)
66+# Make sure to always reverse patches, even if the `bat cache` command fails or aborts
67+trap reverse_patches EXIT
68+
69+bat cache --build --blank --acknowledgements --source="$ASSET_DIR" --target="$ASSET_DIR"
assets/manual/bat.1.in+4−1
@@ -118,6 +118,8 @@ which pager is used, see the '\-\-pager' option. Possible values: *auto*, never,
118118Determine which pager is used. This option will override the PAGER and BAT_PAGER
119119environment variables. The default pager is 'less'. To control when the pager is used, see
120120the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
121+
122+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.
121123.HP
122124\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
123125.IP
@@ -144,7 +146,8 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
144146of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
145147To set a default style, add the '\-\-style=".."' option to the configuration file or
146148export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
147−values: *full*, auto, plain, changes, header, grid, rule, numbers, snip.
149+values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
150+rule, numbers, snip.
148151.HP
149152\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
150153.IP
assets/syntaxes.bin

Binary file not shown.

assets/syntaxes/02_Extra/Dart+1−1

Submodule changed.

assets/syntaxes/02_Extra/Dart.sublime-syntax+85−243
@@ -1,6 +1,6 @@
11%YAML 1.2
22---
3−# http://www.sublimetext.com/docs/3/syntax.html
3+# http://www.sublimetext.com/docs/syntax.html
44name: Dart
55file_extensions:
66 - dart
@@ -9,7 +9,7 @@ contexts:
99 main:
1010 - match: ^(#!.*)$
1111 scope: meta.preprocessor.script.dart
12− - match: ^\s*\b(library|import|export|part of|part)\b
12+ - match: ^\w*\b(library|import|part of|part|export)\b
1313 captures:
1414 0: keyword.other.import.dart
1515 push:
@@ -19,242 +19,114 @@ contexts:
1919 0: punctuation.terminator.dart
2020 pop: true
2121 - include: strings
22− - match: \b(as|show|hide|deferred)\b
22+ - include: comments
23+ - match: \b(as|show|hide)\b
2324 scope: keyword.other.import.dart
2425 - include: comments
25− - include: constants-and-special-vars
26+ - include: punctuation
2627 - include: annotations
27− - include: decl-typedef
28− - include: decl-class
29− - include: decl-enum
30− - include: decl-function
3128 - include: keywords
29+ - include: constants-and-special-vars
3230 - include: strings
3331 annotations:
34− - match: '^(?:\s*)((@)([a-zA-Z0-9_]+))'
35− captures:
36− 1: annotation.dart
37− 2: entity.name.function.annotation.dart
38− 3: support.type.dart
32+ - match: '@[a-zA-Z]+'
33+ scope: storage.type.annotation.dart
3934 comments:
4035 - match: /\*\*/
4136 scope: comment.block.empty.dart
4237 captures:
4338 0: punctuation.definition.comment.dart
39+ - include: comments-doc-oldschool
40+ - include: comments-doc
4441 - include: comments-inline
45− comments-inline:
42+ comments-block:
4643 - match: /\*
4744 push:
4845 - meta_scope: comment.block.dart
4946 - match: \*/
5047 pop: true
51− - include: scope:text.dart-doccomments
52− - match: (///)
53− captures:
54− 1: marker.dart
48+ - include: comments-block
49+ comments-doc:
50+ - match: ///
5551 push:
56− - meta_scope: comment.line.triple-slash.dart
57− - match: $
52+ - meta_scope: comment.block.documentation.dart
53+ - match: .*
5854 pop: true
59− - include: scope:text.dart-doccomments
60− - match: (//)
61− captures:
62− 1: marker.dart
55+ - include: dartdoc
56+ comments-doc-oldschool:
57+ - match: /\*\*
6358 push:
64− - meta_scope: comment.line.double-slash.dart
65− - match: $
59+ - meta_scope: comment.block.documentation.dart
60+ - match: \*/
6661 pop: true
67− - include: scope:text.dart-doccomments
62+ - include: comments-doc-oldschool
63+ - include: comments-block
64+ - include: dartdoc
65+ comments-inline:
66+ - include: comments-block
67+ - match: ((//).*)$
68+ captures:
69+ 1: comment.line.double-slash.dart
6870 constants-and-special-vars:
69− - match: \b(true|false|null)\b
71+ - match: (?<!\$)\b(true|false|null)\b(?!\$)
7072 scope: constant.language.dart
71− - match: \b(this|super)\b
73+ - match: (?<!\$)\b(this|super)\b(?!\$)
7274 scope: variable.language.dart
73− - match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'
75+ - match: '(?<!\$)\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b(?!\$)'
7476 scope: constant.numeric.dart
75− decl-class:
76− - match: \bclass\b
77+ - match: '(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*|bool\b|num\b|int\b|double\b|dynamic\b)'
78+ scope: support.class.dart
79+ - match: '([_$]*[a-z][a-zA-Z0-9_$]*)(<|\(|\s+=>)'
7780 captures:
78− 0: keyword.control.new.dart
79− push:
80− - meta_scope: meta.declaration.class.dart
81− - match: "(?={)"
82− pop: true
83− - include: keywords
84− - match: "[A-Za-z_][A-Za-z0-9_]*"
85− scope: class.name.dart
86− decl-enum:
87− - match: \benum\b
88− captures:
89− 0: keyword.declaration.dart
90− push:
91− - meta_scope: meta.declaration.enum.dart
92− - match: "(?={)"
93− pop: true
94− - include: keywords
95− - match: "[A-Za-z_][A-Za-z0-9_]*"
96− scope: enum.name.dart
97− decl-function:
98− - match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(get)\s+(\w+)\s+(?==>)
99− comment: A getter with a primitive return type.
100− scope: meta.declaration.function.dart
81+ 1: entity.name.function.dart
82+ dartdoc:
83+ - match: '(\[.*?\])'
10184 captures:
102− 1: storage.type.primitive.dart
103− 2: keyword.declaration.dart
104− 3: function.name.dart
105− - match: ^\s*(?:\b(\w+)\b\s+)?(get)\s+(\w+)\s+(?==>)
106− comment: A getter with a user-defined return type or no return type.
107− scope: meta.declaration.function.dart
108− captures:
109− 1: type.user-defined.dart
110− 2: keyword.declaration.dart
111− 3: function.name.dart
112− - match: ^\s*(set)\s+(\w+)(?=\()
113− comment: A setter.
114− captures:
115− 1: keyword.declaration.dart
116− 2: function.name.dart
117− push:
118− - meta_scope: meta.declaration.function.dart
119− - match: \)
120− pop: true
121− - include: comments-inline
122− - include: decl-function-parameter
123− - include: strings
124− - include: keywords
125− - match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
126− comment: A function with a primitive return type.
127− captures:
128− 1: storage.type.primitive.dart
129− 2: function.name.dart
130− push:
131− - meta_scope: meta.declaration.function.dart
132− - match: \)
133− pop: true
134− - include: comments-inline
135− - include: decl-function-parameter
136− - include: strings
137− - include: keywords
138− - match: ^\s*(?:\b(return)\b)\s+(\w+)(?=\()
139− comment: A function invocation after 'return'
140− captures:
141− 1: keyword.control.dart
142− 2: function.name.dart
143− push:
144− - meta_scope: meta.invocation.function.dart
145− - match: \)
146− pop: true
147− - include: comments-inline
148− - include: decl-function-parameter
149− - include: strings
150− - include: keywords
151− - match: ^\s*\b(new)\b\s+(\w+)(?=\()
152− comment: A class instantiation after 'new'
153− captures:
154− 1: keyword.declaration.dart
155− 2: function.name.dart
156− push:
157− - meta_scope: meta.invocation.function.dart
158− - match: \)
159− pop: true
160− - include: comments-inline
161− - include: decl-function-parameter
162− - include: strings
163− - include: keywords
164− decl-function-parameter:
165− - include: constants-and-special-vars
166− - match: (?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
167− comment: A function with a primitive return type.
168− captures:
169− 1: storage.type.primitive.dart
170− 2: function.name.dart
171− push:
172− - meta_scope: meta.parameter.function.dart
173− - match: \)
174− pop: true
175− - include: decl-function-parameter
176− - include: strings
177− - include: keywords
178− - match: \b(new)\b\s+(\w+)(?=\()
179− comment: A class instantiation after 'new'
85+ 0: variable.name.source.dart
86+ - match: '^ {4,}(?![ \*]).*'
18087 captures:
181− 1: keyword.declaration.dart
182− 2: function.name.dart
88+ 0: variable.name.source.dart
89+ - match: '```.*?$'
18390 push:
184− - meta_scope: meta.invocation.function.dart
185− - match: \)
91+ - meta_content_scope: variable.other.source.dart
92+ - match: '```'
18693 pop: true
187− - include: decl-function-parameter
188− - include: strings
189− - include: keywords
190− - match: (?:\b(\w+)\b)\s+(\w+)(?=\()
191− comment: A function with a user-defined return type.
94+ - match: (`.*?`)
19295 captures:
193− 1: type.user-defined.dart
194− 2: function.name.dart
195− push:
196− - meta_scope: meta.parameter.function.dart
197− - match: \)
198− pop: true
199− - include: decl-function-parameter
200− - include: strings
201− - include: keywords
202− - match: (\w+)(?=\()
203− comment: A function with no return type.
96+ 0: variable.other.source.dart
97+ - match: (`.*?`)
20498 captures:
205− 1: function.name.dart
206− push:
207− - meta_scope: meta.parameter.function.dart
208− - match: \)
209− pop: true
210− - include: decl-function-parameter
211− - include: strings
212− - include: keywords
213− decl-typedef:
214− - match: typedef
99+ 0: variable.other.source.dart
100+ - match: (\* (( ).*))$
215101 captures:
216− 0: keyword.control.new.dart
217− push:
218− - meta_scope: meta.declaration.typedef.dart
219− - match: ;
220− captures:
221− 0: punctuation.terminator.dart
222− pop: true
223− - 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_]+)'
224− captures:
225− 1: storage.type.primitive.dart
226− 2: typedef.return.dart
227− 3: typedef.name.dart
228− - match: \(
229− push:
230− - meta_scope: typedef.params.dart
231− - match: \)
232− pop: true
233− - include: keywords
102+ 2: variable.other.source.dart
103+ - match: (\* .*)$
234104 keywords:
235− - match: \bassert\b
236− scope: keyword.control.assert.dart
237− - match: \bas\b
105+ - match: (?<!\$)\bas\b(?!\$)
238106 scope: keyword.cast.dart
239− - match: \b(try|catch|finally|throw|on|rethrow)\b
107+ - match: (?<!\$)\b(try|on|catch|finally|throw|rethrow)\b(?!\$)
240108 scope: keyword.control.catch-exception.dart
241− - match: \s+\?\s+|\s+:\s+
242− scope: keyword.control.ternary.dart
243− - match: \b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b
109+ - match: (?<!\$)\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b(?!\$)
244110 scope: keyword.control.dart
245− - match: \b(async\*|async|await\*|await|yield)\b
246− scope: keyword.control.async.dart
247− - match: \b(new)\b
111+ - match: (?<!\$)\b(sync(\*)?|async(\*)?|await|yield(\*)?)\b(?!\$)
112+ scope: keyword.control.dart
113+ - match: (?<!\$)\bassert\b(?!\$)
114+ scope: keyword.control.dart
115+ - match: (?<!\$)\b(new)\b(?!\$)
248116 scope: keyword.control.new.dart
249− - match: \b(abstract|extends|external|factory|implements|with|interface|get|native|operator|set|typedef)\b
117+ - match: (?<!\$)\b(abstract|class|enum|extends|external|factory|implements|get|mixin|native|operator|set|typedef|with|covariant)\b(?!\$)
250118 scope: keyword.declaration.dart
251− - match: \b(is\!?)\b
119+ - match: (?<!\$)\b(is\!?)\b(?!\$)
252120 scope: keyword.operator.dart
121+ - match: '\?|:'
122+ scope: keyword.operator.ternary.dart
253123 - match: (<<|>>>?|~|\^|\||&)
254124 scope: keyword.operator.bitwise.dart
255125 - match: ((&|\^|\||<<|>>>?)=)
256126 scope: keyword.operator.assignment.bitwise.dart
257− - match: (===?|!==?|<=?|>=?)
127+ - match: (=>)
128+ scope: keyword.operator.closure.dart
129+ - match: (==|!=|<=?|>=?)
258130 scope: keyword.operator.comparison.dart
259131 - match: '(([+*/%-]|\~)=)'
260132 scope: keyword.operator.assignment.arithmetic.dart
@@ -266,56 +138,22 @@ contexts:
266138 scope: keyword.operator.arithmetic.dart
267139 - match: (!|&&|\|\|)
268140 scope: keyword.operator.logical.dart
269− - match: ;
270− scope: punctuation.terminator.dart
271− - match: \b(static|final|const)\b
141+ - match: (?<!\$)\b(static|final|const)\b(?!\$)
272142 scope: storage.modifier.dart
273− - match: \b(?:void|bool|num|int|double|dynamic|var|String|List|Map)\b
143+ - match: (?<!\$)\b(?:void|var)\b(?!\$)
274144 scope: storage.type.primitive.dart
275− regexp:
276− - match: '\\[^''"]'
277− scope: constant.character.escaped.regex.dart
278− - match: \(
279− push:
280− - meta_content_scope: meta.capture.regex.dart
281− - match: \)
282− pop: true
283− - match: \?(:|=|!)
284− scope: ignore.capture.regex.dart
285− - match: \*|\+|\?|\.|\|
286− scope: keyword.other.regex.dart
287− - match: \^|\$
288− scope: keyword.other.regex.dart
145+ punctuation:
146+ - match: ','
147+ scope: punctuation.comma.dart
148+ - match: ;
149+ scope: punctuation.terminator.dart
289150 - match: \.
290− scope: constant.other.regex.dart
291− - match: '\[(\^)?'
292− captures:
293− 1: keyword.other.negation.regex.dart
294− push:
295− - meta_scope: constant.character.range.regex.dart
296− - match: '\]'
297− pop: true
298− - match: '\\[^"'']'
299− scope: constant.character.escaped.regex.dart
300− - match: '\{(?:\d+)?,(?:\d+)?\}'
301− scope: keyword.other.regex.dart
151+ scope: punctuation.dot.dart
302152 string-interp:
303− - match: '(\$)(\{)'
153+ - match: '\$((\w+)|\{([^{}]+)\})'
304154 captures:
305− 1: keyword.other.dart
306− 2: keyword.other.dart
307− push:
308− - meta_scope: interpolation.dart
309− - meta_content_scope: source.dart
310− - match: '(\})'
311− captures:
312− 1: keyword.other.dart
313− pop: true
314− - include: main
315− - match: (\$)(\w+)
316− captures:
317− 1: keyword.other.dart
318155 2: variable.parameter.dart
156+ 3: variable.parameter.dart
319157 - match: \\.
320158 scope: constant.character.escape.dart
321159 strings:
@@ -328,7 +166,7 @@ contexts:
328166 - match: (?<!r)'''
329167 push:
330168 - meta_scope: string.interpolated.triple.single.dart
331− - match: "'''(?!')"
169+ - match: '''''''(?!'')'
332170 pop: true
333171 - include: string-interp
334172 - match: r"""
@@ -339,9 +177,9 @@ contexts:
339177 - match: r'''
340178 push:
341179 - meta_scope: string.quoted.triple.single.dart
342− - match: "'''(?!')"
180+ - match: '''''''(?!'')'
343181 pop: true
344− - match: (?<!\\|r)"
182+ - match: (?<!\|r)"
345183 push:
346184 - meta_scope: string.interpolated.double.dart
347185 - match: '"'
@@ -354,16 +192,20 @@ contexts:
354192 - meta_scope: string.quoted.double.dart
355193 - match: '"'
356194 pop: true
357− - include: regexp
195+ - match: \n
196+ scope: invalid.string.newline
358197 - match: (?<!\|r)'
359198 push:
360199 - meta_scope: string.interpolated.single.dart
361200 - match: "'"
362201 pop: true
202+ - match: \n
203+ scope: invalid.string.newline
363204 - include: string-interp
364205 - match: r'
365206 push:
366207 - meta_scope: string.quoted.single.dart
367208 - match: "'"
368209 pop: true
369− - include: regexp
210+ - match: \n
211+ scope: invalid.string.newline
assets/syntaxes/02_Extra/Fish+1−1

Submodule changed.

assets/syntaxes/02_Extra/GLSL+1−1

Submodule changed.

assets/syntaxes/02_Extra/GraphQL+1−1

Submodule changed.

assets/syntaxes/02_Extra/INI.sublime-syntax+2−2
@@ -5,8 +5,8 @@ name: INI
55file_extensions:
66 - ini
77 - INI
8− - inf
9− - INF
8+ - "inf"
9+ - "INF"
1010 - reg
1111 - REG
1212 - lng
assets/syntaxes/02_Extra/MediaWiki+1−1

Submodule changed.

assets/syntaxes/02_Extra/Nginx+1−1

Submodule changed.

assets/syntaxes/02_Extra/Nim.sublime-syntax+1
@@ -5,6 +5,7 @@ name: Nim
55file_extensions:
66 - nim
77 - nims
8+ - nimble
89scope: source.nim
910contexts:
1011 main:
assets/syntaxes/02_Extra/PowerShell+1−1

Submodule changed.

assets/syntaxes/02_Extra/PowerShell.sublime-syntax+58−48
@@ -24,7 +24,7 @@ contexts:
2424 - include: commands
2525 - include: commentLine
2626 - include: variable
27− - include: interpolatedStringContent
27+ - include: subexpression
2828 - include: function
2929 - include: attribute
3030 - include: UsingDirective
@@ -33,32 +33,38 @@ contexts:
3333 - include: doubleQuotedString
3434 - include: scriptblock
3535 - include: doubleQuotedStringEscapes
36− - match: (?<!')'
36+ - match: '[''\x{2018}-\x{201B}]'
3737 captures:
3838 0: punctuation.definition.string.begin.powershell
3939 push:
4040 - meta_scope: string.quoted.single.powershell
41− - match: "'(?!')"
41+ - match: '[''\x{2018}-\x{201B}]{2}'
42+ scope: constant.character.escape.powershell
43+ - match: '[''\x{2018}-\x{201B}]'
4244 captures:
4345 0: punctuation.definition.string.end.powershell
4446 pop: true
45− - match: "''"
46− scope: constant.character.escape.powershell
47− - match: \@"(?=$)
47+ - match: '(@["\x{201C}-\x{201E}])\s*$'
48+ captures:
49+ 1: punctuation.definition.string.begin.powershell
4850 push:
4951 - meta_scope: string.quoted.double.heredoc.powershell
50− - match: ^"@
52+ - match: '^["\x{201C}-\x{201E}]@'
53+ captures:
54+ 0: punctuation.definition.string.end.powershell
5155 pop: true
5256 - include: variableNoProperty
5357 - include: doubleQuotedStringEscapes
5458 - include: interpolation
55− - match: \@'(?=$)
59+ - match: '(@[''\x{2018}-\x{201B}])\s*$'
60+ captures:
61+ 1: punctuation.definition.string.begin.powershell
5662 push:
5763 - meta_scope: string.quoted.single.heredoc.powershell
58− - match: ^'@
64+ - match: '^[''\x{2018}-\x{201B}]@'
65+ captures:
66+ 0: punctuation.definition.string.end.powershell
5967 pop: true
60− - match: "''"
61− scope: constant.character.escape.powershell
6268 - include: numericConstant
6369 - match: (@)(\()
6470 captures:
@@ -71,11 +77,12 @@ contexts:
7177 0: punctuation.section.group.end.powershell
7278 pop: true
7379 - include: main
74− - match: (\$)(\()
80+ - match: ((\$))(\()
7581 comment: "TODO: move to repo; make recursive."
7682 captures:
77− 1: punctuation.definition.variable.powershell
78− 2: punctuation.section.group.begin.powershell
83+ 1: keyword.other.substatement.powershell
84+ 2: punctuation.definition.subexpression.powershell
85+ 3: punctuation.section.group.begin.powershell
7986 push:
8087 - meta_scope: meta.group.complex.subexpression.powershell
8188 - match: \)
@@ -85,7 +92,7 @@ contexts:
8592 - include: main
8693 - match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
8794 scope: support.function.powershell
88− - 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)
95+ - 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)
8996 scope: keyword.control.powershell
9097 - match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
9198 scope: keyword.control.powershell
@@ -135,7 +142,7 @@ contexts:
135142 - meta_scope: meta.requires.powershell
136143 - match: $
137144 pop: true
138− - match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
145+ - match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version|Assembly|PSEdition)
139146 scope: keyword.other.powershell
140147 - match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
141148 scope: variable.parameter.powershell
@@ -187,51 +194,53 @@ contexts:
187194 comment: Builtin cmdlets with reserved verbs
188195 scope: support.function.powershell
189196 commentEmbeddedDocs:
190− - match: ^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))
197+ - match: (?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$
198+ comment: these embedded doc keywords do not support arguments, must be the only thing on the line
191199 scope: comment.documentation.embedded.powershell
192200 captures:
193201 1: constant.string.documentation.powershell
194202 2: keyword.operator.documentation.powershell
195− - match: '(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))'
203+ - match: (?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$
204+ 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
196205 scope: comment.documentation.embedded.powershell
197206 captures:
198207 1: constant.string.documentation.powershell
199208 2: keyword.operator.documentation.powershell
200209 3: keyword.operator.documentation.powershell
201210 commentLine:
202− - match: '(?<![`\\-])#'
211+ - match: '(?<![`\\-])(#)#*'
203212 captures:
204− 0: punctuation.definition.comment.powershell
213+ 1: punctuation.definition.comment.powershell
205214 push:
206215 - meta_scope: comment.line.powershell
207216 - match: $\n?
208217 captures:
209− 0: punctuation.definition.comment.powershell
218+ 1: punctuation.definition.comment.powershell
210219 pop: true
211220 - include: commentEmbeddedDocs
212221 - include: RequiresDirective
213222 doubleQuotedString:
214− - match: (?<!(?<!`)")"
223+ - match: '["\x{201C}-\x{201E}]'
215224 captures:
216225 0: punctuation.definition.string.begin.powershell
217226 push:
218227 - meta_scope: string.quoted.double.powershell
219− - match: '"(?!")'
220− captures:
221− 0: punctuation.definition.string.end.powershell
222− pop: true
223228 - match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
224229 - include: variableNoProperty
225230 - include: doubleQuotedStringEscapes
231+ - match: '["\x{201C}-\x{201E}]{2}'
232+ scope: constant.character.escape.powershell
226233 - include: interpolation
227234 - match: '`\s*$'
228235 scope: keyword.other.powershell
236+ - match: '["\x{201C}-\x{201E}]'
237+ captures:
238+ 0: punctuation.definition.string.end.powershell
239+ pop: true
229240 doubleQuotedStringEscapes:
230− - match: '`[`0abefnrtv"''$]'
241+ - match: '`[`0abefnrtv''"\x{2018}-\x{201E}$]'
231242 scope: constant.character.escape.powershell
232243 - include: unicodeEscape
233− - match: '""'
234− scope: constant.character.escape.powershell
235244 function:
236245 - match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
237246 captures:
@@ -263,33 +272,23 @@ contexts:
263272 4: keyword.operator.assignment.powershell
264273 - include: scriptblock
265274 - include: main
266− interpolatedStringContent:
267− - match: \(
268− captures:
269− 0: punctuation.section.group.begin.powershell
270− push:
271− - meta_content_scope: interpolated.simple.source.powershell
272− - match: \)
273− captures:
274− 0: punctuation.section.group.end.powershell
275− pop: true
276− - include: main
277− - include: interpolation
278− - include: interpolatedStringContent
279275 interpolation:
280− - match: (\$)(\()
276+ - match: (((\$)))((\())
281277 captures:
282− 1: punctuation.definition.variable.powershell
283− 2: punctuation.section.group.begin.powershell
278+ 1: keyword.other.substatement.powershell
279+ 2: punctuation.definition.substatement.powershell
280+ 3: punctuation.section.embedded.substatement.begin.powershell
281+ 4: punctuation.section.group.begin.powershell
282+ 5: punctuation.section.embedded.substatement.begin.powershell
284283 push:
284+ - meta_scope: meta.embedded.substatement.powershell
285285 - meta_content_scope: interpolated.complex.source.powershell
286− - match: \)
286+ - match: (\))
287287 captures:
288288 0: punctuation.section.group.end.powershell
289+ 1: punctuation.section.embedded.substatement.end.powershell
289290 pop: true
290291 - include: main
291− - include: interpolation
292− - include: interpolatedStringContent
293292 numericConstant:
294293 - 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'
295294 captures:
@@ -330,6 +329,17 @@ contexts:
330329 0: punctuation.section.braces.end.powershell
331330 pop: true
332331 - include: main
332+ subexpression:
333+ - match: \(
334+ captures:
335+ 0: punctuation.section.group.begin.powershell
336+ push:
337+ - meta_scope: meta.group.simple.subexpression.powershell
338+ - match: \)
339+ captures:
340+ 0: punctuation.section.group.end.powershell
341+ pop: true
342+ - include: main
333343 type:
334344 - match: '\['
335345 captures:
assets/syntaxes/02_Extra/SCSS_Sass+1−1

Submodule changed.

assets/syntaxes/02_Extra/Stylus.sublime-syntax+2−2
@@ -197,7 +197,7 @@ contexts:
197197 scope: entity.other.attribute-name.stylus
198198 - match: |-
199199 (?x) # multi-line regex definition mode
200− (?<=^|;|{)\s* # starts after begining of line, '{' or ';''
200+ (?<=^|;|{)\s* # starts after beginning of line, '{' or ';''
201201 (?= # lookahead for
202202 (
203203 [a-zA-Z0-9_-] # then a letter
@@ -207,7 +207,7 @@ contexts:
207207 (/\*.*?\*/) # comment
208208 )+
209209
210− \s*[:\s]\s* # value is separted by colon or space
210+ \s*[:\s]\s* # value is separated by colon or space
211211
212212 (?!(\s*\{)) # if there are only spaces afterwards
213213
assets/syntaxes/02_Extra/SublimeJQnew file+1

Submodule changed.

assets/syntaxes/02_Extra/TOML+1−1

Submodule changed.

assets/syntaxes/02_Extra/TypeScript+1−1

Submodule changed.

assets/syntaxes/02_Extra/TypeScript.sublime-syntax+206−148
@@ -44,7 +44,7 @@ contexts:
4444 - match: (?=$)
4545 pop: true
4646 access-modifier:
47− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static|declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
47+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|declare|override|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
4848 scope: storage.modifier.ts
4949 after-operator-block-as-object-literal:
5050 - 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:
106106 (?=
107107 # sure shot arrow functions even if => is on new line
108108 (
109− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
109+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
110110 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
111111 (
112112 ([)]\s*:) | # ():
@@ -116,9 +116,9 @@ contexts:
116116
117117 # arrow function possible to detect only with => on same line
118118 (
119− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
120− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
121− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
119+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
120+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
121+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
122122 \s*=> # arrow operator
123123 )
124124 )
@@ -268,7 +268,7 @@ contexts:
268268 - include: decorator
269269 - match: (?<=:)\s*
270270 push:
271− - match: '(?=\s|[;),}\]:\-\+]|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
271+ - match: '(?=\s|[;),}\]:\-\+]|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
272272 pop: true
273273 - include: expression
274274 - include: method-declaration
@@ -317,7 +317,12 @@ contexts:
317317 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
318318 scope: keyword.control.loop.ts
319319 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
320− scope: keyword.control.flow.ts
320+ captures:
321+ 0: keyword.control.flow.ts
322+ push:
323+ - match: '(?=[;}]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
324+ pop: true
325+ - include: expression
321326 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
322327 scope: keyword.control.switch.ts
323328 - include: if-statement
@@ -762,7 +767,7 @@ contexts:
762767 4: keyword.control.default.ts
763768 push:
764769 - meta_scope: meta.export.default.ts
765− - match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
770+ - match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
766771 pop: true
767772 - include: interface-declaration
768773 - include: expression
@@ -772,7 +777,7 @@ contexts:
772777 2: keyword.control.type.ts
773778 push:
774779 - meta_scope: meta.export.ts
775− - match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
780+ - match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
776781 pop: true
777782 - include: import-export-declaration
778783 expression:
@@ -785,11 +790,11 @@ contexts:
785790 - include: string
786791 - include: decorator
787792 - include: destructuring-parameter
788− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
793+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
789794 captures:
790795 1: storage.modifier.ts
791796 - match: |-
792− (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
797+ (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
793798 # function assignment |
794799 (=\s*(
795800 ((async\s+)?(
@@ -798,10 +803,10 @@ contexts:
798803 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
799804 )) |
800805 ((async\s*)?(
801− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
806+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
802807 # sure shot arrow functions even if => is on new line
803808 (
804− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
809+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
805810 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
806811 (
807812 ([)]\s*:) | # ():
@@ -811,9 +816,9 @@ contexts:
811816
812817 # arrow function possible to detect only with => on same line
813818 (
814− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
815− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
816− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
819+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
820+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
821+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
817822 \s*=> # arrow operator
818823 )
819824 ))
@@ -831,18 +836,18 @@ contexts:
831836 ))
832837 )) |
833838 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
834− (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
835− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
839+ (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
840+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
836841 ((async\s+)?(
837842 (function\s*[(<*]) |
838843 (function\s+) |
839844 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
840845 )) |
841846 ((async\s*)?(
842− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
847+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
843848 # sure shot arrow functions even if => is on new line
844849 (
845− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
850+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
846851 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
847852 (
848853 ([)]\s*:) | # ():
@@ -852,9 +857,9 @@ contexts:
852857
853858 # arrow function possible to detect only with => on same line
854859 (
855− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
856− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
857− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
860+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
861+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
862+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
858863 \s*=> # arrow operator
859864 )
860865 ))
@@ -865,7 +870,7 @@ contexts:
865870 3: entity.name.function.ts variable.language.this.ts
866871 4: entity.name.function.ts
867872 5: keyword.operator.optional.ts
868− - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
873+ - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
869874 captures:
870875 1: storage.modifier.ts
871876 2: keyword.operator.rest.ts
@@ -930,10 +935,11 @@ contexts:
930935 scope: keyword.operator.comparison.ts
931936 - match: <=|>=|<>|<|>
932937 scope: keyword.operator.relational.ts
933− - match: '(?<=[_$[:alnum:]])(\!)\s*(/)(?![/*])'
938+ - match: '(?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*])))'
934939 captures:
935940 1: keyword.operator.logical.ts
936− 2: keyword.operator.arithmetic.ts
941+ 2: keyword.operator.assignment.compound.ts
942+ 3: keyword.operator.arithmetic.ts
937943 - match: \!|&&|\|\||\?\?
938944 scope: keyword.operator.logical.ts
939945 - match: \&|~|\^|\|
@@ -946,16 +952,18 @@ contexts:
946952 scope: keyword.operator.increment.ts
947953 - match: '%|\*|/|-|\+'
948954 scope: keyword.operator.arithmetic.ts
949− - match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(/)(?![/*]))'
955+ - match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*]))))'
950956 push:
951− - match: '(/)(?!\*([^\*]|(\*[^\/]))*\*\/)'
957+ - match: '(?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/)))'
952958 captures:
953− 1: keyword.operator.arithmetic.ts
959+ 1: keyword.operator.assignment.compound.ts
960+ 2: keyword.operator.arithmetic.ts
954961 pop: true
955962 - include: comment
956− - match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])'
963+ - match: '(?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*])))'
957964 captures:
958− 1: keyword.operator.arithmetic.ts
965+ 1: keyword.operator.assignment.compound.ts
966+ 2: keyword.operator.arithmetic.ts
959967 expressionPunctuations:
960968 - include: punctuation-comma
961969 - include: punctuation-accessor
@@ -1021,10 +1029,10 @@ contexts:
10211029 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
10221030 )) |
10231031 ((async\s*)?(
1024− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1032+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
10251033 # sure shot arrow functions even if => is on new line
10261034 (
1027− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1035+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
10281036 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
10291037 (
10301038 ([)]\s*:) | # ():
@@ -1034,9 +1042,9 @@ contexts:
10341042
10351043 # arrow function possible to detect only with => on same line
10361044 (
1037− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1038− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1039− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1045+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1046+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1047+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
10401048 \s*=> # arrow operator
10411049 )
10421050 ))
@@ -1054,18 +1062,18 @@ contexts:
10541062 ))
10551063 )) |
10561064 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
1057− (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
1058− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
1065+ (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
1066+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
10591067 ((async\s+)?(
10601068 (function\s*[(<*]) |
10611069 (function\s+) |
10621070 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
10631071 )) |
10641072 ((async\s*)?(
1065− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1073+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
10661074 # sure shot arrow functions even if => is on new line
10671075 (
1068− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1076+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
10691077 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
10701078 (
10711079 ([)]\s*:) | # ():
@@ -1075,9 +1083,9 @@ contexts:
10751083
10761084 # arrow function possible to detect only with => on same line
10771085 (
1078− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1079− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1080− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1086+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1087+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1088+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
10811089 \s*=> # arrow operator
10821090 )
10831091 ))
@@ -1118,18 +1126,19 @@ contexts:
11181126 - include: type-parameters
11191127 - include: function-parameters
11201128 - include: return-type
1129+ - include: type-function-return-type
11211130 - include: decl-block
11221131 - match: \*
11231132 scope: keyword.generator.asterisk.ts
11241133 function-call:
1125− - 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*)?\())'
1134+ - 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*)?\())'
11261135 push:
1127− - 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*)?\())'
1136+ - 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*)?\())'
11281137 pop: true
11291138 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
11301139 push:
11311140 - meta_scope: meta.function-call.ts
1132− - 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*)?\())'
1141+ - 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*)?\())'
11331142 pop: true
11341143 - include: function-call-target
11351144 - include: comment
@@ -1169,7 +1178,7 @@ contexts:
11691178 6: meta.definition.function.ts entity.name.function.ts
11701179 push:
11711180 - meta_scope: meta.function.ts
1172− - match: '(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
1181+ - match: '(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
11731182 pop: true
11741183 - include: function-name
11751184 - include: function-body
@@ -1221,10 +1230,10 @@ contexts:
12211230 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
12221231 )) |
12231232 ((async\s*)?(
1224− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1233+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
12251234 # sure shot arrow functions even if => is on new line
12261235 (
1227− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1236+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
12281237 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
12291238 (
12301239 ([)]\s*:) | # ():
@@ -1234,9 +1243,9 @@ contexts:
12341243
12351244 # arrow function possible to detect only with => on same line
12361245 (
1237− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1238− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1239− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1246+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1247+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1248+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
12401249 \s*=> # arrow operator
12411250 )
12421251 ))
@@ -1260,7 +1269,7 @@ contexts:
12601269 - match: "[_$[:alpha:]][_$[:alnum:]]*"
12611270 scope: variable.other.readwrite.ts
12621271 if-statement:
1263− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\([^\(\)]*\)))*\))\s*(?!\{))'
1272+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))\s*(?!\{))'
12641273 push:
12651274 - match: '(?=;|$|\})'
12661275 pop: true
@@ -1275,12 +1284,12 @@ contexts:
12751284 0: meta.brace.round.ts
12761285 pop: true
12771286 - include: expression
1278− - match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
1287+ - match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
12791288 captures:
12801289 0: punctuation.definition.string.begin.ts
12811290 push:
12821291 - meta_scope: string.regexp.ts
1283− - match: "(/)([gimsuy]*)"
1292+ - match: "(/)([dgimsuy]*)"
12841293 captures:
12851294 1: punctuation.definition.string.end.ts
12861295 2: keyword.other.ts
@@ -1414,6 +1423,9 @@ contexts:
14141423 2: keyword.operator.type.modifier.ts
14151424 3: keyword.operator.optional.ts
14161425 pop: true
1426+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
1427+ captures:
1428+ 1: keyword.control.as.ts
14171429 - include: type
14181430 inline-tags:
14191431 - match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
@@ -1504,25 +1516,27 @@ contexts:
15041516 - include: this-literal
15051517 - include: super-literal
15061518 method-declaration:
1507− - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1519+ - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
15081520 captures:
15091521 1: storage.modifier.ts
15101522 2: storage.modifier.ts
1511− 3: storage.modifier.async.ts
1512− 4: storage.type.ts
1523+ 3: storage.modifier.ts
1524+ 4: storage.modifier.async.ts
1525+ 5: storage.type.ts
15131526 push:
15141527 - meta_scope: meta.method.declaration.ts
15151528 - match: '(?=\}|;|,|$)|(?<=\})'
15161529 pop: true
15171530 - include: method-declaration-name
15181531 - include: function-body
1519− - 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*))?[\(])'
1532+ - 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*))?[\(])'
15201533 captures:
15211534 1: storage.modifier.ts
15221535 2: storage.modifier.ts
1523− 3: storage.modifier.async.ts
1524− 4: keyword.operator.new.ts
1525− 5: keyword.generator.asterisk.ts
1536+ 3: storage.modifier.ts
1537+ 4: storage.modifier.async.ts
1538+ 5: keyword.operator.new.ts
1539+ 6: keyword.generator.asterisk.ts
15261540 push:
15271541 - meta_scope: meta.method.declaration.ts
15281542 - match: '(?=\}|;|,|$)|(?<=\})'
@@ -1530,7 +1544,7 @@ contexts:
15301544 - include: method-declaration-name
15311545 - include: function-body
15321546 - match: |-
1533− (?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(?!\$))|((?<!\$)(?:
1547+ (?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(?!\$))|((?<!\$)(?:
15341548 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
15351549 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
15361550 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
@@ -1539,13 +1553,14 @@ contexts:
15391553 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
15401554 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
15411555 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1542− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
1556+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
15431557 captures:
15441558 1: storage.modifier.ts
15451559 2: storage.modifier.ts
1546− 3: storage.modifier.async.ts
1547− 4: storage.type.property.ts
1548− 5: keyword.generator.asterisk.ts
1560+ 3: storage.modifier.ts
1561+ 4: storage.modifier.async.ts
1562+ 5: storage.type.property.ts
1563+ 6: keyword.generator.asterisk.ts
15491564 push:
15501565 - meta_scope: meta.method.declaration.ts
15511566 - match: '(?=\}|;|,|$)|(?<=\})'
@@ -1582,7 +1597,7 @@ contexts:
15821597 3: storage.type.namespace.ts
15831598 push:
15841599 - meta_scope: meta.namespace.declaration.ts
1585− - match: '(?<=\})|(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
1600+ - match: '(?<=\})|(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
15861601 pop: true
15871602 - include: comment
15881603 - include: string
@@ -1598,9 +1613,7 @@ contexts:
15981613 - meta_scope: new.expr.ts
15991614 - match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
16001615 pop: true
1601− - include: paren-expression
1602− - include: class-declaration
1603− - include: type
1616+ - include: expression
16041617 null-literal:
16051618 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
16061619 scope: constant.language.null.ts
@@ -1781,7 +1794,7 @@ contexts:
17811794 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
17821795 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
17831796 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1784− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
1797+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
17851798 captures:
17861799 1: storage.modifier.async.ts
17871800 2: storage.type.property.ts
@@ -1802,7 +1815,7 @@ contexts:
18021815 (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
18031816 (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
18041817 (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1805− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
1818+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
18061819 captures:
18071820 1: storage.modifier.async.ts
18081821 2: storage.type.property.ts
@@ -1864,10 +1877,10 @@ contexts:
18641877 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
18651878 )) |
18661879 ((async\s*)?(
1867− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1880+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
18681881 # sure shot arrow functions even if => is on new line
18691882 (
1870− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1883+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
18711884 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
18721885 (
18731886 ([)]\s*:) | # ():
@@ -1877,9 +1890,9 @@ contexts:
18771890
18781891 # arrow function possible to detect only with => on same line
18791892 (
1880− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1881− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1882− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1893+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1894+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1895+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
18831896 \s*=> # arrow operator
18841897 )
18851898 ))
@@ -1930,7 +1943,7 @@ contexts:
19301943 - meta_scope: meta.object.member.ts
19311944 - match: '(?=,|\})'
19321945 pop: true
1933− - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
1946+ - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
19341947 captures:
19351948 1: storage.modifier.async.ts
19361949 push:
@@ -1946,7 +1959,7 @@ contexts:
19461959 0: meta.brace.round.ts
19471960 pop: true
19481961 - include: expression-inside-possibly-arrow-parens
1949− - match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
1962+ - match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
19501963 captures:
19511964 1: storage.modifier.async.ts
19521965 2: meta.brace.round.ts
@@ -1963,7 +1976,7 @@ contexts:
19631976 - match: (?<=\>)
19641977 pop: true
19651978 - include: type-parameters
1966− - match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
1979+ - match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
19671980 captures:
19681981 1: meta.brace.round.ts
19691982 push:
@@ -1997,11 +2010,11 @@ contexts:
19972010 - include: destructuring-parameter-rest
19982011 - include: variable-initializer
19992012 parameter-name:
2000− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
2013+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
20012014 captures:
20022015 1: storage.modifier.ts
20032016 - match: |-
2004− (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
2017+ (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
20052018 # function assignment |
20062019 (=\s*(
20072020 ((async\s+)?(
@@ -2010,10 +2023,10 @@ contexts:
20102023 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
20112024 )) |
20122025 ((async\s*)?(
2013− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
2026+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
20142027 # sure shot arrow functions even if => is on new line
20152028 (
2016− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2029+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
20172030 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
20182031 (
20192032 ([)]\s*:) | # ():
@@ -2023,9 +2036,9 @@ contexts:
20232036
20242037 # arrow function possible to detect only with => on same line
20252038 (
2026− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2027− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2028− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
2039+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2040+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2041+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
20292042 \s*=> # arrow operator
20302043 )
20312044 ))
@@ -2043,18 +2056,18 @@ contexts:
20432056 ))
20442057 )) |
20452058 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
2046− (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
2047− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
2059+ (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
2060+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
20482061 ((async\s+)?(
20492062 (function\s*[(<*]) |
20502063 (function\s+) |
20512064 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
20522065 )) |
20532066 ((async\s*)?(
2054− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
2067+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
20552068 # sure shot arrow functions even if => is on new line
20562069 (
2057− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2070+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
20582071 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
20592072 (
20602073 ([)]\s*:) | # ():
@@ -2064,9 +2077,9 @@ contexts:
20642077
20652078 # arrow function possible to detect only with => on same line
20662079 (
2067− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2068− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2069− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
2080+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2081+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2082+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
20702083 \s*=> # arrow operator
20712084 )
20722085 ))
@@ -2077,7 +2090,7 @@ contexts:
20772090 3: entity.name.function.ts variable.language.this.ts
20782091 4: entity.name.function.ts
20792092 5: keyword.operator.optional.ts
2080− - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
2093+ - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
20812094 captures:
20822095 1: storage.modifier.ts
20832096 2: keyword.operator.rest.ts
@@ -2137,14 +2150,14 @@ contexts:
21372150 pop: true
21382151 - include: expression
21392152 paren-expression-possibly-arrow:
2140− - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
2153+ - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
21412154 captures:
21422155 1: storage.modifier.async.ts
21432156 push:
21442157 - match: (?<=\))
21452158 pop: true
21462159 - include: paren-expression-possibly-arrow-with-typeparameters
2147− - match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
2160+ - match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
21482161 captures:
21492162 1: storage.modifier.async.ts
21502163 push:
@@ -2164,7 +2177,7 @@ contexts:
21642177 pop: true
21652178 - include: expression-inside-possibly-arrow-parens
21662179 possibly-arrow-return-type:
2167− - match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
2180+ - match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
21682181 captures:
21692182 1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
21702183 push:
@@ -2211,23 +2224,23 @@ contexts:
22112224 pop: true
22122225 - include: string-character-escape
22132226 regex:
2214− - match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
2227+ - match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
22152228 captures:
22162229 1: punctuation.definition.string.begin.ts
22172230 push:
22182231 - meta_scope: string.regexp.ts
2219− - match: "(/)([gimsuy]*)"
2232+ - match: "(/)([dgimsuy]*)"
22202233 captures:
22212234 1: punctuation.definition.string.end.ts
22222235 2: keyword.other.ts
22232236 pop: true
22242237 - include: regexp
2225− - match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
2238+ - match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
22262239 captures:
22272240 0: punctuation.definition.string.begin.ts
22282241 push:
22292242 - meta_scope: string.regexp.ts
2230− - match: "(/)([gimsuy]*)"
2243+ - match: "(/)([dgimsuy]*)"
22312244 captures:
22322245 1: punctuation.definition.string.end.ts
22332246 2: keyword.other.ts
@@ -2430,7 +2443,7 @@ contexts:
24302443 4: support.variable.property.target.ts
24312444 - match: |-
24322445 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
2433− (?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
2446+ (?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
24342447 |
24352448 (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
24362449 captures:
@@ -2536,7 +2549,7 @@ contexts:
25362549 |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
25372550 |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
25382551 |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
2539− |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
2552+ |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
25402553 captures:
25412554 1: punctuation.accessor.ts
25422555 2: punctuation.accessor.optional.ts
@@ -2703,20 +2716,34 @@ contexts:
27032716 0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
27042717 - include: statements
27052718 template:
2706− - 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*)?`)'
2719+ - include: template-call
2720+ - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
2721+ captures:
2722+ 1: entity.name.function.tagged-template.ts
2723+ 2: punctuation.definition.string.template.begin.ts
2724+ push:
2725+ - meta_scope: string.template.ts
2726+ - match: "`"
2727+ captures:
2728+ 0: punctuation.definition.string.template.end.ts
2729+ pop: true
2730+ - include: template-substitution-element
2731+ - include: string-character-escape
2732+ template-call:
2733+ - 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*)?`)'
27072734 push:
27082735 - meta_scope: string.template.ts
27092736 - match: (?=`)
27102737 pop: true
27112738 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
27122739 push:
2713− - 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*)?`)'
2740+ - 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*)?`)'
27142741 pop: true
27152742 - include: support-function-call-identifiers
27162743 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
27172744 scope: entity.name.function.tagged-template.ts
27182745 - include: type-arguments
2719− - 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*)`)'
2746+ - 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*)`)'
27202747 captures:
27212748 1: entity.name.function.tagged-template.ts
27222749 push:
@@ -2724,6 +2751,20 @@ contexts:
27242751 - match: (?=`)
27252752 pop: true
27262753 - include: type-arguments
2754+ template-substitution-element:
2755+ - match: '\$\{'
2756+ captures:
2757+ 0: punctuation.definition.template-expression.begin.ts
2758+ push:
2759+ - meta_scope: meta.template.expression.ts
2760+ - meta_content_scope: meta.embedded.line.ts
2761+ - match: '\}'
2762+ captures:
2763+ 0: punctuation.definition.template-expression.end.ts
2764+ pop: true
2765+ - include: expression
2766+ template-type:
2767+ - include: template-call
27272768 - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
27282769 captures:
27292770 1: entity.name.function.tagged-template.ts
@@ -2734,9 +2775,9 @@ contexts:
27342775 captures:
27352776 0: punctuation.definition.string.template.end.ts
27362777 pop: true
2737− - include: template-substitution-element
2778+ - include: template-type-substitution-element
27382779 - include: string-character-escape
2739− template-substitution-element:
2780+ template-type-substitution-element:
27402781 - match: '\$\{'
27412782 captures:
27422783 0: punctuation.definition.template-expression.begin.ts
@@ -2747,7 +2788,7 @@ contexts:
27472788 captures:
27482789 0: punctuation.definition.template-expression.end.ts
27492790 pop: true
2750− - include: expression
2791+ - include: type
27512792 ternary-expression:
27522793 - match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
27532794 captures:
@@ -2763,7 +2804,7 @@ contexts:
27632804 scope: variable.language.this.ts
27642805 type:
27652806 - include: comment
2766− - include: string
2807+ - include: type-string
27672808 - include: numeric-literal
27682809 - include: type-primitive
27692810 - include: type-builtin-literals
@@ -2788,15 +2829,23 @@ contexts:
27882829 4: entity.name.type.alias.ts
27892830 push:
27902831 - meta_scope: meta.type.declaration.ts
2791− - match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
2832+ - match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
27922833 pop: true
27932834 - include: comment
27942835 - include: type-parameters
2836+ - match: '(=)\s*(intrinsic)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2837+ captures:
2838+ 1: keyword.operator.assignment.ts
2839+ 2: keyword.control.intrinsic.ts
2840+ push:
2841+ - match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
2842+ pop: true
2843+ - include: type
27952844 - match: (=)\s*
27962845 captures:
27972846 1: keyword.operator.assignment.ts
27982847 push:
2799− - match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
2848+ - match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
28002849 pop: true
28012850 - include: type
28022851 type-annotation:
@@ -2854,17 +2903,19 @@ contexts:
28542903 - include: type
28552904 - include: type
28562905 type-fn-type-parameters:
2857− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)'
2906+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<)'
28582907 captures:
2859− 1: meta.type.constructor.ts keyword.control.new.ts
2908+ 1: meta.type.constructor.ts storage.modifier.ts
2909+ 2: meta.type.constructor.ts keyword.control.new.ts
28602910 push:
28612911 - match: (?<=>)
28622912 pop: true
28632913 - include: comment
28642914 - include: type-parameters
2865− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()'
2915+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\()'
28662916 captures:
2867− 1: keyword.control.new.ts
2917+ 1: storage.modifier.ts
2918+ 2: keyword.control.new.ts
28682919 push:
28692920 - meta_scope: meta.type.constructor.ts
28702921 - match: (?<=\))
@@ -2993,8 +3044,6 @@ contexts:
29933044 scope: keyword.operator.ternary.ts
29943045 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
29953046 scope: keyword.operator.expression.infer.ts
2996− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))awaited(?=\s+[_$[:alpha:]])'
2997− scope: keyword.operator.expression.awaited.ts
29983047 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
29993048 scope: keyword.operator.expression.import.ts
30003049 type-parameters:
@@ -3037,7 +3086,7 @@ contexts:
30373086 ))
30383087 )) |
30393088 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3040− (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
3089+ (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
30413090 captures:
30423091 1: storage.modifier.ts
30433092 2: keyword.operator.rest.ts
@@ -3074,6 +3123,10 @@ contexts:
30743123 type-primitive:
30753124 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
30763125 scope: support.type.primitive.ts
3126+ type-string:
3127+ - include: qstring-single
3128+ - include: qstring-double
3129+ - include: template-type
30773130 type-tuple:
30783131 - match: '\['
30793132 captures:
@@ -3095,7 +3148,12 @@ contexts:
30953148 - include: punctuation-comma
30963149 typeof-operator:
30973150 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3098− scope: keyword.operator.expression.typeof.ts
3151+ captures:
3152+ 0: keyword.operator.expression.typeof.ts
3153+ push:
3154+ - match: '(?=[,);}\]=>:&|{\?]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
3155+ pop: true
3156+ - include: expression
30993157 undefined-literal:
31003158 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
31013159 scope: constant.language.undefined.ts
@@ -3103,7 +3161,7 @@ contexts:
31033161 - match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
31043162 push:
31053163 - meta_scope: meta.var.expr.ts
3106− - 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*$)))'
3164+ - 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*$)))'
31073165 pop: true
31083166 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
31093167 captures:
@@ -3136,7 +3194,7 @@ contexts:
31363194 3: storage.type.ts
31373195 push:
31383196 - meta_scope: meta.var.expr.ts
3139− - 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*$)))'
3197+ - 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*$)))'
31403198 pop: true
31413199 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
31423200 captures:
@@ -3173,10 +3231,10 @@ contexts:
31733231 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
31743232 )) |
31753233 ((async\s*)?(
3176− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3234+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
31773235 # sure shot arrow functions even if => is on new line
31783236 (
3179− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3237+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
31803238 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
31813239 (
31823240 ([)]\s*:) | # ():
@@ -3186,9 +3244,9 @@ contexts:
31863244
31873245 # arrow function possible to detect only with => on same line
31883246 (
3189− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3190− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3191− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3247+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3248+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3249+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
31923250 \s*=> # arrow operator
31933251 )
31943252 ))
@@ -3206,18 +3264,18 @@ contexts:
32063264 ))
32073265 )) |
32083266 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3209− (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3210− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
3267+ (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3268+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
32113269 ((async\s+)?(
32123270 (function\s*[(<*]) |
32133271 (function\s+) |
32143272 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
32153273 )) |
32163274 ((async\s*)?(
3217− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3275+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
32183276 # sure shot arrow functions even if => is on new line
32193277 (
3220− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3278+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
32213279 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
32223280 (
32233281 ([)]\s*:) | # ():
@@ -3227,9 +3285,9 @@ contexts:
32273285
32283286 # arrow function possible to detect only with => on same line
32293287 (
3230− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3231− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3232− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3288+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3289+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3290+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
32333291 \s*=> # arrow operator
32343292 )
32353293 ))
@@ -3260,10 +3318,10 @@ contexts:
32603318 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
32613319 )) |
32623320 ((async\s*)?(
3263− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3321+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
32643322 # sure shot arrow functions even if => is on new line
32653323 (
3266− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3324+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
32673325 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
32683326 (
32693327 ([)]\s*:) | # ():
@@ -3273,9 +3331,9 @@ contexts:
32733331
32743332 # arrow function possible to detect only with => on same line
32753333 (
3276− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3277− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3278− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3334+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3335+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3336+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
32793337 \s*=> # arrow operator
32803338 )
32813339 ))
@@ -3293,18 +3351,18 @@ contexts:
32933351 ))
32943352 )) |
32953353 (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3296− (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3297− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
3354+ (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3355+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
32983356 ((async\s+)?(
32993357 (function\s*[(<*]) |
33003358 (function\s+) |
33013359 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
33023360 )) |
33033361 ((async\s*)?(
3304− ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
3362+ ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
33053363 # sure shot arrow functions even if => is on new line
33063364 (
3307− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3365+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
33083366 [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
33093367 (
33103368 ([)]\s*:) | # ():
@@ -3314,9 +3372,9 @@ contexts:
33143372
33153373 # arrow function possible to detect only with => on same line
33163374 (
3317− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3318− \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3319− (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
3375+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3376+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3377+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
33203378 \s*=> # arrow operator
33213379 )
33223380 ))
assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax+896−477
@@ -9,10 +9,7 @@ contexts:
99 main:
1010 - include: directives
1111 - include: statements
12− - match: \A(#!).*(?=$)
13− scope: comment.line.shebang.ts
14− captures:
15− 1: punctuation.definition.comment.ts
12+ - include: shebang
1613 comment:
1714 - match: /\*\*(?!/)
1815 captures:
@@ -44,10 +41,10 @@ contexts:
4441 5: punctuation.decorator.internaldeclaration.tsx
4542 push:
4643 - meta_content_scope: comment.line.double-slash.tsx
47− - match: (?=^)
44+ - match: (?=$)
4845 pop: true
4946 access-modifier:
50− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
47+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|declare|override|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
5148 scope: storage.modifier.tsx
5249 after-operator-block-as-object-literal:
5350 - match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
@@ -109,8 +106,8 @@ contexts:
109106 (?=
110107 # sure shot arrow functions even if => is on new line
111108 (
112− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
113− [(]\s*
109+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
110+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
114111 (
115112 ([)]\s*:) | # ():
116113 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -121,9 +118,9 @@ contexts:
121118 ) |
122119 # arrow function possible to detect only with => on same line
123120 (
124− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
125− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
126− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
121+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
122+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
123+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
127124 \s*=> # arrow operator
128125 )
129126 )
@@ -138,13 +135,15 @@ contexts:
138135 - include: type-parameters
139136 - include: function-parameters
140137 - include: arrow-return-type
138+ - include: possibly-arrow-return-type
141139 - match: "=>"
142140 captures:
143141 0: storage.type.function.arrow.tsx
144142 push:
145143 - meta_scope: meta.arrow.tsx
146− - match: '(?<=\}|\S)(?<!=>)|((?!\{)(?=\S))'
144+ - match: '((?<=\}|\S)(?<!=>)|((?!\{)(?=\S)))(?!\/[\/\*])'
147145 pop: true
146+ - include: single-line-comment-consuming-line-ending
148147 - include: decl-block
149148 - include: expression
150149 arrow-return-type:
@@ -170,6 +169,8 @@ contexts:
170169 binding-element:
171170 - include: comment
172171 - include: string
172+ - include: numeric-literal
173+ - include: regex
173174 - include: object-binding-pattern
174175 - include: array-binding-pattern
175176 - include: destructuring-variable-rest
@@ -177,6 +178,8 @@ contexts:
177178 binding-element-const:
178179 - include: comment
179180 - include: string
181+ - include: numeric-literal
182+ - include: regex
180183 - include: object-binding-pattern-const
181184 - include: array-binding-pattern-const
182185 - include: destructuring-variable-rest-const
@@ -200,11 +203,12 @@ contexts:
200203 cast:
201204 - include: jsx
202205 class-declaration:
203− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*])'
206+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*])'
204207 captures:
205208 1: keyword.control.export.tsx
206209 2: storage.modifier.tsx
207− 3: storage.type.class.tsx
210+ 3: storage.modifier.tsx
211+ 4: storage.type.class.tsx
208212 push:
209213 - meta_scope: meta.class.tsx
210214 - match: '(?<=\})'
@@ -219,9 +223,10 @@ contexts:
219223 - include: type-parameters
220224 - include: class-or-interface-body
221225 class-expression:
222− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(class)\b(?=\s+|[<{]|\/[\/*])'
226+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(class)\b(?=\s+|[<{]|\/[\/*])'
223227 captures:
224− 1: storage.type.class.tsx
228+ 1: storage.modifier.tsx
229+ 2: storage.type.class.tsx
225230 push:
226231 - meta_scope: meta.class.tsx
227232 - match: '(?<=\})'
@@ -238,6 +243,11 @@ contexts:
238243 pop: true
239244 - include: comment
240245 - include: decorator
246+ - match: (?<=:)\s*
247+ push:
248+ - match: '(?=\s|[;),}\]:\-\+]|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
249+ pop: true
250+ - include: expression
241251 - include: method-declaration
242252 - include: indexer-declaration
243253 - include: field-declaration
@@ -284,9 +294,15 @@ contexts:
284294 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
285295 scope: keyword.control.loop.tsx
286296 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
287− scope: keyword.control.flow.tsx
297+ captures:
298+ 0: keyword.control.flow.tsx
299+ push:
300+ - match: '(?=[;}]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
301+ pop: true
302+ - include: expression
288303 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
289304 scope: keyword.control.switch.tsx
305+ - include: if-statement
290306 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(else|if)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
291307 scope: keyword.control.conditional.tsx
292308 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(with)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
@@ -295,8 +311,6 @@ contexts:
295311 scope: keyword.control.tsx
296312 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(debugger)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
297313 scope: keyword.other.debugger.tsx
298− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
299− scope: storage.modifier.tsx
300314 decl-block:
301315 - match: '\{'
302316 captures:
@@ -320,6 +334,8 @@ contexts:
320334 - include: import-equals-declaration
321335 - include: import-declaration
322336 - include: export-declaration
337+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare|export)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
338+ scope: storage.modifier.tsx
323339 decorator:
324340 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))\@'
325341 captures:
@@ -333,7 +349,7 @@ contexts:
333349 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)'
334350 push:
335351 - meta_scope: meta.object-binding-pattern-variable.tsx
336− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
352+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
337353 pop: true
338354 - include: object-binding-pattern-const
339355 - include: type-annotation
@@ -341,15 +357,16 @@ contexts:
341357 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)'
342358 push:
343359 - meta_scope: meta.array-binding-pattern-variable.tsx
344− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
360+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
345361 pop: true
346362 - include: array-binding-pattern-const
347363 - include: type-annotation
348364 - include: comment
349365 destructuring-parameter:
350− - match: '(?<!=|:)\s*(\{)'
366+ - match: '(?<!=|:)\s*(?:(\.\.\.)\s*)?(\{)'
351367 captures:
352− 1: punctuation.definition.binding-pattern.object.tsx
368+ 1: keyword.operator.rest.tsx
369+ 2: punctuation.definition.binding-pattern.object.tsx
353370 push:
354371 - meta_scope: meta.parameter.object-binding-pattern.tsx
355372 - match: '\}'
@@ -357,9 +374,10 @@ contexts:
357374 0: punctuation.definition.binding-pattern.object.tsx
358375 pop: true
359376 - include: parameter-object-binding-element
360− - match: '(?<!=|:)\s*(\[)'
377+ - match: '(?<!=|:)\s*(?:(\.\.\.)\s*)?(\[)'
361378 captures:
362− 1: punctuation.definition.binding-pattern.array.tsx
379+ 1: keyword.operator.rest.tsx
380+ 2: punctuation.definition.binding-pattern.array.tsx
363381 push:
364382 - meta_scope: meta.paramter.array-binding-pattern.tsx
365383 - match: '\]'
@@ -377,7 +395,7 @@ contexts:
377395 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)'
378396 push:
379397 - meta_scope: meta.object-binding-pattern-variable.tsx
380− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
398+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
381399 pop: true
382400 - include: object-binding-pattern
383401 - include: type-annotation
@@ -385,7 +403,7 @@ contexts:
385403 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)'
386404 push:
387405 - meta_scope: meta.array-binding-pattern-variable.tsx
388− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
406+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
389407 pop: true
390408 - include: array-binding-pattern
391409 - include: type-annotation
@@ -401,12 +419,12 @@ contexts:
401419 1: keyword.operator.rest.tsx
402420 2: meta.definition.variable.tsx variable.other.constant.tsx
403421 directives:
404− - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$)'
422+ - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/>\s*$)'
405423 captures:
406424 1: punctuation.definition.comment.tsx
407425 push:
408426 - meta_scope: comment.line.triple-slash.directive.tsx
409− - match: (?=^)
427+ - match: (?=$)
410428 pop: true
411429 - match: (<)(reference|amd-dependency|amd-module)
412430 captures:
@@ -668,13 +686,18 @@ contexts:
668686 captures:
669687 1: punctuation.definition.block.tag.jsdoc
670688 - include: inline-tags
689+ - match: '((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+)'
690+ captures:
691+ 1: storage.type.class.jsdoc
692+ 2: punctuation.definition.block.tag.jsdoc
671693 enum-declaration:
672− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:\b(const)\s+)?\b(enum)\s+([_$[:alpha:]][_$[:alnum:]]*)'
694+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:\b(const)\s+)?\b(enum)\s+([_$[:alpha:]][_$[:alnum:]]*)'
673695 captures:
674696 1: keyword.control.export.tsx
675697 2: storage.modifier.tsx
676− 3: storage.type.enum.tsx
677− 4: entity.name.type.enum.tsx
698+ 3: storage.modifier.tsx
699+ 4: storage.type.enum.tsx
700+ 5: entity.name.type.enum.tsx
678701 push:
679702 - meta_scope: meta.enum.declaration.tsx
680703 - match: '(?<=\})'
@@ -697,7 +720,7 @@ contexts:
697720 pop: true
698721 - include: comment
699722 - include: variable-initializer
700− - match: '(?=((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\])))'
723+ - match: '(?=((\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\])))'
701724 push:
702725 - match: '(?=,|\}|$)'
703726 pop: true
@@ -713,22 +736,25 @@ contexts:
713736 2: keyword.control.as.tsx
714737 3: storage.type.namespace.tsx
715738 4: entity.name.type.module.tsx
716− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:(?:\s*(=))|(?:\s+(default)(?=\s+)))'
739+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?(?:(?:\s*(=))|(?:\s+(default)(?=\s+)))'
717740 captures:
718741 1: keyword.control.export.tsx
719− 2: keyword.operator.assignment.tsx
720− 3: keyword.control.default.tsx
742+ 2: keyword.control.type.tsx
743+ 3: keyword.operator.assignment.tsx
744+ 4: keyword.control.default.tsx
721745 push:
722746 - meta_scope: meta.export.default.tsx
723− - match: (?=$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)
747+ - match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
724748 pop: true
749+ - include: interface-declaration
725750 - include: expression
726− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?!\s*:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
751+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?\b(?!(\$)|(\s*:))((?=\s*[\{*])|((?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s|,))(?!\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b)))'
727752 captures:
728− 0: keyword.control.export.tsx
753+ 1: keyword.control.export.tsx
754+ 2: keyword.control.type.tsx
729755 push:
730756 - meta_scope: meta.export.tsx
731− - match: (?=$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)
757+ - match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
732758 pop: true
733759 - include: import-export-declaration
734760 expression:
@@ -737,7 +763,105 @@ contexts:
737763 - include: expressionPunctuations
738764 expression-inside-possibly-arrow-parens:
739765 - include: expressionWithoutIdentifiers
740− - include: function-parameters-body
766+ - include: comment
767+ - include: string
768+ - include: decorator
769+ - include: destructuring-parameter
770+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
771+ captures:
772+ 1: storage.modifier.tsx
773+ - match: |-
774+ (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
775+ # function assignment |
776+ (=\s*(
777+ ((async\s+)?(
778+ (function\s*[(<*]) |
779+ (function\s+) |
780+ ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
781+ )) |
782+ ((async\s*)?(
783+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
784+ # sure shot arrow functions even if => is on new line
785+ (
786+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
787+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
788+ (
789+ ([)]\s*:) | # ():
790+ ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
791+ )
792+ ) |
793+ (
794+ [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
795+ ) |
796+ # arrow function possible to detect only with => on same line
797+ (
798+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
799+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
800+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
801+ \s*=> # arrow operator
802+ )
803+ ))
804+ )) |
805+ # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
806+ (:\s*(
807+ (<) |
808+ ([(]\s*(
809+ ([)]) |
810+ (\.\.\.) |
811+ ([_$[:alnum:]]+\s*(
812+ ([:,?=])|
813+ ([)]\s*=>)
814+ ))
815+ ))
816+ )) |
817+ (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
818+ (:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
819+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
820+ ((async\s+)?(
821+ (function\s*[(<*]) |
822+ (function\s+) |
823+ ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
824+ )) |
825+ ((async\s*)?(
826+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
827+ # sure shot arrow functions even if => is on new line
828+ (
829+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
830+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
831+ (
832+ ([)]\s*:) | # ():
833+ ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
834+ )
835+ ) |
836+ (
837+ [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
838+ ) |
839+ # arrow function possible to detect only with => on same line
840+ (
841+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
842+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
843+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
844+ \s*=> # arrow operator
845+ )
846+ ))
847+ )))
848+ captures:
849+ 1: storage.modifier.tsx
850+ 2: keyword.operator.rest.tsx
851+ 3: entity.name.function.tsx variable.language.this.tsx
852+ 4: entity.name.function.tsx
853+ 5: keyword.operator.optional.tsx
854+ - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
855+ captures:
856+ 1: storage.modifier.tsx
857+ 2: keyword.operator.rest.tsx
858+ 3: variable.parameter.tsx variable.language.this.tsx
859+ 4: variable.parameter.tsx
860+ 5: keyword.operator.optional.tsx
861+ - include: type-annotation
862+ - include: variable-initializer
863+ - match: ","
864+ scope: punctuation.separator.parameter.tsx
741865 - include: identifiers
742866 - include: expressionPunctuations
743867 expression-operators:
@@ -769,11 +893,15 @@ contexts:
769893 - include: typeof-operator
770894 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))void(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
771895 scope: keyword.operator.expression.void.tsx
896+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*($|[;,:})\]]))'
897+ captures:
898+ 1: keyword.control.as.tsx
899+ 2: storage.modifier.tsx
772900 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
773901 captures:
774902 1: keyword.control.as.tsx
775903 push:
776− - match: '(?=$|^|[;,:})\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
904+ - match: '(?=^|[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+)|(\s+\<))'
777905 pop: true
778906 - include: type
779907 - match: \.\.\.
@@ -788,7 +916,12 @@ contexts:
788916 scope: keyword.operator.comparison.tsx
789917 - match: <=|>=|<>|<|>
790918 scope: keyword.operator.relational.tsx
791− - match: \!|&&|\|\|
919+ - match: '(?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*])))'
920+ captures:
921+ 1: keyword.operator.logical.tsx
922+ 2: keyword.operator.assignment.compound.tsx
923+ 3: keyword.operator.arithmetic.tsx
924+ - match: \!|&&|\|\||\?\?
792925 scope: keyword.operator.logical.tsx
793926 - match: \&|~|\^|\|
794927 scope: keyword.operator.bitwise.tsx
@@ -800,9 +933,18 @@ contexts:
800933 scope: keyword.operator.increment.tsx
801934 - match: '%|\*|/|-|\+'
802935 scope: keyword.operator.arithmetic.tsx
803− - match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])'
936+ - match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*]))))'
937+ push:
938+ - match: '(?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/)))'
939+ captures:
940+ 1: keyword.operator.assignment.compound.tsx
941+ 2: keyword.operator.arithmetic.tsx
942+ pop: true
943+ - include: comment
944+ - match: '(?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*])))'
804945 captures:
805− 1: keyword.operator.arithmetic.tsx
946+ 1: keyword.operator.assignment.compound.tsx
947+ 2: keyword.operator.arithmetic.tsx
806948 expressionPunctuations:
807949 - include: punctuation-comma
808950 - include: punctuation-accessor
@@ -810,7 +952,6 @@ contexts:
810952 - include: jsx
811953 - include: string
812954 - include: regex
813− - include: template
814955 - include: comment
815956 - include: function-expression
816957 - include: class-expression
@@ -828,143 +969,123 @@ contexts:
828969 - include: paren-expression
829970 field-declaration:
830971 - match: |-
831− (?x)(?<!\()(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s+)?(?=\s*((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
832− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
833− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
834− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
835− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
836− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
837− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
838− (?:\B(\.)[0-9][0-9_]*\b)| # .1
839− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
840− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))
972+ (?x)(?<!\()(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s+)?(?=\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
973+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
974+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
975+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
976+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
977+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
978+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
979+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
980+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
981+ )(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|\}|$))
841982 captures:
842983 1: storage.modifier.tsx
843984 push:
844985 - meta_scope: meta.field.declaration.tsx
845986 - match: |-
846− (?x)(?=\}|;|,|$|(^(?!\s*((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
847− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
848− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
849− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
850− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
851− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
852− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
853− (?:\B(\.)[0-9][0-9_]*\b)| # .1
854− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
855− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))))|(?<=\})
987+ (?x)(?=\}|;|,|$|(^(?!\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
988+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
989+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
990+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
991+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
992+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
993+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
994+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
995+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
996+ )(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\})
856997 pop: true
857998 - include: variable-initializer
999+ - include: type-annotation
1000+ - include: string
1001+ - include: array-literal
1002+ - include: numeric-literal
1003+ - include: comment
8581004 - match: |-
859− (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
860− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
861− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
862− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
863− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
864− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
865− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
866− (?:\B(\.)[0-9][0-9_]*\b)| # .1
867− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
868− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))
869− push:
870− - match: |-
871− (?x)(?=[};,=]|$|(^(?!\s*((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
872− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
873− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
874− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
875− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
876− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
877− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
878− (?:\B(\.)[0-9][0-9_]*\b)| # .1
879− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
880− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))))|(?<=\})
881− pop: true
882− - include: type-annotation
883− - include: string
884− - include: array-literal
885− - include: numeric-literal
886− - include: comment
887− - match: |-
888− (?x)([_$[:alpha:]][_$[:alnum:]]*)(\?)?(?=(\?\s*)?\s*
889− # function assignment |
890− (=\s*(
891− ((async\s+)?(
892− (function\s*[(<*]) |
893− (function\s+) |
894− ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
895− )) |
896− ((async\s*)?(
897− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
898− # sure shot arrow functions even if => is on new line
899− (
900− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
901− [(]\s*
902− (
903− ([)]\s*:) | # ():
904− ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
905− )
906− ) |
907− (
908− [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
909− ) |
910− # arrow function possible to detect only with => on same line
911− (
912− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
913− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
914− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
915− \s*=> # arrow operator
916− )
917− ))
918− )) |
919− # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
920− (:\s*(
921− (<) |
922− ([(]\s*(
923− ([)]) |
924− (\.\.\.) |
925− ([_$[:alnum:]]+\s*(
926− ([:,?=])|
927− ([)]\s*=>)
928− ))
929− ))
930− )) |
931− (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) |
932− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
933− ((async\s+)?(
934− (function\s*[(<*]) |
935− (function\s+) |
936− ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
937− )) |
938− ((async\s*)?(
939− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
940− # sure shot arrow functions even if => is on new line
941− (
942− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
943− [(]\s*
944− (
945− ([)]\s*:) | # ():
946− ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
947− )
948− ) |
949− (
950− [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
951− ) |
952− # arrow function possible to detect only with => on same line
953− (
954− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
955− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
956− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
957− \s*=> # arrow operator
958− )
959− ))
960− )))
961− captures:
962− 1: meta.definition.property.tsx entity.name.function.tsx
963− 2: keyword.operator.optional.tsx
964− - match: "[_$[:alpha:]][_$[:alnum:]]*"
965− scope: meta.definition.property.tsx variable.object.property.tsx
966− - match: \?
967− scope: keyword.operator.optional.tsx
1005+ (?x)(\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\?)|(\!))?(?=\s*\s*
1006+ # function assignment |
1007+ (=\s*(
1008+ ((async\s+)?(
1009+ (function\s*[(<*]) |
1010+ (function\s+) |
1011+ ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1012+ )) |
1013+ ((async\s*)?(
1014+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1015+ # sure shot arrow functions even if => is on new line
1016+ (
1017+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1018+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
1019+ (
1020+ ([)]\s*:) | # ():
1021+ ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1022+ )
1023+ ) |
1024+ (
1025+ [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
1026+ ) |
1027+ # arrow function possible to detect only with => on same line
1028+ (
1029+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1030+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1031+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1032+ \s*=> # arrow operator
1033+ )
1034+ ))
1035+ )) |
1036+ # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
1037+ (:\s*(
1038+ (<) |
1039+ ([(]\s*(
1040+ ([)]) |
1041+ (\.\.\.) |
1042+ ([_$[:alnum:]]+\s*(
1043+ ([:,?=])|
1044+ ([)]\s*=>)
1045+ ))
1046+ ))
1047+ )) |
1048+ (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
1049+ (:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
1050+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
1051+ ((async\s+)?(
1052+ (function\s*[(<*]) |
1053+ (function\s+) |
1054+ ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1055+ )) |
1056+ ((async\s*)?(
1057+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
1058+ # sure shot arrow functions even if => is on new line
1059+ (
1060+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1061+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
1062+ (
1063+ ([)]\s*:) | # ():
1064+ ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1065+ )
1066+ ) |
1067+ (
1068+ [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
1069+ ) |
1070+ # arrow function possible to detect only with => on same line
1071+ (
1072+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1073+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1074+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
1075+ \s*=> # arrow operator
1076+ )
1077+ ))
1078+ )))
1079+ captures:
1080+ 1: meta.definition.property.tsx entity.name.function.tsx
1081+ 2: keyword.operator.optional.tsx
1082+ 3: keyword.operator.definiteassignment.tsx
1083+ - match: '\#?[_$[:alpha:]][_$[:alnum:]]*'
1084+ scope: meta.definition.property.tsx variable.object.property.tsx
1085+ - match: \?
1086+ scope: keyword.operator.optional.tsx
1087+ - match: \!
1088+ scope: keyword.operator.definiteassignment.tsx
9681089 for-loop:
9691090 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))for(?=((\s+|(\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*))await)?\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)?(\())'
9701091 captures:
@@ -991,43 +1112,59 @@ contexts:
9911112 - include: type-parameters
9921113 - include: function-parameters
9931114 - include: return-type
1115+ - include: type-function-return-type
9941116 - include: decl-block
9951117 - match: \*
9961118 scope: keyword.generator.asterisk.tsx
9971119 function-call:
998− - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()'
1120+ - 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*)?\())'
9991121 push:
1000− - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()'
1122+ - 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*)?\())'
10011123 pop: true
1002− - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
1124+ - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
10031125 push:
10041126 - meta_scope: meta.function-call.tsx
1005− - match: '(?=\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()'
1127+ - 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*)?\())'
10061128 pop: true
1007− - include: literal
1008− - include: support-objects
1009− - include: object-identifiers
1010− - include: punctuation-accessor
1011− - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*[\(]\s*[\"\''\`]))'
1012− scope: keyword.operator.expression.import.tsx
1013− - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1014− scope: entity.name.function.tsx
1129+ - include: function-call-target
10151130 - include: comment
1016− - match: \?\.
1017− scope: meta.function-call.tsx punctuation.accessor.optional.tsx
1131+ - include: function-call-optionals
10181132 - include: type-arguments
10191133 - include: paren-expression
1134+ - match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
1135+ push:
1136+ - match: '(?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
1137+ pop: true
1138+ - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
1139+ push:
1140+ - meta_scope: meta.function-call.tsx
1141+ - match: '(?=(<\s*[\{\[\(]\s*$))'
1142+ pop: true
1143+ - include: function-call-target
1144+ - include: comment
1145+ - include: function-call-optionals
1146+ - include: type-arguments
1147+ function-call-optionals:
1148+ - match: \?\.
1149+ scope: meta.function-call.tsx punctuation.accessor.optional.tsx
1150+ - match: \!
1151+ scope: meta.function-call.tsx keyword.operator.definiteassignment.tsx
1152+ function-call-target:
1153+ - include: support-function-call-identifiers
1154+ - match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)'
1155+ scope: entity.name.function.tsx
10201156 function-declaration:
1021− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
1157+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
10221158 captures:
10231159 1: keyword.control.export.tsx
1024− 2: storage.modifier.async.tsx
1025− 3: storage.type.function.tsx
1026− 4: keyword.generator.asterisk.tsx
1027− 5: meta.definition.function.tsx entity.name.function.tsx
1160+ 2: storage.modifier.tsx
1161+ 3: storage.modifier.async.tsx
1162+ 4: storage.type.function.tsx
1163+ 5: keyword.generator.asterisk.tsx
1164+ 6: meta.definition.function.tsx entity.name.function.tsx
10281165 push:
10291166 - meta_scope: meta.function.tsx
1030− - match: '(?=$|^|;)|(?<=\})'
1167+ - match: '(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
10311168 pop: true
10321169 - include: function-name
10331170 - include: function-body
@@ -1040,9 +1177,10 @@ contexts:
10401177 4: meta.definition.function.tsx entity.name.function.tsx
10411178 push:
10421179 - meta_scope: meta.function.expression.tsx
1043− - match: '(?<=\})'
1180+ - match: '(?=;)|(?<=\})'
10441181 pop: true
10451182 - include: function-name
1183+ - include: single-line-comment-consuming-line-ending
10461184 - include: function-body
10471185 function-name:
10481186 - match: "[_$[:alpha:]][_$[:alnum:]]*"
@@ -1060,10 +1198,11 @@ contexts:
10601198 - include: function-parameters-body
10611199 function-parameters-body:
10621200 - include: comment
1201+ - include: string
10631202 - include: decorator
10641203 - include: destructuring-parameter
10651204 - include: parameter-name
1066− - include: type-annotation
1205+ - include: parameter-type-annotation
10671206 - include: variable-initializer
10681207 - match: ","
10691208 scope: punctuation.separator.parameter.tsx
@@ -1077,11 +1216,11 @@ contexts:
10771216 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
10781217 )) |
10791218 ((async\s*)?(
1080− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
1219+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
10811220 # sure shot arrow functions even if => is on new line
10821221 (
1083− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1084− [(]\s*
1222+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
1223+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
10851224 (
10861225 ([)]\s*:) | # ():
10871226 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -1092,9 +1231,9 @@ contexts:
10921231 ) |
10931232 # arrow function possible to detect only with => on same line
10941233 (
1095− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1096− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1097− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
1234+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
1235+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
1236+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
10981237 \s*=> # arrow operator
10991238 )
11001239 ))
@@ -1103,12 +1242,12 @@ contexts:
11031242 1: punctuation.accessor.tsx
11041243 2: punctuation.accessor.optional.tsx
11051244 3: entity.name.function.tsx
1106− - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])'
1245+ - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])'
11071246 captures:
11081247 1: punctuation.accessor.tsx
11091248 2: punctuation.accessor.optional.tsx
11101249 3: variable.other.constant.property.tsx
1111− - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([_$[:alpha:]][_$[:alnum:]]*)'
1250+ - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[_$[:alpha:]][_$[:alnum:]]*)'
11121251 captures:
11131252 1: punctuation.accessor.tsx
11141253 2: punctuation.accessor.optional.tsx
@@ -1117,15 +1256,46 @@ contexts:
11171256 scope: variable.other.constant.tsx
11181257 - match: "[_$[:alpha:]][_$[:alnum:]]*"
11191258 scope: variable.other.readwrite.tsx
1259+ if-statement:
1260+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))\s*(?!\{))'
1261+ push:
1262+ - match: '(?=;|$|\})'
1263+ pop: true
1264+ - include: comment
1265+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(if)\s*(\()'
1266+ captures:
1267+ 1: keyword.control.conditional.tsx
1268+ 2: meta.brace.round.tsx
1269+ push:
1270+ - match: \)
1271+ captures:
1272+ 0: meta.brace.round.tsx
1273+ pop: true
1274+ - include: expression
1275+ - match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
1276+ captures:
1277+ 0: punctuation.definition.string.begin.tsx
1278+ push:
1279+ - meta_scope: string.regexp.tsx
1280+ - match: "(/)([dgimsuy]*)"
1281+ captures:
1282+ 1: punctuation.definition.string.end.tsx
1283+ 2: keyword.other.tsx
1284+ pop: true
1285+ - include: regexp
1286+ - include: statements
11201287 import-declaration:
1121− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(import)(?!\s*[:\(])(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1288+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type)(?!\s+from))?(?!\s*[:\(])(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
11221289 captures:
11231290 1: keyword.control.export.tsx
1124− 2: keyword.control.import.tsx
1291+ 2: storage.modifier.tsx
1292+ 3: keyword.control.import.tsx
1293+ 4: keyword.control.type.tsx
11251294 push:
11261295 - meta_scope: meta.import.tsx
11271296 - match: '(?<!^import|[^\._$[:alnum:]]import)(?=;|$|^)'
11281297 pop: true
1298+ - include: single-line-comment-consuming-line-ending
11291299 - include: comment
11301300 - include: string
11311301 - match: '(?<=^import|[^\._$[:alnum:]]import)(?!\s*["''])'
@@ -1137,14 +1307,16 @@ contexts:
11371307 - include: import-export-declaration
11381308 - include: import-export-declaration
11391309 import-equals-declaration:
1140− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(import)\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(require)\s*(\()'
1310+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(require)\s*(\()'
11411311 captures:
11421312 1: keyword.control.export.tsx
1143− 2: keyword.control.import.tsx
1144− 3: variable.other.readwrite.alias.tsx
1145− 4: keyword.operator.assignment.tsx
1146− 5: keyword.control.require.tsx
1147− 6: meta.brace.round.tsx
1313+ 2: storage.modifier.tsx
1314+ 3: keyword.control.import.tsx
1315+ 4: keyword.control.type.tsx
1316+ 5: variable.other.readwrite.alias.tsx
1317+ 6: keyword.operator.assignment.tsx
1318+ 7: keyword.control.require.tsx
1319+ 8: meta.brace.round.tsx
11481320 push:
11491321 - meta_scope: meta.import-equals.external.tsx
11501322 - match: \)
@@ -1153,16 +1325,19 @@ contexts:
11531325 pop: true
11541326 - include: comment
11551327 - include: string
1156− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(import)\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(?!require\b)'
1328+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(?!require\b)'
11571329 captures:
11581330 1: keyword.control.export.tsx
1159− 2: keyword.control.import.tsx
1160− 3: variable.other.readwrite.alias.tsx
1161− 4: keyword.operator.assignment.tsx
1331+ 2: storage.modifier.tsx
1332+ 3: keyword.control.import.tsx
1333+ 4: keyword.control.type.tsx
1334+ 5: variable.other.readwrite.alias.tsx
1335+ 6: keyword.operator.assignment.tsx
11621336 push:
11631337 - meta_scope: meta.import-equals.internal.tsx
11641338 - match: (?=;|$|^)
11651339 pop: true
1340+ - include: single-line-comment-consuming-line-ending
11661341 - include: comment
11671342 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
11681343 captures:
@@ -1184,7 +1359,7 @@ contexts:
11841359 - include: import-export-clause
11851360 import-export-clause:
11861361 - include: comment
1187− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*))\s+(as)\s+(?:(\bdefault(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(\b[_$[:alpha:]][_$[:alnum:]]*))'
1362+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*))\s+(as)\s+(?:(default(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|([_$[:alpha:]][_$[:alnum:]]*))'
11881363 captures:
11891364 1: keyword.control.default.tsx
11901365 2: constant.language.import-export-all.tsx
@@ -1236,6 +1411,9 @@ contexts:
12361411 2: keyword.operator.type.modifier.tsx
12371412 3: keyword.operator.optional.tsx
12381413 pop: true
1414+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
1415+ captures:
1416+ 1: keyword.control.as.tsx
12391417 - include: type
12401418 inline-tags:
12411419 - match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
@@ -1267,15 +1445,16 @@ contexts:
12671445 captures:
12681446 1: keyword.operator.expression.instanceof.tsx
12691447 push:
1270− - match: '(?<=\))|(?=[;),}\]:?]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
1448+ - match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
12711449 pop: true
12721450 - include: type
12731451 interface-declaration:
1274− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?\b(?:(abstract)\s+)?\b(interface)\b(?=\s+|/[/*])'
1452+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(interface)\b(?=\s+|/[/*])'
12751453 captures:
12761454 1: keyword.control.export.tsx
12771455 2: storage.modifier.tsx
1278− 3: storage.type.interface.tsx
1456+ 3: storage.modifier.tsx
1457+ 4: storage.type.interface.tsx
12791458 push:
12801459 - meta_scope: meta.interface.tsx
12811460 - match: '(?<=\})'
@@ -1323,7 +1502,7 @@ contexts:
13231502 captures:
13241503 0: punctuation.section.embedded.begin.tsx
13251504 push:
1326− - meta_scope: meta.embedded.expression.tsx
1505+ - meta_content_scope: meta.embedded.expression.tsx
13271506 - match: '\}'
13281507 captures:
13291508 0: punctuation.section.embedded.end.tsx
@@ -1352,10 +1531,10 @@ contexts:
13521531 pop: true
13531532 - include: jsx-entities
13541533 jsx-tag:
1355− - match: '(?=(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>))'
1534+ - match: '(?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>))'
13561535 push:
13571536 - meta_scope: meta.tag.tsx
1358− - match: '(/>)|(?:(</)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))?\s*(>))'
1537+ - match: '(/>)|(?:(</)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>))'
13591538 captures:
13601539 1: punctuation.definition.tag.end.tsx
13611540 2: punctuation.definition.tag.begin.tsx
@@ -1365,7 +1544,7 @@ contexts:
13651544 6: support.class.component.tsx
13661545 7: punctuation.definition.tag.end.tsx
13671546 pop: true
1368− - match: '(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>)'
1547+ - match: '(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>)'
13691548 captures:
13701549 1: punctuation.definition.tag.begin.tsx
13711550 2: entity.name.tag.namespace.tsx
@@ -1393,8 +1572,8 @@ contexts:
13931572 - match: |-
13941573 (?x)
13951574 \s*
1396− (?:([_$[:alpha:]][-$[:alnum:].]*)(:))?
1397− ([_$[:alpha:]][-$[:alnum:]]*)
1575+ (?:([_$[:alpha:]][-_$[:alnum:].]*)(:))?
1576+ ([_$[:alpha:]][-_$[:alnum:]]*)
13981577 (?=\s|=|/?>|/\*|//)
13991578 captures:
14001579 1: entity.other.attribute-name.namespace.tsx
@@ -1419,15 +1598,15 @@ contexts:
14191598 jsx-tag-in-expression:
14201599 - match: |-
14211600 (?x)
1422− (?<!\+\+|--)(?<=[({\[,?=>:*]|&&|\|\||\?|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*
1601+ (?<!\+\+|--)(?<=[({\[,?=>:*]|&&|\|\||\?|\*\/|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*
14231602 (?!<\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=>])|,)) # look ahead is not type parameter of arrow
1424− (?=(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>))
1603+ (?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>))
14251604 push:
1426− - match: '(?!(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>))'
1605+ - match: '(?!(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>))'
14271606 pop: true
14281607 - include: jsx-tag
14291608 jsx-tag-without-attributes:
1430− - match: '(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))?\s*(>)'
1609+ - match: '(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>)'
14311610 captures:
14321611 1: punctuation.definition.tag.begin.tsx
14331612 2: entity.name.tag.namespace.tsx
@@ -1438,7 +1617,7 @@ contexts:
14381617 push:
14391618 - meta_scope: meta.tag.without-attributes.tsx
14401619 - meta_content_scope: meta.jsx.children.tsx
1441− - match: '(</)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))?\s*(>)'
1620+ - match: '(</)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>)'
14421621 captures:
14431622 1: punctuation.definition.tag.begin.tsx
14441623 2: entity.name.tag.namespace.tsx
@@ -1449,9 +1628,9 @@ contexts:
14491628 pop: true
14501629 - include: jsx-children
14511630 jsx-tag-without-attributes-in-expression:
1452− - match: '(?<!\+\+|--)(?<=[({\[,?=>:*]|&&|\|\||\?|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*(?=(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))?\s*(>))'
1631+ - match: '(?<!\+\+|--)(?<=[({\[,?=>:*]|&&|\|\||\?|\*\/|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*(?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>))'
14531632 push:
1454− - match: '(?!(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-$[:alnum:].]*))(?<!\.|-))?\s*(>))'
1633+ - match: '(?!(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>))'
14551634 pop: true
14561635 - include: jsx-tag-without-attributes
14571636 label:
@@ -1477,25 +1656,27 @@ contexts:
14771656 - include: this-literal
14781657 - include: super-literal
14791658 method-declaration:
1480− - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1659+ - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
14811660 captures:
14821661 1: storage.modifier.tsx
14831662 2: storage.modifier.tsx
1484− 3: storage.modifier.async.tsx
1485− 4: storage.type.tsx
1663+ 3: storage.modifier.tsx
1664+ 4: storage.modifier.async.tsx
1665+ 5: storage.type.tsx
14861666 push:
14871667 - meta_scope: meta.method.declaration.tsx
14881668 - match: '(?=\}|;|,|$)|(?<=\})'
14891669 pop: true
14901670 - include: method-declaration-name
14911671 - include: function-body
1492− - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*[\(\<])'
1672+ - 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*))?[\(])'
14931673 captures:
14941674 1: storage.modifier.tsx
14951675 2: storage.modifier.tsx
1496− 3: storage.modifier.async.tsx
1497− 4: keyword.operator.new.tsx
1498− 5: keyword.generator.asterisk.tsx
1676+ 3: storage.modifier.tsx
1677+ 4: storage.modifier.async.tsx
1678+ 5: keyword.operator.new.tsx
1679+ 6: keyword.generator.asterisk.tsx
14991680 push:
15001681 - meta_scope: meta.method.declaration.tsx
15011682 - match: '(?=\}|;|,|$)|(?<=\})'
@@ -1503,22 +1684,23 @@ contexts:
15031684 - include: method-declaration-name
15041685 - include: function-body
15051686 - match: |-
1506− (?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_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1507− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1508− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1509− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1510− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1511− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1512− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1513− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1514− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1515− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
1687+ (?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(?!\$))|((?<!\$)(?:
1688+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1689+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1690+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1691+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1692+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1693+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1694+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1695+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1696+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
15161697 captures:
15171698 1: storage.modifier.tsx
15181699 2: storage.modifier.tsx
1519− 3: storage.modifier.async.tsx
1520− 4: storage.type.property.tsx
1521− 5: keyword.generator.asterisk.tsx
1700+ 3: storage.modifier.tsx
1701+ 4: storage.modifier.async.tsx
1702+ 5: storage.type.property.tsx
1703+ 6: keyword.generator.asterisk.tsx
15221704 push:
15231705 - meta_scope: meta.method.declaration.tsx
15241706 - match: '(?=\}|;|,|$)|(?<=\})'
@@ -1527,16 +1709,16 @@ contexts:
15271709 - include: function-body
15281710 method-declaration-name:
15291711 - match: |-
1530− (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1531− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1532− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1533− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1534− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1535− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1536− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1537− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1538− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1539− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<])
1712+ (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1713+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1714+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1715+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1716+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1717+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1718+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1719+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1720+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1721+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<])
15401722 push:
15411723 - match: (?=\(|\<)
15421724 pop: true
@@ -1548,13 +1730,14 @@ contexts:
15481730 - match: \?
15491731 scope: keyword.operator.optional.tsx
15501732 namespace-declaration:
1551− - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(namespace|module)\s+(?=[_$[:alpha:]"''`]))'
1733+ - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(namespace|module)\s+(?=[_$[:alpha:]"''`]))'
15521734 captures:
15531735 1: keyword.control.export.tsx
1554− 2: storage.type.namespace.tsx
1736+ 2: storage.modifier.tsx
1737+ 3: storage.type.namespace.tsx
15551738 push:
15561739 - meta_scope: meta.namespace.declaration.tsx
1557− - match: '(?<=\})|(?=;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)'
1740+ - match: '(?<=\})|(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
15581741 pop: true
15591742 - include: comment
15601743 - include: string
@@ -1568,41 +1751,53 @@ contexts:
15681751 1: keyword.operator.new.tsx
15691752 push:
15701753 - meta_scope: new.expr.tsx
1571− - match: '(?<=\))|(?=[;),}\]:]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
1754+ - match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
15721755 pop: true
1573− - include: paren-expression
1574− - include: class-declaration
1575− - include: type
1756+ - include: expression
15761757 null-literal:
15771758 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
15781759 scope: constant.language.null.tsx
15791760 numeric-literal:
1580− - match: '\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$)'
1761+ - match: '\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$)'
15811762 scope: constant.numeric.hex.tsx
1582− - match: '\b(?<!\$)0(b|B)[01][01_]*\b(?!\$)'
1763+ captures:
1764+ 1: storage.type.numeric.bigint.tsx
1765+ - match: '\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$)'
15831766 scope: constant.numeric.binary.tsx
1584− - match: '\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$)'
1767+ captures:
1768+ 1: storage.type.numeric.bigint.tsx
1769+ - match: '\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$)'
15851770 scope: constant.numeric.octal.tsx
1771+ captures:
1772+ 1: storage.type.numeric.bigint.tsx
15861773 - match: |-
15871774 (?x)
15881775 (?<!\$)(?:
1589− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1590− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1591− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1592− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1593− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1594− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1595− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1596− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1776+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1777+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1778+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1779+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1780+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1781+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1782+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1783+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
15971784 )(?!\$)
15981785 captures:
15991786 0: constant.numeric.decimal.tsx
16001787 1: meta.delimiter.decimal.period.tsx
1601− 2: meta.delimiter.decimal.period.tsx
1788+ 2: storage.type.numeric.bigint.tsx
16021789 3: meta.delimiter.decimal.period.tsx
1603− 4: meta.delimiter.decimal.period.tsx
1790+ 4: storage.type.numeric.bigint.tsx
16041791 5: meta.delimiter.decimal.period.tsx
1605− 6: meta.delimiter.decimal.period.tsx
1792+ 6: storage.type.numeric.bigint.tsx
1793+ 7: storage.type.numeric.bigint.tsx
1794+ 8: meta.delimiter.decimal.period.tsx
1795+ 9: storage.type.numeric.bigint.tsx
1796+ 10: meta.delimiter.decimal.period.tsx
1797+ 11: storage.type.numeric.bigint.tsx
1798+ 12: meta.delimiter.decimal.period.tsx
1799+ 13: storage.type.numeric.bigint.tsx
1800+ 14: storage.type.numeric.bigint.tsx
16061801 numericConstant-literal:
16071802 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))NaN(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
16081803 scope: constant.language.nan.tsx
@@ -1611,16 +1806,16 @@ contexts:
16111806 object-binding-element:
16121807 - include: comment
16131808 - match: |-
1614− (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1615− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1616− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1617− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1618− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1619− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1620− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1621− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1622− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1623− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1809+ (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1810+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1811+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1812+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1813+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1814+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1815+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1816+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1817+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1818+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
16241819 push:
16251820 - match: '(?=,|\})'
16261821 pop: true
@@ -1633,16 +1828,16 @@ contexts:
16331828 object-binding-element-const:
16341829 - include: comment
16351830 - match: |-
1636− (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1637− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1638− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1639− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1640− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1641− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1642− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1643− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1644− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1645− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1831+ (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1832+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1833+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1834+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1835+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1836+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1837+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1838+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1839+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1840+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
16461841 push:
16471842 - match: '(?=,|\})'
16481843 pop: true
@@ -1654,16 +1849,16 @@ contexts:
16541849 - include: punctuation-comma
16551850 object-binding-element-propertyName:
16561851 - match: |-
1657− (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1658− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1659− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1660− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1661− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1662− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1663− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1664− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1665− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1666− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1852+ (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1853+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1854+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1855+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1856+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1857+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1858+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1859+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1860+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1861+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
16671862 push:
16681863 - match: (:)
16691864 captures:
@@ -1701,9 +1896,9 @@ contexts:
17011896 scope: support.class.tsx
17021897 - match: |-
17031898 (?x)(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?:
1704− ([[:upper:]][_$[:digit:][:upper:]]*) |
1705− ([_$[:alpha:]][_$[:alnum:]]*)
1706− )(?=\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)
1899+ (\#?[[:upper:]][_$[:digit:][:upper:]]*) |
1900+ (\#?[_$[:alpha:]][_$[:alnum:]]*)
1901+ )(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)
17071902 captures:
17081903 1: punctuation.accessor.tsx
17091904 2: punctuation.accessor.optional.tsx
@@ -1713,7 +1908,7 @@ contexts:
17131908 (?x)(?:
17141909 ([[:upper:]][_$[:digit:][:upper:]]*) |
17151910 ([_$[:alpha:]][_$[:alnum:]]*)
1716− )(?=\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)
1911+ )(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)
17171912 captures:
17181913 1: variable.other.constant.object.tsx
17191914 2: variable.other.object.tsx
@@ -1730,16 +1925,16 @@ contexts:
17301925 - include: object-member
17311926 object-literal-method-declaration:
17321927 - match: |-
1733− (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1734− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1735− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1736− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1737− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1738− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1739− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1740− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1741− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1742− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
1928+ (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1929+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1930+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1931+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1932+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1933+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1934+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1935+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1936+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1937+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
17431938 captures:
17441939 1: storage.modifier.async.tsx
17451940 2: storage.type.property.tsx
@@ -1751,16 +1946,16 @@ contexts:
17511946 - include: method-declaration-name
17521947 - include: function-body
17531948 - match: |-
1754− (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1755− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1756− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1757− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1758− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1759− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1760− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1761− (?:\B(\.)[0-9][0-9_]*\b)| # .1
1762− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1763− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
1949+ (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1950+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1951+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1952+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1953+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1954+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1955+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1956+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1957+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1958+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
17641959 captures:
17651960 1: storage.modifier.async.tsx
17661961 2: storage.type.property.tsx
@@ -1777,37 +1972,56 @@ contexts:
17771972 - meta_scope: meta.object.member.tsx meta.object-literal.key.tsx
17781973 - match: '(?=:)|((?<=[\]])(?=\s*[\(\<]))'
17791974 pop: true
1975+ - include: comment
17801976 - include: array-literal
1781− - match: '(?=[\''\"])'
1977+ - match: '(?=[\''\"\`])'
17821978 push:
17831979 - meta_scope: meta.object.member.tsx meta.object-literal.key.tsx
1784− - match: '(?=:)|((?<=[\''\"])(?=\s*[\(\<]))'
1980+ - match: '(?=:)|((?<=[\''\"\`])(?=((\s*[\(\<,}])|(\s+(as)\s+))))'
17851981 pop: true
1982+ - include: comment
17861983 - include: string
1787− - match: '(?<=[\]\''\"])(?=\s*[\(\<])'
1984+ - match: |-
1985+ (?x)(?=(\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
1986+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
1987+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
1988+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
1989+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
1990+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
1991+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
1992+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
1993+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
1994+ )(?!\$)))
1995+ push:
1996+ - meta_scope: meta.object.member.tsx meta.object-literal.key.tsx
1997+ - match: '(?=:)|(?=\s*([\(\<,}])|(\s+as\s+))'
1998+ pop: true
1999+ - include: comment
2000+ - include: numeric-literal
2001+ - match: '(?<=[\]\''\"\`])(?=\s*[\(\<])'
17882002 push:
17892003 - meta_scope: meta.method.declaration.tsx
17902004 - match: '(?=\}|;|,)|(?<=\})'
17912005 pop: true
17922006 - include: function-body
1793− - match: '(?![_$[:alpha:]])([[:digit:]]+)\s*(?=:)'
2007+ - match: '(?![_$[:alpha:]])([[:digit:]]+)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:)'
17942008 scope: meta.object.member.tsx
17952009 captures:
17962010 0: meta.object-literal.key.tsx
17972011 1: constant.numeric.decimal.tsx
17982012 - match: |-
1799− (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:\s*(
2013+ (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:(\s*\/\*([^\*]|(\*[^\/]))*\*\/)*\s*(
18002014 ((async\s+)?(
18012015 (function\s*[(<*]) |
18022016 (function\s+) |
18032017 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
18042018 )) |
18052019 ((async\s*)?(
1806− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
2020+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
18072021 # sure shot arrow functions even if => is on new line
18082022 (
1809− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1810− [(]\s*
2023+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2024+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
18112025 (
18122026 ([)]\s*:) | # ():
18132027 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -1818,9 +2032,9 @@ contexts:
18182032 ) |
18192033 # arrow function possible to detect only with => on same line
18202034 (
1821− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1822− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1823− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2035+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2036+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2037+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
18242038 \s*=> # arrow operator
18252039 )
18262040 ))
@@ -1829,7 +2043,7 @@ contexts:
18292043 captures:
18302044 0: meta.object-literal.key.tsx
18312045 1: entity.name.function.tsx
1832− - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)'
2046+ - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:)'
18332047 scope: meta.object.member.tsx
18342048 captures:
18352049 0: meta.object-literal.key.tsx
@@ -1841,14 +2055,27 @@ contexts:
18412055 - match: '(?=,|\})'
18422056 pop: true
18432057 - include: expression
1844− - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$)'
2058+ - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*)'
18452059 scope: meta.object.member.tsx
18462060 captures:
18472061 1: variable.other.readwrite.tsx
2062+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*([,}]|$))'
2063+ scope: meta.object.member.tsx
2064+ captures:
2065+ 1: keyword.control.as.tsx
2066+ 2: storage.modifier.tsx
2067+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
2068+ captures:
2069+ 1: keyword.control.as.tsx
2070+ push:
2071+ - meta_scope: meta.object.member.tsx
2072+ - match: '(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|^|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
2073+ pop: true
2074+ - include: type
18482075 - match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)'
18492076 push:
18502077 - meta_scope: meta.object.member.tsx
1851− - match: '(?=,|\}|$)'
2078+ - match: '(?=,|\}|$|\/\/|\/\*)'
18522079 pop: true
18532080 - include: expression
18542081 - match: ":"
@@ -1858,7 +2085,7 @@ contexts:
18582085 - meta_scope: meta.object.member.tsx
18592086 - match: '(?=,|\})'
18602087 pop: true
1861− - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)\(\s*([\{\[]\s*)?$)'
2088+ - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
18622089 captures:
18632090 1: storage.modifier.async.tsx
18642091 push:
@@ -1874,7 +2101,7 @@ contexts:
18742101 0: meta.brace.round.tsx
18752102 pop: true
18762103 - include: expression-inside-possibly-arrow-parens
1877− - match: '(?<=:)\s*(async)?\s*(\()(?=\s*([\{\[]\s*)?$)'
2104+ - match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
18782105 captures:
18792106 1: storage.modifier.async.tsx
18802107 2: meta.brace.round.tsx
@@ -1884,6 +2111,23 @@ contexts:
18842111 0: meta.brace.round.tsx
18852112 pop: true
18862113 - include: expression-inside-possibly-arrow-parens
2114+ - match: (?<=:)\s*(async)?\s*(?=\<\s*$)
2115+ captures:
2116+ 1: storage.modifier.async.tsx
2117+ push:
2118+ - match: (?<=\>)
2119+ pop: true
2120+ - include: type-parameters
2121+ - match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
2122+ captures:
2123+ 1: meta.brace.round.tsx
2124+ push:
2125+ - match: \)
2126+ captures:
2127+ 0: meta.brace.round.tsx
2128+ pop: true
2129+ - include: expression-inside-possibly-arrow-parens
2130+ - include: possibly-arrow-return-type
18872131 - include: expression
18882132 - include: punctuation-comma
18892133 parameter-array-binding-pattern:
@@ -1901,16 +2145,18 @@ contexts:
19012145 parameter-binding-element:
19022146 - include: comment
19032147 - include: string
2148+ - include: numeric-literal
2149+ - include: regex
19042150 - include: parameter-object-binding-pattern
19052151 - include: parameter-array-binding-pattern
19062152 - include: destructuring-parameter-rest
19072153 - include: variable-initializer
19082154 parameter-name:
1909− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
2155+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
19102156 captures:
19112157 1: storage.modifier.tsx
19122158 - match: |-
1913− (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
2159+ (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
19142160 # function assignment |
19152161 (=\s*(
19162162 ((async\s+)?(
@@ -1919,11 +2165,11 @@ contexts:
19192165 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
19202166 )) |
19212167 ((async\s*)?(
1922− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
2168+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
19232169 # sure shot arrow functions even if => is on new line
19242170 (
1925− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1926− [(]\s*
2171+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2172+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
19272173 (
19282174 ([)]\s*:) | # ():
19292175 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -1934,9 +2180,9 @@ contexts:
19342180 ) |
19352181 # arrow function possible to detect only with => on same line
19362182 (
1937− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1938− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1939− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2183+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2184+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2185+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
19402186 \s*=> # arrow operator
19412187 )
19422188 ))
@@ -1953,19 +2199,20 @@ contexts:
19532199 ))
19542200 ))
19552201 )) |
1956− (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) |
1957− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
2202+ (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
2203+ (:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
2204+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
19582205 ((async\s+)?(
19592206 (function\s*[(<*]) |
19602207 (function\s+) |
19612208 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
19622209 )) |
19632210 ((async\s*)?(
1964− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
2211+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
19652212 # sure shot arrow functions even if => is on new line
19662213 (
1967− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1968− [(]\s*
2214+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
2215+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
19692216 (
19702217 ([)]\s*:) | # ():
19712218 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -1976,9 +2223,9 @@ contexts:
19762223 ) |
19772224 # arrow function possible to detect only with => on same line
19782225 (
1979− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1980− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1981− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2226+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
2227+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
2228+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
19822229 \s*=> # arrow operator
19832230 )
19842231 ))
@@ -1989,7 +2236,7 @@ contexts:
19892236 3: entity.name.function.tsx variable.language.this.tsx
19902237 4: entity.name.function.tsx
19912238 5: keyword.operator.optional.tsx
1992− - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
2239+ - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
19932240 captures:
19942241 1: storage.modifier.tsx
19952242 2: keyword.operator.rest.tsx
@@ -1999,16 +2246,16 @@ contexts:
19992246 parameter-object-binding-element:
20002247 - include: comment
20012248 - match: |-
2002− (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
2003− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
2004− (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
2005− (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
2006− (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
2007− (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
2008− (?:\b[0-9][0-9_]*(\.)\B)| # 1.
2009− (?:\B(\.)[0-9][0-9_]*\b)| # .1
2010− (?:\b[0-9][0-9_]*\b(?!\.)) # 1
2011− )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
2249+ (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
2250+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
2251+ (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
2252+ (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
2253+ (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3
2254+ (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1
2255+ (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
2256+ (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
2257+ (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
2258+ )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
20122259 push:
20132260 - match: '(?=,|\})'
20142261 pop: true
@@ -2029,6 +2276,15 @@ contexts:
20292276 0: punctuation.definition.binding-pattern.object.tsx
20302277 pop: true
20312278 - include: parameter-object-binding-element
2279+ parameter-type-annotation:
2280+ - match: (:)
2281+ captures:
2282+ 1: keyword.operator.type.annotation.tsx
2283+ push:
2284+ - meta_scope: meta.type.annotation.tsx
2285+ - match: "(?=[,)])|(?==[^>])"
2286+ pop: true
2287+ - include: type
20322288 paren-expression:
20332289 - match: \(
20342290 captures:
@@ -2040,14 +2296,14 @@ contexts:
20402296 pop: true
20412297 - include: expression
20422298 paren-expression-possibly-arrow:
2043− - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*))?\(\s*[\{\[]\s*$)'
2299+ - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
20442300 captures:
20452301 1: storage.modifier.async.tsx
20462302 push:
20472303 - match: (?<=\))
20482304 pop: true
20492305 - include: paren-expression-possibly-arrow-with-typeparameters
2050− - match: '(?<=[(=,]|=>)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*))?\()|(<))\s*$)'
2306+ - match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
20512307 captures:
20522308 1: storage.modifier.async.tsx
20532309 push:
@@ -2067,7 +2323,7 @@ contexts:
20672323 pop: true
20682324 - include: expression-inside-possibly-arrow-parens
20692325 possibly-arrow-return-type:
2070− - match: '(?<=\))\s*(:)(?=\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+\s*=>)'
2326+ - match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
20712327 captures:
20722328 1: meta.arrow.tsx meta.return.type.arrow.tsx keyword.operator.type.annotation.tsx
20732329 push:
@@ -2114,23 +2370,23 @@ contexts:
21142370 pop: true
21152371 - include: string-character-escape
21162372 regex:
2117− - match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))'
2373+ - match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
21182374 captures:
21192375 1: punctuation.definition.string.begin.tsx
21202376 push:
21212377 - meta_scope: string.regexp.tsx
2122− - match: "(/)([gimsuy]*)"
2378+ - match: "(/)([dgimsuy]*)"
21232379 captures:
21242380 1: punctuation.definition.string.end.tsx
21252381 2: keyword.other.tsx
21262382 pop: true
21272383 - include: regexp
2128− - match: '(?<![_$[:alnum:])\]]|\+\+|--|})\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))'
2384+ - match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
21292385 captures:
21302386 0: punctuation.definition.string.begin.tsx
21312387 push:
21322388 - meta_scope: string.regexp.tsx
2133− - match: "(/)([gimsuy]*)"
2389+ - match: "(/)([dgimsuy]*)"
21342390 captures:
21352391 1: punctuation.definition.string.end.tsx
21362392 2: keyword.other.tsx
@@ -2230,10 +2486,24 @@ contexts:
22302486 - include: type-object
22312487 - include: type-predicate-operator
22322488 - include: type
2489+ shebang:
2490+ - match: \A(#!).*(?=$)
2491+ scope: comment.line.shebang.tsx
2492+ captures:
2493+ 1: punctuation.definition.comment.tsx
2494+ single-line-comment-consuming-line-ending:
2495+ - match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
2496+ captures:
2497+ 1: punctuation.whitespace.comment.leading.tsx
2498+ 2: comment.line.double-slash.tsx
2499+ 3: punctuation.definition.comment.tsx
2500+ 4: storage.type.internaldeclaration.tsx
2501+ 5: punctuation.decorator.internaldeclaration.tsx
2502+ push:
2503+ - meta_content_scope: comment.line.double-slash.tsx
2504+ - match: (?=^)
2505+ pop: true
22332506 statements:
2234− - include: string
2235− - include: template
2236− - include: comment
22372507 - include: declaration
22382508 - include: control-statement
22392509 - include: after-operator-block-as-object-literal
@@ -2241,21 +2511,31 @@ contexts:
22412511 - include: label
22422512 - include: expression
22432513 - include: punctuation-semicolon
2514+ - include: string
2515+ - include: comment
22442516 string:
22452517 - include: qstring-single
22462518 - include: qstring-double
2519+ - include: template
22472520 string-character-escape:
2248− - 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]?|.|$)'
2521+ - match: '\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]+\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)'
22492522 scope: constant.character.escape.tsx
22502523 super-literal:
22512524 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))super\b(?!\$)'
22522525 scope: variable.language.super.tsx
2526+ support-function-call-identifiers:
2527+ - include: literal
2528+ - include: support-objects
2529+ - include: object-identifiers
2530+ - include: punctuation-accessor
2531+ - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*[\(]\s*[\"\''\`]))'
2532+ scope: keyword.operator.expression.import.tsx
22532533 support-objects:
22542534 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(arguments)\b(?!\$)'
22552535 scope: variable.language.arguments.tsx
22562536 - match: |-
2257− (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Array|ArrayBuffer|Atomics|Boolean|DataView|Date|Float32Array|Float64Array|Function|Generator
2258− |GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy
2537+ (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Array|ArrayBuffer|Atomics|BigInt|BigInt64Array|BigUint64Array|Boolean|DataView|Date|Float32Array
2538+ |Float64Array|Function|Generator|GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy
22592539 |Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray
22602540 |Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$)
22612541 scope: support.class.builtin.tsx
@@ -2309,9 +2589,9 @@ contexts:
23092589 4: support.variable.property.target.tsx
23102590 - match: |-
23112591 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
2312− (constructor|length|prototype|__proto__)
2592+ (?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
23132593 |
2314− (EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)
2594+ (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
23152595 captures:
23162596 1: punctuation.accessor.tsx
23172597 2: punctuation.accessor.optional.tsx
@@ -2415,7 +2695,7 @@ contexts:
24152695 |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
24162696 |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
24172697 |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
2418− |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?\()
2698+ |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
24192699 captures:
24202700 1: punctuation.accessor.tsx
24212701 2: punctuation.accessor.optional.tsx
@@ -2539,6 +2819,7 @@ contexts:
25392819 captures:
25402820 0: punctuation.definition.block.tsx
25412821 pop: true
2822+ - include: comment
25422823 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(switch)\s*(\()'
25432824 captures:
25442825 1: keyword.control.switch.tsx
@@ -2581,7 +2862,34 @@ contexts:
25812862 0: case-clause.expr.tsx punctuation.definition.section.case-statement.tsx
25822863 - include: statements
25832864 template:
2584− - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)`)'
2865+ - include: template-call
2866+ - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
2867+ captures:
2868+ 1: entity.name.function.tagged-template.tsx
2869+ 2: punctuation.definition.string.template.begin.tsx
2870+ push:
2871+ - meta_scope: string.template.tsx
2872+ - match: "`"
2873+ captures:
2874+ 0: punctuation.definition.string.template.end.tsx
2875+ pop: true
2876+ - include: template-substitution-element
2877+ - include: string-character-escape
2878+ template-call:
2879+ - 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*)?`)'
2880+ push:
2881+ - meta_scope: string.template.tsx
2882+ - match: (?=`)
2883+ pop: true
2884+ - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
2885+ push:
2886+ - 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*)?`)'
2887+ pop: true
2888+ - include: support-function-call-identifiers
2889+ - match: "([_$[:alpha:]][_$[:alnum:]]*)"
2890+ scope: entity.name.function.tagged-template.tsx
2891+ - include: type-arguments
2892+ - 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*)`)'
25852893 captures:
25862894 1: entity.name.function.tagged-template.tsx
25872895 push:
@@ -2589,6 +2897,20 @@ contexts:
25892897 - match: (?=`)
25902898 pop: true
25912899 - include: type-arguments
2900+ template-substitution-element:
2901+ - match: '\$\{'
2902+ captures:
2903+ 0: punctuation.definition.template-expression.begin.tsx
2904+ push:
2905+ - meta_scope: meta.template.expression.tsx
2906+ - meta_content_scope: meta.embedded.line.tsx
2907+ - match: '\}'
2908+ captures:
2909+ 0: punctuation.definition.template-expression.end.tsx
2910+ pop: true
2911+ - include: expression
2912+ template-type:
2913+ - include: template-call
25922914 - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
25932915 captures:
25942916 1: entity.name.function.tagged-template.tsx
@@ -2599,9 +2921,9 @@ contexts:
25992921 captures:
26002922 0: punctuation.definition.string.template.end.tsx
26012923 pop: true
2602− - include: template-substitution-element
2924+ - include: template-type-substitution-element
26032925 - include: string-character-escape
2604− template-substitution-element:
2926+ template-type-substitution-element:
26052927 - match: '\$\{'
26062928 captures:
26072929 0: punctuation.definition.template-expression.begin.tsx
@@ -2612,9 +2934,9 @@ contexts:
26122934 captures:
26132935 0: punctuation.definition.template-expression.end.tsx
26142936 pop: true
2615− - include: expression
2937+ - include: type
26162938 ternary-expression:
2617− - match: '(?!\?\.\s*[^[:digit:]])(\?)'
2939+ - match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
26182940 captures:
26192941 1: keyword.operator.ternary.tsx
26202942 push:
@@ -2628,7 +2950,7 @@ contexts:
26282950 scope: variable.language.this.tsx
26292951 type:
26302952 - include: comment
2631− - include: string
2953+ - include: type-string
26322954 - include: numeric-literal
26332955 - include: type-primitive
26342956 - include: type-builtin-literals
@@ -2640,24 +2962,36 @@ contexts:
26402962 - include: type-fn-type-parameters
26412963 - include: type-paren-or-function-parameters
26422964 - include: type-function-return-type
2965+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
2966+ captures:
2967+ 1: storage.modifier.tsx
26432968 - include: type-name
26442969 type-alias-declaration:
2645− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(type)\b\s+([_$[:alpha:]][_$[:alnum:]]*)\s*'
2970+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(type)\b\s+([_$[:alpha:]][_$[:alnum:]]*)\s*'
26462971 captures:
26472972 1: keyword.control.export.tsx
2648− 2: storage.type.type.tsx
2649− 3: entity.name.type.alias.tsx
2973+ 2: storage.modifier.tsx
2974+ 3: storage.type.type.tsx
2975+ 4: entity.name.type.alias.tsx
26502976 push:
26512977 - meta_scope: meta.type.declaration.tsx
2652− - match: '(?=\}|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)'
2978+ - match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
26532979 pop: true
26542980 - include: comment
26552981 - include: type-parameters
2982+ - match: '(=)\s*(intrinsic)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2983+ captures:
2984+ 1: keyword.operator.assignment.tsx
2985+ 2: keyword.control.intrinsic.tsx
2986+ push:
2987+ - match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
2988+ pop: true
2989+ - include: type
26562990 - match: (=)\s*
26572991 captures:
26582992 1: keyword.operator.assignment.tsx
26592993 push:
2660− - match: '(?=\}|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)'
2994+ - match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
26612995 pop: true
26622996 - include: type
26632997 type-annotation:
@@ -2687,8 +3021,13 @@ contexts:
26873021 captures:
26883022 0: punctuation.definition.typeparameters.end.tsx
26893023 pop: true
2690− - include: type
2691− - include: punctuation-comma
3024+ - include: type-arguments-body
3025+ type-arguments-body:
3026+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(_)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3027+ captures:
3028+ 0: keyword.operator.type.tsx
3029+ - include: type
3030+ - include: punctuation-comma
26923031 type-builtin-literals:
26933032 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(this|true|false|undefined|null|object)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
26943033 scope: support.type.builtin.tsx
@@ -2710,13 +3049,19 @@ contexts:
27103049 - include: type
27113050 - include: type
27123051 type-fn-type-parameters:
2713− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)'
2714− scope: meta.type.constructor.tsx
3052+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<)'
27153053 captures:
2716− 1: keyword.control.new.tsx
2717− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()'
3054+ 1: meta.type.constructor.tsx storage.modifier.tsx
3055+ 2: meta.type.constructor.tsx keyword.control.new.tsx
3056+ push:
3057+ - match: (?<=>)
3058+ pop: true
3059+ - include: comment
3060+ - include: type-parameters
3061+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\()'
27183062 captures:
2719− 1: keyword.control.new.tsx
3063+ 1: storage.modifier.tsx
3064+ 2: keyword.control.new.tsx
27203065 push:
27213066 - meta_scope: meta.type.constructor.tsx
27223067 - match: (?<=\))
@@ -2767,6 +3112,30 @@ contexts:
27673112 - include: type-predicate-operator
27683113 - include: type
27693114 type-name:
3115+ - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(<)'
3116+ captures:
3117+ 1: entity.name.type.module.tsx
3118+ 2: punctuation.accessor.tsx
3119+ 3: punctuation.accessor.optional.tsx
3120+ 4: meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx
3121+ push:
3122+ - meta_content_scope: meta.type.parameters.tsx
3123+ - match: (>)
3124+ captures:
3125+ 1: meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx
3126+ pop: true
3127+ - include: type-arguments-body
3128+ - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(<)'
3129+ captures:
3130+ 1: entity.name.type.tsx
3131+ 2: meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx
3132+ push:
3133+ - meta_content_scope: meta.type.parameters.tsx
3134+ - match: (>)
3135+ captures:
3136+ 1: meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx
3137+ pop: true
3138+ - include: type-arguments-body
27703139 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
27713140 captures:
27723141 1: entity.name.type.module.tsx
@@ -2802,18 +3171,16 @@ contexts:
28023171 - include: type
28033172 type-operators:
28043173 - include: typeof-operator
2805− - match: '(?:([&|])|(=(?!>)))(?=\s*\{)'
3174+ - match: '([&|])(?=\s*\{)'
28063175 captures:
2807− 1: keyword.operator.type.tsx
2808− 2: keyword.operator.assignment.tsx
3176+ 0: keyword.operator.type.tsx
28093177 push:
28103178 - match: '(?<=\})'
28113179 pop: true
28123180 - include: type-object
2813− - match: "([&|])|(=(?!>))"
3181+ - match: "[&|]"
28143182 captures:
2815− 1: keyword.operator.type.tsx
2816− 2: keyword.operator.assignment.tsx
3183+ 0: keyword.operator.type.tsx
28173184 push:
28183185 - match: (?=\S)
28193186 pop: true
@@ -2840,6 +3207,8 @@ contexts:
28403207 scope: storage.modifier.tsx
28413208 - include: type
28423209 - include: punctuation-comma
3210+ - match: (=)(?!>)
3211+ scope: keyword.operator.assignment.tsx
28433212 type-paren-or-function-parameters:
28443213 - match: \(
28453214 captures:
@@ -2850,7 +3219,6 @@ contexts:
28503219 captures:
28513220 0: meta.brace.round.tsx
28523221 pop: true
2853− - include: destructuring-parameter
28543222 - match: |-
28553223 (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*(
28563224 (<) |
@@ -2863,7 +3231,8 @@ contexts:
28633231 ))
28643232 ))
28653233 )) |
2866− (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))))
3234+ (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3235+ (:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
28673236 captures:
28683237 1: storage.modifier.tsx
28693238 2: keyword.operator.rest.tsx
@@ -2882,11 +3251,28 @@ contexts:
28823251 scope: punctuation.separator.parameter.tsx
28833252 - include: type
28843253 type-predicate-operator:
3254+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(asserts)\s+)?(?!asserts)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s(is)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3255+ captures:
3256+ 1: keyword.operator.type.asserts.tsx
3257+ 2: variable.parameter.tsx variable.language.this.tsx
3258+ 3: variable.parameter.tsx
3259+ 4: keyword.operator.expression.is.tsx
3260+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(asserts)\s+(?!is)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3261+ captures:
3262+ 1: keyword.operator.type.asserts.tsx
3263+ 2: variable.parameter.tsx variable.language.this.tsx
3264+ 3: variable.parameter.tsx
3265+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))asserts(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3266+ scope: keyword.operator.type.asserts.tsx
28853267 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))is(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
28863268 scope: keyword.operator.expression.is.tsx
28873269 type-primitive:
2888− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|boolean|symbol|any|void|never)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3270+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
28893271 scope: support.type.primitive.tsx
3272+ type-string:
3273+ - include: qstring-single
3274+ - include: qstring-double
3275+ - include: template-type
28903276 type-tuple:
28913277 - match: '\['
28923278 captures:
@@ -2897,56 +3283,84 @@ contexts:
28973283 captures:
28983284 0: meta.brace.square.tsx
28993285 pop: true
3286+ - match: \.\.\.
3287+ scope: keyword.operator.rest.tsx
3288+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([_$[:alpha:]][_$[:alnum:]]*)\s*(\?)?\s*(:)'
3289+ captures:
3290+ 1: entity.name.label.tsx
3291+ 2: keyword.operator.optional.tsx
3292+ 3: punctuation.separator.label.tsx
29003293 - include: type
29013294 - include: punctuation-comma
29023295 typeof-operator:
29033296 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2904− scope: keyword.operator.expression.typeof.tsx
3297+ captures:
3298+ 0: keyword.operator.expression.typeof.tsx
3299+ push:
3300+ - match: '(?=[,);}\]=>:&|{\?]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
3301+ pop: true
3302+ - include: expression
29053303 undefined-literal:
29063304 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
29073305 scope: constant.language.undefined.tsx
29083306 var-expr:
2909− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2910− captures:
2911− 1: keyword.control.export.tsx
2912− 2: storage.type.tsx
3307+ - match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
29133308 push:
29143309 - meta_scope: meta.var.expr.tsx
2915− - match: '((?=;|}|(\s+(of|in)\s+)|^\s*$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)|((?<=\S)(?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
3310+ - 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*$)))'
29163311 pop: true
3312+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
3313+ captures:
3314+ 1: keyword.control.export.tsx
3315+ 2: storage.modifier.tsx
3316+ 3: storage.type.tsx
3317+ push:
3318+ - match: (?=\S)
3319+ pop: true
29173320 - include: destructuring-variable
29183321 - include: var-single-variable
29193322 - include: variable-initializer
29203323 - include: comment
2921− - match: (,)\s*(?!\S)
3324+ - match: (,)\s*((?!\S)|(?=\/\/))
29223325 captures:
29233326 1: punctuation.separator.comma.tsx
29243327 push:
2925− - match: '(?<!,)(((?==|;|}|(\s+(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
3328+ - match: '(?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
29263329 pop: true
3330+ - include: single-line-comment-consuming-line-ending
29273331 - include: comment
29283332 - include: destructuring-variable
29293333 - include: var-single-variable
29303334 - include: punctuation-comma
29313335 - include: punctuation-comma
2932− - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
3336+ - match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
29333337 captures:
29343338 1: keyword.control.export.tsx
2935− 2: storage.type.tsx
3339+ 2: storage.modifier.tsx
3340+ 3: storage.type.tsx
29363341 push:
29373342 - meta_scope: meta.var.expr.tsx
2938− - match: '((?=;|}|(\s+(of|in)\s+)|^\s*$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)|((?<=\S)(?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
3343+ - 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*$)))'
29393344 pop: true
3345+ - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
3346+ captures:
3347+ 1: keyword.control.export.tsx
3348+ 2: storage.modifier.tsx
3349+ 3: storage.type.tsx
3350+ push:
3351+ - match: (?=\S)
3352+ pop: true
29403353 - include: destructuring-const
29413354 - include: var-single-const
29423355 - include: variable-initializer
29433356 - include: comment
2944− - match: (,)\s*(?!\S)
3357+ - match: (,)\s*((?!\S)|(?=\/\/))
29453358 captures:
29463359 1: punctuation.separator.comma.tsx
29473360 push:
2948− - match: '(?<!,)(((?==|;|}|(\s+(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
3361+ - match: '(?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
29493362 pop: true
3363+ - include: single-line-comment-consuming-line-ending
29503364 - include: comment
29513365 - include: destructuring-const
29523366 - include: var-single-const
@@ -2963,11 +3377,11 @@ contexts:
29633377 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
29643378 )) |
29653379 ((async\s*)?(
2966− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
3380+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
29673381 # sure shot arrow functions even if => is on new line
29683382 (
2969− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
2970− [(]\s*
3383+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3384+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
29713385 (
29723386 ([)]\s*:) | # ():
29733387 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -2978,9 +3392,9 @@ contexts:
29783392 ) |
29793393 # arrow function possible to detect only with => on same line
29803394 (
2981− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
2982− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
2983− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
3395+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3396+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3397+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
29843398 \s*=> # arrow operator
29853399 )
29863400 ))
@@ -2997,19 +3411,20 @@ contexts:
29973411 ))
29983412 ))
29993413 )) |
3000− (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) |
3001− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
3414+ (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3415+ (:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3416+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
30023417 ((async\s+)?(
30033418 (function\s*[(<*]) |
30043419 (function\s+) |
30053420 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
30063421 )) |
30073422 ((async\s*)?(
3008− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
3423+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
30093424 # sure shot arrow functions even if => is on new line
30103425 (
3011− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
3012− [(]\s*
3426+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3427+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
30133428 (
30143429 ([)]\s*:) | # ():
30153430 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -3020,9 +3435,9 @@ contexts:
30203435 ) |
30213436 # arrow function possible to detect only with => on same line
30223437 (
3023− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
3024− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
3025− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
3438+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3439+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3440+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
30263441 \s*=> # arrow operator
30273442 )
30283443 ))
@@ -3031,7 +3446,7 @@ contexts:
30313446 1: meta.definition.variable.tsx variable.other.constant.tsx entity.name.function.tsx
30323447 push:
30333448 - meta_scope: meta.var-single-variable.expr.tsx
3034− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
3449+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
30353450 pop: true
30363451 - include: var-single-variable-type-annotation
30373452 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
@@ -3039,12 +3454,12 @@ contexts:
30393454 1: meta.definition.variable.tsx variable.other.constant.tsx
30403455 push:
30413456 - meta_scope: meta.var-single-variable.expr.tsx
3042− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
3457+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
30433458 pop: true
30443459 - include: var-single-variable-type-annotation
30453460 var-single-variable:
30463461 - match: |-
3047− (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s*
3462+ (?x)([_$[:alpha:]][_$[:alnum:]]*)(\!)?(?=\s*
30483463 # function assignment |
30493464 (=\s*(
30503465 ((async\s+)?(
@@ -3053,11 +3468,11 @@ contexts:
30533468 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
30543469 )) |
30553470 ((async\s*)?(
3056− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
3471+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
30573472 # sure shot arrow functions even if => is on new line
30583473 (
3059− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
3060− [(]\s*
3474+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3475+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
30613476 (
30623477 ([)]\s*:) | # ():
30633478 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -3068,9 +3483,9 @@ contexts:
30683483 ) |
30693484 # arrow function possible to detect only with => on same line
30703485 (
3071− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
3072− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
3073− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
3486+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3487+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3488+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
30743489 \s*=> # arrow operator
30753490 )
30763491 ))
@@ -3087,19 +3502,20 @@ contexts:
30873502 ))
30883503 ))
30893504 )) |
3090− (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) |
3091− (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
3505+ (:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
3506+ (:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
3507+ (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
30923508 ((async\s+)?(
30933509 (function\s*[(<*]) |
30943510 (function\s+) |
30953511 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
30963512 )) |
30973513 ((async\s*)?(
3098− ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) |
3514+ ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
30993515 # sure shot arrow functions even if => is on new line
31003516 (
3101− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
3102− [(]\s*
3517+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
3518+ [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
31033519 (
31043520 ([)]\s*:) | # ():
31053521 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
@@ -3110,34 +3526,37 @@ contexts:
31103526 ) |
31113527 # arrow function possible to detect only with => on same line
31123528 (
3113− (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
3114− \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
3115− (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
3529+ (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
3530+ \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
3531+ (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
31163532 \s*=> # arrow operator
31173533 )
31183534 ))
31193535 )))
31203536 captures:
31213537 1: meta.definition.variable.tsx entity.name.function.tsx
3538+ 2: keyword.operator.definiteassignment.tsx
31223539 push:
31233540 - meta_scope: meta.var-single-variable.expr.tsx
3124− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
3541+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
31253542 pop: true
31263543 - include: var-single-variable-type-annotation
3127− - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])"
3544+ - match: '([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])(\!)?'
31283545 captures:
31293546 1: meta.definition.variable.tsx variable.other.constant.tsx
3547+ 2: keyword.operator.definiteassignment.tsx
31303548 push:
31313549 - meta_scope: meta.var-single-variable.expr.tsx
3132− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
3550+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
31333551 pop: true
31343552 - include: var-single-variable-type-annotation
3135− - match: "([_$[:alpha:]][_$[:alnum:]]*)"
3553+ - match: '([_$[:alpha:]][_$[:alnum:]]*)(\!)?'
31363554 captures:
31373555 1: meta.definition.variable.tsx variable.other.readwrite.tsx
3556+ 2: keyword.operator.definiteassignment.tsx
31383557 push:
31393558 - meta_scope: meta.var-single-variable.expr.tsx
3140− - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
3559+ - match: '(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
31413560 pop: true
31423561 - include: var-single-variable-type-annotation
31433562 var-single-variable-type-annotation:
@@ -3145,17 +3564,17 @@ contexts:
31453564 - include: string
31463565 - include: comment
31473566 variable-initializer:
3148− - match: (?<!=|!)(=)(?!=)(?=\s*\S)
3567+ - match: (?<!=|!)(=)(?!=)(?=\s*\S)(?!\s*.*=>\s*$)
31493568 captures:
31503569 1: keyword.operator.assignment.tsx
31513570 push:
3152− - match: '(?=$|^|[,);}\]])'
3571+ - match: '(?=$|^|[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))'
31533572 pop: true
31543573 - include: expression
31553574 - match: (?<!=|!)(=)(?!=)
31563575 captures:
31573576 1: keyword.operator.assignment.tsx
31583577 push:
3159− - match: '(?=[,);}\]])|(?=^\s*$)|(?<=\S)(?<!=)(?=\s*$)'
3578+ - match: '(?=[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))|(?=^\s*$)|(?<=\S)(?<!=)(?=\s*$)'
31603579 pop: true
31613580 - include: expression
assets/syntaxes/02_Extra/VimL+1−1

Submodule changed.

assets/syntaxes/02_Extra/Zig+1−1

Submodule changed.

assets/syntaxes/02_Extra/cmd-helpnew file+1

Submodule changed.

assets/syntaxes/02_Extra/log.sublime-syntax+30−6
@@ -6,6 +6,7 @@ file_extensions:
66scope: text.log
77variables:
88 ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
9+ hours_minutes_seconds: (?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)
910contexts:
1011 main:
1112 - match: (\w+)(=)
@@ -17,11 +18,10 @@ contexts:
1718 captures:
1819 1: punctuation.definition.string.begin.log
1920 3: punctuation.definition.string.end.log
20− - match: (")([^"]*)(")
21− scope: string.quoted.double.log
21+ - match: \"
2222 captures:
2323 1: punctuation.definition.string.begin.log
24− 3: punctuation.definition.string.end.log
24+ push: double_quoted_string
2525 - include: dates
2626 - include: ip_addresses
2727 - include: numbers
@@ -29,19 +29,34 @@ contexts:
2929 scope: markup.error.log
3030 - match: \b(?i:warn(?:ing)?)\b
3131 scope: markup.warning.log
32+ - match: \b(?i:debug)\b
33+ scope: markup.info.log
3234 #- include: scope:text.html.markdown#autolink-inet
3335 - match: \b\w+:/{2,3}
3436 scope: markup.underline.link.scheme.log
3537 push: url-host
3638 dates:
37− - match: \b\d{4}-\d{2}-\d{2}\b
39+ - match: \b\d{4}-\d{2}-\d{2}(?=\b|T)
3840 scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
39− - match: \b\d{4}/\d{2}/\d{2}\b
41+ push: maybe_date_time_separator
42+ - match: \b\d{4}/\d{2}/\d{2}(?=\b|T)
4043 scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
41− - match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
44+ push: maybe_date_time_separator
45+ - match: \b(?={{hours_minutes_seconds}})
46+ push: time
47+ time:
48+ - match: (?:{{hours_minutes_seconds}})(?:(\.)\d{3})?\b
4249 scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
4350 captures:
4451 1: punctuation.separator.decimal.log
52+ - match: ''
53+ pop: true
54+ maybe_date_time_separator:
55+ - match: T(?={{hours_minutes_seconds}})
56+ scope: meta.date.log meta.time.log keyword.other.log
57+ set: time
58+ - match: ''
59+ pop: true
4560 ip_addresses:
4661 - match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
4762 push:
@@ -114,3 +129,12 @@ contexts:
114129 scope: markup.underline.link.path.log
115130 - match: ''
116131 pop: true
132+ double_quoted_string:
133+ - meta_scope: string.quoted.double.log
134+ - match: \\"
135+ scope: constant.character.escape.log
136+ - match: \\n
137+ scope: constant.character.escape.log
138+ - match: \"
139+ scope: punctuation.definition.string.end.log
140+ pop: true
assets/syntaxes/02_Extra/requirementstxtdeleted−1

Submodule changed.

assets/syntaxes/02_Extra/requirementstxt.sublime-syntaxdeleted−19
@@ -1,19 +0,0 @@
1−%YAML 1.2
2−---
3−# http://www.sublimetext.com/docs/3/syntax.html
4−name: requirements.txt
5−file_extensions:
6− - requirements.txt
7−scope: source.requirementstxt
8−contexts:
9− main:
10− - match: (#).*$\n?
11− scope: comment.line.requirementstxt
12− captures:
13− 1: punctuation.definition.comment.requirementstxt
14− - match: '(?i)^[a-z0-9_\-\.]+'
15− scope: string.package_name.requirementstxt
16− - match: (?i)==|<|<=|>=|>
17− scope: keyword.operator.logical.punctuation.requirementstxt
18− - match: '(?i)\d+\.[\da-z\-_\.]*'
19− scope: constant.numeric.verions.requirementstxt
assets/syntaxes/02_Extra/ssh-config+1−1

Submodule changed.

assets/themes.bin

Binary file not shown.

doc/README-ja.md+3−3
@@ -13,7 +13,7 @@
1313 <a href="#カスタマイズ">カスタマイズ</a> •
1414 <a href="#プロジェクトの目標と既存の類似したOSS">プロジェクトの目標と既存の類似したOSS</a><br>
1515 [<a href="../README.md">English</a>]
16− [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
16+ [<a href="README-zh.md">中文</a>]
1717 [日本語]
1818 [<a href="README-ko.md">한국어</a>]
1919 [<a href="README-ru.md">Русский</a>]
@@ -181,7 +181,7 @@ man 2 select
181181
182182## インストール
183183
184−[![Packaging status](https://repology.org/badge/vertical-allrepos/bat.svg)](https://repology.org/project/bat/versions)
184+[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions)
185185
186186### On Ubuntu (`apt` を使用)
187187*... や他のDebianベースのLinuxディストリビューション*
@@ -366,7 +366,7 @@ ansible-galaxy install aeimer.install_bat
366366### From source
367367
368368
369−`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
369+`bat` をソースからビルドしたいならば、Rust 1.51 以上の環境が必要です。
370370`cargo` を使用してビルドすることができます:
371371
372372```bash
doc/README-ko.md+3−3
@@ -13,7 +13,7 @@
1313 <a href="#사용자화">사용자화</a> •
1414 <a href="#프로젝트-목표와-대안들">프로젝트 목표와 대안들</a><br>
1515 [<a href="../README.md">English</a>]
16− [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
16+ [<a href="README-zh.md">中文</a>]
1717 [<a href="README-ja.md">日本語</a>]
1818 [한국어]
1919 [<a href="README-ru.md">Русский</a>]
@@ -222,7 +222,7 @@ man 2 select
222222`bat`은 [Ubuntu](https://packages.ubuntu.com/eoan/bat)와
223223[Debian](https://packages.debian.org/sid/bat) 패키지 배포 과정에 도입되는 중이며,
224224Eoan 19.10 버전의 Ubuntu에서부터 제공됩니다.
225−현재 Debain에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다.
225+현재 Debian에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다.
226226
227227만약 충분히 최신 버전의 Ubuntu/Debian이 설치되어 있다면 간단히 다음을 실행하세요:
228228
@@ -416,7 +416,7 @@ scoop install bat
416416
417417### 소스에서
418418
419−`bat`의 소스를 빌드하기 위해서는, Rust 1.46 이상이 필요합니다.
419+`bat`의 소스를 빌드하기 위해서는, Rust 1.51 이상이 필요합니다.
420420`cargo`를 이용해 전부 빌드할 수 있습니다:
421421
422422```bash
doc/README-ru.md+3−3
@@ -13,7 +13,7 @@
1313 <a href="#кастомизация">Кастомизация</a> •
1414 <a href="#цели-и-альтернативы">Цели и альтернативы </a><br>
1515 [<a href="../README.md">English]
16− [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
16+ [<a href="README-zh.md">中文</a>]
1717 [<a href="README-ja.md">日本語</a>]
1818 [<a href="README-ko.md">한국어</a>]
1919 [Русский]
@@ -160,7 +160,7 @@ man 2 select
160160
161161## Установка
162162
163−[![Packaging status](https://repology.org/badge/vertical-allrepos/bat.svg)](https://repology.org/project/bat/versions)
163+[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions)
164164
165165### Ubuntu (с помощью `apt`)
166166*... и другие дистрибутивы основанные на Debian.*
@@ -344,7 +344,7 @@ ansible-galaxy install aeimer.install_bat
344344
345345### Из исходников
346346
347−Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.46 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
347+Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.51 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
348348
349349```bash
350350cargo install --locked bat
doc/README-zh.mdnew file+678
@@ -0,0 +1,678 @@
1+<p align="center">
2+ <img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
3+ <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>
4+ <img src="https://img.shields.io/crates/l/bat.svg" alt="license">
5+ <a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
6+ 类似 <i>cat(1)</i>,但带有 git 集成和语法高亮.
7+</p>
8+
9+<p align="center">
10+ <a href="#语法高亮">主要功能</a> •
11+ <a href="#如何使用">使用方法</a> •
12+ <a href="#安装">安装</a> •
13+ <a href="#自定义">自定义</a> •
14+ <a href="#project-goals-and-alternatives">项目目标和替代方案</a><br>
15+ [<a href="../README.md">English</a>]
16+ [中文]
17+ [<a href="README-ja.md">日本語</a>]
18+ [<a href="README-ko.md">한국어</a>]
19+ [<a href="README-ru.md">Русский</a>]
20+</p>
21+
22+### 语法高亮
23+
24+`bat` 对大部分编程语言和标记语言提供语法高亮:
25+
26+![Syntax highlighting example](https://imgur.com/rGsdnDe.png)
27+
28+### Git 集成
29+
30+`bat` 能从 git 中获取文件的修改并展示在边栏(见下图):
31+
32+![Git integration example](https://i.imgur.com/2lSW4RE.png)
33+
34+### 不可打印(non-printable)字符可视化
35+
36+添加`-A`/`--show-all`参数可以文件文件中的不可打印字符:
37+
38+![Non-printable character example](https://i.imgur.com/WndGp9H.png)
39+
40+### 自动分页
41+
42+`bat`会在一般情况下将大于屏幕可显示范围的内容输出到分页器(pager, e.g. `less`)。
43+
44+你可以在调用时添加`--paging=never`参数来使`bat`不使用分页器(就像`cat`一样)。如果你想要用为`cat`使用`bat`别名,可以在 shell 配置文件(shell configuration)中添加`alias cat='bat --paging=never'`。
45+
46+#### 智能输出
47+
48+`bat`能够在设置了分页器选项的同时进行管道:wink:。
49+当`bat`检测到当前环境为非可交互终端或管道时(例如使用`bat`并将内容用管道输出到文件),`bat`会像`cat`一样,一次输出文件内容为纯文本且无视`--paging`参数。
50+
51+## 如何使用
52+
53+在终端中查看一个文件
54+
55+```bash
56+> bat README.md
57+```
58+
59+一次性展示多个文件
60+
61+```bash
62+> bat src/*.rs
63+```
64+
65+从`stdin`读入流,自动为内容添加语法高亮(前提是输入内容的语言可以被正确识别,通常根据内容第一行的 shebang 标记,形如`#!bin/sh`)
66+
67+```bash
68+> curl -s https://sh.rustup.rs | bat
69+```
70+
71+显式指定`stdin`输入的语言
72+
73+```bash
74+> yaml2json .travis.yml | json_pp | bat -l json
75+```
76+
77+显示不可打印字符
78+
79+```bash
80+> bat -A /etc/hosts
81+```
82+
83+与`cat`的兼容性
84+
85+```bash
86+bat > note.md # 创建一个空文件
87+
88+bat header.md content.md footer.md > document.md
89+
90+bat -n main.rs # 只显示行号
91+
92+bat f - g # 输出 f,接着是标准输入流,最后 g
93+```
94+
95+### 第三方工具交互
96+
97+#### `fzf`
98+
99+你可以使用`bat`作为`fzf`的预览器。这需要在`bat`后添加`--color=always`选项,以及`--line-range` 选项来限制大文件的加载次数。
100+
101+```bash
102+fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
103+```
104+
105+更多信息请参阅[`fzf`的说明](https://github.com/junegunn/fzf#preview-window)。
106+
107+#### `find` 或 `fd`
108+
109+你可以使用`find`的`-exec`选项来用`bat`预览搜索结果:
110+
111+```bash
112+find … -exec bat {} +
113+```
114+
115+亦或者在用`fd`时添加`-X`/`--exec-batch`选项:
116+
117+```bash
118+fd … -X bat
119+```
120+
121+#### `ripgrep`
122+
123+`bat`也能用`batgrep`来显示`ripgrep`的搜索结果。
124+
125+```bash
126+batgrep needle src/
127+```
128+
129+#### `tail -f`
130+
131+当与`tail -f`一起使用,`bat`可以持续监视文件内容并为其添加语法高亮。
132+
133+```bash
134+tail -f /var/log/pacman.log | bat --paging=never -l log
135+```
136+
137+注意:这项功能需要在关闭分页时使用,同时要手动指定输入的内容语法(通过`-l log`)。
138+
139+#### `git`
140+
141+`bat`也能直接接受来自`git show`的输出并为其添加语法高亮(当然也需要手动指定语法):
142+
143+```bash
144+git show v0.6.0:src/main.rs | bat -l rs
145+```
146+
147+#### `git diff`
148+
149+`bat`也可以和`git diff`一起使用:
150+
151+```bash
152+batdiff() {
153+ git diff --name-only --diff-filter=d | xargs bat --diff
154+}
155+```
156+
157+该功能也作为一个独立工具提供,你可以在[`bat-extras`](https://github.com/eth-p/bat-extras)中找到`batdiff`。
158+
159+如果你想了解更多 git 和 diff 的信息,参阅[`delta`](https://github.com/dandavison/delta)。
160+
161+#### `xclip`
162+
163+当需要拷贝文件内容时,行号以及 git 标记会影响输出,此时可以使用`-p`/`--plain`参数来把纯文本传递给`xclip`。
164+
165+```bash
166+bat main.cpp | xclip
167+```
168+
169+`bat`会检测输出是否是管道重定向来决定是否使用纯文本输出。
170+
171+#### `man`
172+
173+`bat`也能给`man`的输出上色。这需要设置`MANPAGER`环境变量:
174+
175+```bash
176+export MANPAGER="sh -c 'col -bx | bat -l man -p'"
177+man 2 select
178+```
179+
180+(如果你使用的是 Debian 或者 Ubuntu,使用`batcat`替换`bat`)
181+
182+如果你遇到格式化问题,设置`MANROFFOPT="-c"`也许会有帮助。
183+
184+`batman`能提供类似功能——作为一个独立的命令。
185+
186+注意:[man page 语法](assets/syntaxes/02_Extra/Manpage.sublime-syntax) 还需要完善。在使用特定的`man`实现时该功能[无法正常工作](https://github.com/sharkdp/bat/issues/1145)。
187+
188+#### `prettier` / `shfmt` / `rustfmt`
189+
190+`prettybat`脚本能够格式化代码并用`bat`输出。
191+
192+## 安装
193+
194+[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions)
195+
196+### Ubuntu (使用 `apt`)
197+
198+*... 以及其他基于 Debian的发行版.*
199+
200+`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).
201+
202+当你的发行版满足条件那么直接在终端运执行:
203+
204+```bash
205+sudo apt install bat
206+```
207+
208+重要:如果你通过这种方法安装`bat`,请留意你所安装的可执行文件是否为`batcat`(由[其他包的可执行文件名冲突](https://github.com/sharkdp/bat/issues/982)造成)。你可以创建一个`bat -> batcat`的符号链接(symlink)或别名来避免因为可执行文件不同带来的问题并与其他发行版保持一致性。
209+
210+```bash
211+mkdir -p ~/.local/bin
212+ln -s /usr/bin/batcat ~/.local/bin/bat
213+```
214+
215+### Ubuntu (使用`.deb`包)
216+
217+*... 以及其他基于 Debian的发行版.*
218+
219+如果你无法使用上一种方法安装,或需要用最新版的`bat`,你可以从[release 页面](https://github.com/sharkdp/bat/releases)下载最新的`.deb`包并通过下述方法安装:
220+
221+```bash
222+sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
223+```
224+
225+### Alpine Linux
226+
227+你可以用下面下列命令从官方源中安装[`bat 包`](https://pkgs.alpinelinux.org/packages?name=bat):
228+
229+```bash
230+apk add bat
231+```
232+
233+### Arch Linux
234+
235+你可以用下面下列命令从官方源中安装[`bat`包](https://www.archlinux.org/packages/community/x86_64/bat/):
236+
237+```bash
238+pacman -S bat
239+```
240+
241+### Fedora
242+
243+你可以使用下列命令从官方[Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/)仓库安装[`bat` 包](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506):
244+
245+```bash
246+dnf install bat
247+```
248+
249+### Funtoo Linux
250+
251+你可以从 dev-kit 中安装[`bat` 包](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat):
252+
253+```bash
254+emerge sys-apps/bat
255+```
256+
257+### Gentoo Linux
258+
259+你可以使用下列命令从官方源中安装 [`bat` 包](https://packages.gentoo.org/packages/sys-apps/bat):
260+
261+
262+```bash
263+emerge sys-apps/bat
264+```
265+
266+### Void Linux
267+
268+你可以用 xbps-install 安装`bat`:
269+
270+```bash
271+xbps-install -S bat
272+```
273+
274+### Termux:
275+
276+你可以用 pkg 安装`bat:
277+
278+```bash
279+pkg install bat
280+```
281+
282+### FreeBSD
283+
284+你可以用 pkg 来安装一份预编译的[`bat` 包](https://www.freshports.org/textproc/bat):
285+
286+```bash
287+pkg install bat
288+```
289+
290+或从 FreeBSD ports 自己编译一份:
291+
292+```bash
293+cd /usr/ports/textproc/bat
294+make install
295+```
296+
297+### OpenBSD
298+
299+你可以用`pkg——add`安装`bat`包
300+
301+```bash
302+pkg_add bat
303+```
304+
305+### 通过 nix
306+
307+你可以用[nix 包管理器](https://nixos.org/nix)安装`bat`:
308+
309+```bash
310+nix-env -i bat
311+```
312+
313+### openSUSE
314+
315+你可以用 zypper 安装`bat`:
316+
317+```bash
318+zypper install bat
319+```
320+
321+### 通过 snap
322+
323+目前还没有推荐的 snap 包可用。可以使用其他现存的包但不会受到官方支持且可能会遇到[问题](https://github.com/sharkdp/bat/issues/1519)。
324+
325+### macOS (或 Linux) 通过 Homebrew
326+
327+你可以用 [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) 或者 [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat) 安装`bat`:
328+
329+```bash
330+brew install bat
331+```
332+
333+### macOS 通过 MacPorts
334+
335+或用 [MacPorts](https://ports.macports.org/port/bat/summary) 安装`bat`:
336+
337+```bash
338+port install bat
339+```
340+
341+### Windows
342+
343+在 Windows 上具有多种安装`bat`的方法。若你已完成安装,记得看看 ["在 Windows 上使用`bat`"](#在-Windows-中使用-bat) 。
344+
345+#### 前置条件
346+
347+你必须已安装 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
348+
349+#### 使用 Chocolatey
350+
351+你可以用[Chocolatey](https://chocolatey.org/packages/Bat) 安装`bat`:
352+
353+```bash
354+choco install bat
355+```
356+
357+#### 使用 Scoop
358+
359+你可以用 [scoop](https://scoop.sh/) 安装`bat`:
360+
361+```bash
362+scoop install bat
363+```
364+
365+#### 使用预编译二进制版本
366+
367+直接从 [Release 发布页](https://github.com/sharkdp/bat/releases) 下载已经编译好的二进制包,前提是你安装了 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
368+
369+### 使用二进制版本
370+
371+在 [Release 发布页](https://github.com/sharkdp/bat/releases) 中可以找到为多种架构构建的`bat`版本和静态编译的二进制文件(文件名带有`musl`)。
372+
373+### 从源码编译
374+
375+如果你想要自己构建`bat`,那么你需要安装有高于1.51版本的 Rust。
376+
377+使用以下命令编译。
378+
379+```bash
380+cargo install --locked bat
381+```
382+
383+注意:man page或 shell 自动补全所需要的额外文件无法通过该方法安装。但你可以在`cargo`的生成目录找到这些文件(`build`目录下)。
384+
385+## 自定义
386+
387+### 语法高亮主题
388+
389+使用 `bat --list-themes` 一份语法高亮主题的清单,然后用`--theme=TwoDark`来指定主题为`TwoDark`,也可以通过设置`BAT_THEME`环境变量来选定主题。把`export BAT_THEME="TwoDark"`添加到 shell 的启动脚本(shell startup file)来取得永久效果。或者使用`bat`的[配置文件](#c配置文件)
390+
391+若想要查看所有主题在一个文件上的显示效果可以用一下命令(需要安装`fzf`):
392+
393+```bash
394+bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
395+```
396+
397+`bat`在默认情况下能够在黑色主题背景下获得较好的效果,如果你的终端使用亮色背景,可以试试`GitHub`或`OneHalfLight`。想要添加自定义主题可以参考[添加主题](#添加主题)。
398+
399+### 8-bit 主题
400+
401+`bat` 自带三个 [8-bit 色彩](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 主题:
402+
403+- `ansi` 适应于大部分终端。它使用 3-bit 色彩:黑红绿黄蓝洋红靛青白。
404+- `base16`专为 [base16](https://github.com/chriskempson/base16) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md) 制作。
405+- `base16-25`专为 [base16-shell](https://github.com/chriskempson/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
406+
407+尽管这些主题具有诸多限制,但具有一些 truecolor 主题不具有的三个优点:
408+
409+- 享有最佳兼容性。并不是所有终端工具都支持高于 3-bit 的色彩。
410+- 适应终端主题。
411+- 视觉上和其他的终端工具更协调。
412+
413+### 输出样式
414+
415+你可以用`--style`参数来控制`bat`输出的样式。使用`--style=numbers,chanegs`可以只开启 Git 修改和行号显示而不添加其他内容。`BAT_STYLE`环境变量具有相同功能。
416+
417+### 添加新的语言和语法
418+
419+当现有的`bat`不支持某个语言或语法时你可以自己添加。
420+
421+`bat`使用`syntect`库来支持语法高亮,该库使用 [Sublime Text `.sublime-syntax` 语法文件](https://www.sublimetext.com/docs/3/syntax.html)和主题。而后者中的大部分可以在 [Package Control](https://packagecontrol.io/) 找到。
422+
423+当你找到一份语法文件,按照下列方法:
424+
425+1. 创建包含语法描述文件的目录:
426+
427+ ```bash
428+ mkdir -p "$(bat --config-dir)/syntaxes"
429+ cd "$(bat --config-dir)/syntaxes"
430+
431+ # Put new '.sublime-syntax' language definition files
432+ # in this folder (or its subdirectories), for example:
433+ git clone https://github.com/tellnobody1/sublime-purescript-syntax
434+ ```
435+
436+2. 调用下面指令把文件转换为二进制缓存:
437+
438+ ```bash
439+ bat cache --build
440+ ```
441+
442+3. 最后用`bat --list-languages`来检查新的语法是否被成功导入。如果想要回滚到最初状态,执行:
443+
444+ ```bash
445+ bat cache --clear
446+ ```
447+
448+4. 如果你觉得`bat`有必要自带该语法支持,请在阅读[指导](doc/assets.md)后向仓库提交 [Syntax Request](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md)。
449+
450+### 添加主题
451+
452+类似添加语法支持,第一步也是创建一个带有语法高亮的目录
453+
454+```bash
455+mkdir -p "$(bat --config-dir)/themes"
456+cd "$(bat --config-dir)/themes"
457+
458+# 下载一个主题
459+git clone https://github.com/greggb/sublime-snazzy
460+
461+# 更新二进制缓存
462+bat cache --build
463+```
464+
465+然后用`bat --list-themes`检查添加是否成功。
466+
467+### 添加或修改文件关联
468+
469+你可以用`--map-syntax`参数添加或修改文件名模板。它需要一个类似`pattern:syntax`的参数来指定,其中`pattern`是 glob 文件匹配模板,`syntax`则是支持的语法的完整名(使用`bat --list-languages`来查看获取一份清单)。
470+
471+注意:方便起见,你可能需要把参数添加到配置文件,而不是每次都在命令行中传递该参数。
472+
473+以下展示了把“INI”关联到具有`.conf`扩展名的文件
474+
475+```bash
476+--map-syntax='*.conf:INI'
477+```
478+
479+把`.ignore`文件与“Git Ignore”关联
480+
481+```bash
482+--map-syntax='.ignore:Git Ignore'
483+```
484+
485+把`/etc/apache2`内的`.conf`文件关联到“Apache Conf”语法(`bat`已默认绑定)
486+
487+```bash
488+--map-syntax='/etc/apache2/**/*.conf:Apache Conf'
489+```
490+
491+### 使用自定义分页器
492+
493+`bat`默认使用`PAGER`环境变量定义的分页器,如果没有定义则使用`less`。`bat`提供了`BAT_PAGER`环境变量来专为`bat`选择分页器(优先级高于`PAGER`)。
494+
495+注意:当`PAGER`设置为`more`或`most`时,`bat`会使用`less`来代替以确保能提供色彩支持。
496+
497+```bash
498+export BAT_PAGER="less -RF"
499+```
500+
501+除了使用环境变量来改变`bat`使用的的分页器,也可以在配置文件中提供`--pager`参数。
502+
503+注意:`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`功能。)。
504+
505+### 缩进
506+
507+`bat` 使用四个空格宽的制表符,而不受分页器影响,同时也可以用`--tabs`参数来自定义。
508+
509+注意:通过其他方法针对分页器的制表符设置不会生效(例如通过`bat`的`--pager`参数传递或`less`使用的`LESS`环境变量)。因为在输出提交给分页器之前,内容中的制表符就已经被`bat`替换为了特定长度的空格以避免由于边栏导致的缩进问题。你可以用给`bat`传递`--tabs=0`参数来取消该设定并让分页器自己处理制表符。
510+
511+### 暗色模式
512+
513+如果你用的 macOS 处于暗色模式,你可以为`bat`启用基于系统主题的主题。如下所示操作会让`bat`在系统处于亮色模式时加载`GitHub`主题和暗色模式时加载`default`主题。
514+
515+```bash
516+alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
517+```
518+
519+## 配置文件
520+
521+```bash
522+bat --config-file
523+```
524+
525+你也可以用`BAT_CONFIG_PATH`来为`bat`指定自定义位置的配置文件:
526+
527+```bash
528+export BAT_CONFIG_PATH="/path/to/bat.conf"
529+```
530+
531+使用`--generate-config-file`参数调用`bat`会在指定位置生成一份默认的`bat`配置文件:
532+
533+```bash
534+bat --generate-config-file
535+```
536+
537+### 格式
538+
539+配置文件其实是一份按行分割的命令行参数列表。你可以用`bat --help`来查看所有可用的参数和适用的值。配置文件中`#`打头的行会被视为注释而不生效。
540+
541+以下是一份示例:
542+
543+```bash
544+# 设置主题为 TwoDark
545+--theme="TwoDark"
546+
547+# 显示行号和 Git 修改信息, 但没有边框
548+--style="numbers,changes,header"
549+
550+# 在终端中以斜体输出文本(不是所有终端都支持)
551+--italic-text=always
552+
553+# 使用 C++ 语法来给 Ardiuno 的 .ino 文件提供高亮
554+--map-syntax "*.ino:C++"
555+```
556+
557+## 在 Windows 中使用 `bat`
558+
559+`bat` 在 Windows 上开箱即用,除了部分功能需要额外配置。
560+
561+### 前置条件
562+
563+你需要先安装 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
564+
565+### 分页
566+
567+Windows 只有一个提供有限功能的分页器,你可以从[这里下载](http://www.greenwoodsoftware.com/less/download.html)或用 [Chocolatey 安装](https://chocolatey.org/packages/Less) Windows 版本的`less`。第一种方法需要你把它所在目录加入`PATH`环境变量或[定义分页器变量](#使用自定义分页器)
568+
569+### 色彩
570+
571+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/))。
572+
573+注意:Git 和 MSYS 版本的 `less` 没法正确在 Windows 表达色彩。如果你没有安装其他分页器,你可以直接用`--paging=never`或设置`BAT_PAGER`为空字符串来关闭分页功能。
574+
575+### Cygwin
576+
577+Windows 上的`bat`原生不支持 Cygwin' unix-style 路径(`/cygdrive/*`)。当传递一个绝对 cygwin 路径作为参数值时,`bat`会产生`The system cannot find the path specified. (os error 3)`的错误。你可以`.bash_profile`文件中添加以下函数来解决这个问题。
578+
579+```bash
580+bat() {
581+ local index
582+ local args=("$@")
583+ for index in $(seq 0 ${#args[@]}) ; do
584+ case "${args[index]}" in
585+ -*) continue;;
586+ *) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
587+ esac
588+ done
589+ command bat "${args[@]}"
590+}
591+```
592+
593+## 疑难解答
594+
595+### 输出内容含糊不清
596+
597+当输入文件包含颜色代码和其他 ANSI 转义符号时,`bat`会产生错误的语法高亮和文本,导致输出看起来令人无法理解。当你需要输出该文件时,请使用`--color=never --wrap=never`参数来关闭上色和文字包裹。
598+
599+### 终端与色彩
600+
601+`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 模式。
602+
603+### 行号和边框很难看清
604+
605+试试其他主题,说不定能有所改善(用`bat --list-themes`查看主题列表)。
606+
607+### 文件编码
608+
609+`bat`原生支持 UTF-8 和 UTF-16。至于其他文件你可能需要在使用`bat`之前先把编码转换到UTF-8。
610+
611+这里展示了使用`iconv`来把 Latin-1(ISO-8859-1) 编码的 PHP 文件转换到 UTF-8:
612+
613+```bash
614+iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
615+```
616+
617+注意: 当`bat`无法识别语言时你可能会需要`-l`/`--language`参数。
618+
619+## Development
620+
621+```bash
622+# Recursive clone to retrieve all submodules
623+git clone --recursive https://github.com/sharkdp/bat
624+
625+# Build (debug version)
626+cd bat
627+cargo build --bins
628+
629+# Run unit tests and integration tests
630+cargo test
631+
632+# Install (release version)
633+cargo install --path . --locked
634+
635+# Build a bat binary with modified syntaxes and themes
636+bash assets/create.sh
637+cargo install --path . --locked --force
638+```
639+
640+If you want to build an application that uses `bat`s pretty-printing
641+features as a library, check out the [the API documentation](https://docs.rs/bat/).
642+Note that you have to use either `regex-onig` or `regex-fancy` as a feature
643+when you depend on `bat` as a library.
644+
645+## Contributing
646+
647+Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
648+
649+## Maintainers
650+
651+- [sharkdp](https://github.com/sharkdp)
652+- [eth-p](https://github.com/eth-p)
653+- [keith-hall](https://github.com/keith-hall)
654+- [Enselic](https://github.com/Enselic)
655+
656+## Security vulnerabilities
657+
658+Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
659+
660+## Project goals and alternatives
661+
662+`bat` tries to achieve the following goals:
663+
664+- Provide beautiful, advanced syntax highlighting
665+- Integrate with Git to show file modifications
666+- Be a drop-in replacement for (POSIX) `cat`
667+- Offer a user-friendly command-line interface
668+
669+There are a lot of alternatives, if you are looking for similar programs. See
670+[this document](doc/alternatives.md) for a comparison.
671+
672+## License
673+
674+Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
675+
676+`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
677+
678+See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
doc/alternatives.md+39
@@ -22,3 +22,42 @@ request.
2222Some other alternatives that are also related, but not yet included in the table:
2323- [lesspipe](https://github.com/wofr06/lesspipe)
2424- [vimpager](https://github.com/rkitover/vimpager)
25+
26+## Benchmarks
27+
28+The benchmarks above have been created with this script:
29+```bash
30+#!/usr/bin/env bash
31+
32+cd "$(dirname "${BASH_SOURCE[0]}")" || exit
33+
34+if ! command -v hyperfine > /dev/null 2>&1; then
35+ echo "'hyperfine' does not seem to be installed."
36+ echo "You can get it here: https://github.com/sharkdp/hyperfine"
37+ exit 1
38+fi
39+
40+SRC="test-src/jquery-3.3.1.js"
41+
42+
43+cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
44+cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
45+cmd_pygmentize="pygmentize -g '$SRC'"
46+cmd_highlight="highlight -O truecolor '$SRC'"
47+cmd_ccat="ccat --color=always '$SRC'"
48+cmd_source_highlight="source-highlight --failsafe --infer-lang -f esc -i '$SRC'"
49+cmd_hicat="hicat '$SRC'"
50+cmd_coderay="coderay '$SRC'"
51+cmd_rouge="rougify '$SRC'"
52+
53+hyperfine --warmup 3 \
54+ "$cmd_bat" \
55+ "$cmd_bat_simple" \
56+ "$cmd_pygmentize" \
57+ "$cmd_highlight" \
58+ "$cmd_ccat" \
59+ "$cmd_source_highlight" \
60+ "$cmd_hicat" \
61+ "$cmd_coderay" \
62+ "$cmd_rouge" \
63+```
doc/release-checklist.md+33−18
@@ -1,15 +1,5 @@
11# Release checklist
22
3−## Dependencies
4−
5−See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
6−
7−- [ ] Optional: update dependencies with `cargo update`. This is also done by
8− dependabot, so it is not strictly necessary.
9−- [ ] Check for outdated dependencies (`cargo outdated`) and decide for each of
10− them whether we want to (manually) upgrade. This will require changes to
11− `Cargo.toml`.
12−
133## Version bump
144
155- [ ] Update version in `Cargo.toml`. Run `cargo build` to update `Cargo.lock`.
@@ -17,36 +7,38 @@ See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
177- [ ] Find the current min. supported Rust version by running
188 `grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
199- [ ] Update the version and the min. supported Rust version in `README.md` and
20− `doc/README-*.md`.
21−- [ ] Update `CHANGELOG.md`. Introduce a section for the new release and
22− prepare a new (empty) "unreleased" section at the top.
10+ `doc/README-*.md`. Check with
11+ `git grep -i -e 'rust.*1\.' -e '1\..*rust' | grep README | grep -v tests/`.
12+- [ ] Update `CHANGELOG.md`. Introduce a section for the new release.
2313
2414## Update syntaxes and themes (build assets)
2515
26−- [ ] Install the latest master version (`cargo install -f --path .`) and make
16+- [ ] Install the latest master version (`cargo clean && cargo install --locked -f --path .`) and make
2717 sure that it is available on the `PATH` (`bat --version` should show the
2818 new version).
2919- [ ] Run `assets/create.sh` and check in the binary asset files.
3020
3121## Documentation
3222
33−- [ ] Review the `-h` and `--help` texts
34−- [ ] Review the `man` page
23+- [ ] Review `-h`, `--help`, and the `man` page. All of these are shown in
24+ the output of the CI job called *Documentation*, so look there.
25+ The CI workflow corresponding to the tip of the master branch is a good place to look.
3526
3627## Pre-release checks
3728
3829- [ ] Push all changes and wait for CI to succeed (before continuing with the
3930 next section).
4031- [ ] Optional: manually test the new features and command-line options. To do
41− this, install the latest `bat` version again (to include the new synaxes
32+ this, install the latest `bat` version again (to include the new syntaxes
4233 and themes).
43−- [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
34+- [ ] Run `cargo publish --dry-run` to make sure that it will
4435 succeed later (after creating the GitHub release).
4536
4637## Release
4738
4839- [ ] Create a tag and push it: `git tag vX.Y.Z; git push origin tag vX.Y.Z`.
4940 This will trigger the deployment via GitHub Actions.
41+ REMINDER: If your `origin` is a fork, don't forget to push to e.g. `upstream` instead!
5042- [ ] Go to https://github.com/sharkdp/bat/releases/new to create the new
5143 release. Select the new tag and also use it as the release title. For the
5244 release notes, copy the corresponding section from `CHANGELOG.md` and
@@ -56,3 +48,26 @@ See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
5648 appear when the CI run for the Git tag has finished).
5749- [ ] Publish to crates.io by running `cargo publish` in a *clean* repository.
5850 The safest way to do this is to clone a fresh copy.
51+
52+## Post-release
53+
54+- [ ] Prepare a new "unreleased" section at the top of `CHANGELOG.md`.
55+ Put this at the top:
56+
57+```
58+# unreleased
59+
60+## Features
61+
62+## Bugfixes
63+
64+## Other
65+
66+## Syntaxes
67+
68+## Themes
69+
70+## `bat` as a library
71+
72+
73+```
doc/sponsors.mdnew file+14
@@ -0,0 +1,14 @@
1+## Sponsors
2+
3+`bat` development is sponsored by many individuals and companies. Thank you very much!
4+
5+Please note, that being sponsored does not affect the individuality of the `bat`
6+project or affect the maintainers' actions in any way.
7+We remain impartial and continue to assess pull requests solely on merit - the
8+features added, bugs solved, and effect on the overall complexity of the code.
9+No issue will have a different priority based on sponsorship status of the
10+reporter.
11+
12+Contributions from anybody are most welcomed, please see our [`CONTRIBUTING.md`](../CONTRIBUTING.md) guide.
13+
14+If you want to see our biggest sponsors, check the top of [`README.md`](../README.md#sponsors).
doc/sponsors/workos-logo-white-bg.svgnew file+11
@@ -0,0 +1,11 @@
1+<svg width="1354" height="420" viewBox="0 0 1354 420" fill="none" xmlns="http://www.w3.org/2000/svg">
2+<rect width="1354" height="420" rx="20" fill="white"/>
3+<path d="M434.751 133.122H466.637L489.595 227.729C493.852 245.585 494.697 256.219 494.697 256.219H495.128C495.128 256.219 496.61 245.808 500.867 227.729L522.757 133.122H558.9L582.066 227.729C586.53 246.223 587.598 256.219 587.598 256.219H588.236C588.236 256.219 588.666 246.223 592.907 227.729L615.02 133.122H646.907L606.523 288.313H571.017L546.576 194.344C541.474 173.936 541.044 164.801 541.044 164.801H540.614C540.614 164.801 540.183 173.936 535.512 194.344L512.553 288.313H475.996L434.751 133.122Z" fill="black"/>
4+<path d="M641.583 231.934C641.583 196.428 664.541 173.47 699.202 173.47C733.639 173.47 756.597 196.428 756.597 231.934C756.597 267.647 733.639 290.828 699.202 290.828C664.557 290.812 641.583 267.647 641.583 231.934ZM726.832 231.934C726.832 208.976 715.783 195.998 699.202 195.998C681.346 195.998 671.349 210.458 671.349 231.934C671.349 255.323 682.398 268.284 699.202 268.284C717.058 268.284 726.832 253.824 726.832 231.934Z" fill="black"/>
5+<path d="M770.836 175.21H799.103V196.048H799.741C804.635 185.207 816.322 174.365 836.299 174.365C839.695 174.365 841.831 174.796 843.314 175.21V203.478H842.469C842.469 203.478 839.918 202.633 832.903 202.633C811.013 202.633 799.103 215.594 799.103 239.828V288.295H770.836V175.21Z" fill="black"/>
6+<path d="M856.5 133.122H884.767V182.865C884.767 212.2 884.336 217.509 884.336 217.509H884.767L926.857 175.212H962.139L912.843 224.11L970.031 288.313H936.646L895.401 241.536L884.767 251.946V288.297H856.5V133.122Z" fill="black"/>
7+<path d="M970.444 211.285C970.444 163.455 1000.21 131.569 1044.85 131.569C1089.49 131.569 1119.26 163.455 1119.26 211.285C1119.26 259.114 1089.49 291.001 1044.85 291.001C1000.21 291.001 970.444 259.114 970.444 211.285ZM1088.42 211.285C1088.42 178.761 1071 156.855 1044.84 156.855C1018.67 156.855 1001.26 178.761 1001.26 211.285C1001.26 243.809 1018.69 265.715 1044.84 265.715C1070.98 265.715 1088.42 243.809 1088.42 211.285Z" fill="black"/>
8+<path d="M1130.08 236.656H1162.4C1162.4 254.943 1174.95 265.146 1194.08 265.146C1210.23 265.146 1221.29 257.063 1221.29 245.584C1221.29 232.622 1212.79 229.21 1185.79 223.901C1161.12 219.007 1134.98 210.716 1134.98 178.399C1134.98 151.408 1157.93 131 1193.01 131C1229.57 131 1252.11 150.132 1252.11 179.037H1219.79C1219.79 165.007 1208.95 156.286 1193.01 156.286C1176.86 156.286 1166.86 164.146 1166.86 175.625C1166.86 187.742 1173.88 192.413 1195.56 196.878C1227.65 203.685 1254.02 207.288 1254.02 243.001C1254.02 271.3 1229.36 290.432 1193.01 290.432C1156.02 290.432 1130.08 268.957 1130.08 236.656Z" fill="black"/>
9+<path d="M100 210C100 214.824 101.269 219.647 103.723 223.793L148.231 300.878C152.8 308.747 159.739 315.178 168.369 318.055C185.377 323.724 202.977 316.447 211.354 301.893L222.1 283.278L179.708 210L224.47 132.408L235.216 113.792C238.431 108.208 242.747 103.638 247.824 100H243.17H178.777C166.677 100 155.508 106.431 149.5 116.923L103.723 196.208C101.269 200.354 100 205.177 100 210Z" fill="#6363F1"/>
10+<path d="M353.847 210C353.847 205.177 352.578 200.353 350.124 196.207L305.024 118.107C296.647 103.638 279.047 96.3608 262.039 101.945C253.409 104.822 246.47 111.253 241.901 119.122L231.747 136.638L274.139 210L229.378 287.592L218.632 306.208C215.416 311.708 211.101 316.362 206.024 320H210.678H275.07C287.17 320 298.34 313.569 304.347 303.077L350.124 223.792C352.578 219.646 353.847 214.823 353.847 210Z" fill="#6363F1"/>
11+</svg>
rustfmt.tomlnew file+1
@@ -0,0 +1 @@
1+# Defaults are used
src/assets.rs+110−21
@@ -2,9 +2,9 @@ use std::ffi::OsStr;
22use std::fs;
33use std::path::Path;
44
5−use lazycell::LazyCell;
5+use once_cell::unsync::OnceCell;
66
7−use syntect::highlighting::{Theme, ThemeSet};
7+use syntect::highlighting::Theme;
88use syntect::parsing::{SyntaxReference, SyntaxSet};
99
1010use path_abs::PathAbs;
@@ -15,6 +15,8 @@ use crate::syntax_mapping::ignored_suffixes::IgnoredSuffixes;
1515use crate::syntax_mapping::MappingTarget;
1616use crate::{bat_warning, SyntaxMapping};
1717
18+use lazy_theme_set::LazyThemeSet;
19+
1820use serialized_syntax_set::*;
1921
2022#[cfg(feature = "build-assets")]
@@ -23,14 +25,15 @@ pub use crate::assets::build_assets::*;
2325pub(crate) mod assets_metadata;
2426#[cfg(feature = "build-assets")]
2527mod build_assets;
28+mod lazy_theme_set;
2629mod serialized_syntax_set;
2730
2831#[derive(Debug)]
2932pub struct HighlightingAssets {
30− syntax_set_cell: LazyCell<SyntaxSet>,
33+ syntax_set_cell: OnceCell<SyntaxSet>,
3134 serialized_syntax_set: SerializedSyntaxSet,
3235
33− theme_set: ThemeSet,
36+ theme_set: LazyThemeSet,
3437 fallback_theme: Option<&'static str>,
3538}
3639
@@ -40,26 +43,83 @@ pub struct SyntaxReferenceInSet<'a> {
4043 pub syntax_set: &'a SyntaxSet,
4144}
4245
43−/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
44−pub(crate) const COMPRESS_SYNTAXES: bool = true;
46+/// Lazy-loaded syntaxes are already compressed, and we don't want to compress
47+/// already compressed data.
48+pub(crate) const COMPRESS_SYNTAXES: bool = false;
49+
50+/// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes
51+/// within it are already compressed, and compressing another time just makes
52+/// performance suffer
53+pub(crate) const COMPRESS_THEMES: bool = false;
4554
46−/// Compress for size of ~20 kB instead of ~200 kB at the cost of ~30% longer deserialization time
47−pub(crate) const COMPRESS_THEMES: bool = true;
55+/// Compress for size of ~40 kB instead of ~200 kB without much difference in
56+/// performance due to lazy-loading
57+pub(crate) const COMPRESS_LAZY_THEMES: bool = true;
58+
59+/// Compress for size of ~10 kB instead of ~120 kB
60+pub(crate) const COMPRESS_ACKNOWLEDGEMENTS: bool = true;
4861
4962impl HighlightingAssets {
50− fn new(serialized_syntax_set: SerializedSyntaxSet, theme_set: ThemeSet) -> Self {
63+ fn new(serialized_syntax_set: SerializedSyntaxSet, theme_set: LazyThemeSet) -> Self {
5164 HighlightingAssets {
52− syntax_set_cell: LazyCell::new(),
65+ syntax_set_cell: OnceCell::new(),
5366 serialized_syntax_set,
5467 theme_set,
5568 fallback_theme: None,
5669 }
5770 }
5871
72+ /// The default theme.
73+ ///
74+ /// ### Windows and Linux
75+ ///
76+ /// Windows and most Linux distributions has a dark terminal theme by
77+ /// default. On these platforms, this function always returns a theme that
78+ /// looks good on a dark background.
79+ ///
80+ /// ### macOS
81+ ///
82+ /// On macOS the default terminal background is light, but it is common that
83+ /// Dark Mode is active, which makes the terminal background dark. On this
84+ /// platform, the default theme depends on
85+ /// ```bash
86+ /// defaults read -globalDomain AppleInterfaceStyle
87+ /// ````
88+ /// To avoid the overhead of the check on macOS, simply specify a theme
89+ /// explicitly via `--theme`, `BAT_THEME`, or `~/.config/bat`.
90+ ///
91+ /// See <https://github.com/sharkdp/bat/issues/1746> and
92+ /// <https://github.com/sharkdp/bat/issues/1928> for more context.
5993 pub fn default_theme() -> &'static str {
94+ #[cfg(not(target_os = "macos"))]
95+ {
96+ Self::default_dark_theme()
97+ }
98+ #[cfg(target_os = "macos")]
99+ {
100+ if macos_dark_mode_active() {
101+ Self::default_dark_theme()
102+ } else {
103+ Self::default_light_theme()
104+ }
105+ }
106+ }
107+
108+ /**
109+ * The default theme that looks good on a dark background.
110+ */
111+ fn default_dark_theme() -> &'static str {
60112 "Monokai Extended"
61113 }
62114
115+ /**
116+ * The default theme that looks good on a light background.
117+ */
118+ #[cfg(target_os = "macos")]
119+ fn default_light_theme() -> &'static str {
120+ "Monokai Extended Light"
121+ }
122+
63123 pub fn from_cache(cache_path: &Path) -> Result<Self> {
64124 Ok(HighlightingAssets::new(
65125 SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
@@ -78,9 +138,10 @@ impl HighlightingAssets {
78138 self.fallback_theme = Some(theme);
79139 }
80140
81− fn get_syntax_set(&self) -> Result<&SyntaxSet> {
141+ /// Return the collection of syntect syntax definitions.
142+ pub fn get_syntax_set(&self) -> Result<&SyntaxSet> {
82143 self.syntax_set_cell
83− .try_borrow_with(|| self.serialized_syntax_set.deserialize())
144+ .get_or_try_init(|| self.serialized_syntax_set.deserialize())
84145 }
85146
86147 /// Use [Self::get_syntaxes] instead
@@ -95,12 +156,12 @@ impl HighlightingAssets {
95156 Ok(self.get_syntax_set()?.syntaxes())
96157 }
97158
98− fn get_theme_set(&self) -> &ThemeSet {
159+ fn get_theme_set(&self) -> &LazyThemeSet {
99160 &self.theme_set
100161 }
101162
102163 pub fn themes(&self) -> impl Iterator<Item = &str> {
103− self.get_theme_set().themes.keys().map(|s| s.as_ref())
164+ self.get_theme_set().themes()
104165 }
105166
106167 /// Use [Self::get_syntax_for_path] instead
@@ -174,8 +235,9 @@ impl HighlightingAssets {
174235 }
175236 }
176237
177− pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
178− match self.get_theme_set().themes.get(theme) {
238+ /// Look up a syntect theme by name.
239+ pub fn get_theme(&self, theme: &str) -> &Theme {
240+ match self.get_theme_set().get(theme) {
179241 Some(theme) => theme,
180242 None => {
181243 if theme == "ansi-light" || theme == "ansi-dark" {
@@ -185,8 +247,9 @@ impl HighlightingAssets {
185247 if !theme.is_empty() {
186248 bat_warning!("Unknown theme '{}', using default.", theme)
187249 }
188− &self.get_theme_set().themes
189− [self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
250+ self.get_theme_set()
251+ .get(self.fallback_theme.unwrap_or_else(Self::default_theme))
252+ .expect("something is very wrong if the default theme is missing")
190253 }
191254 }
192255 }
@@ -291,10 +354,17 @@ pub(crate) fn get_serialized_integrated_syntaxset() -> &'static [u8] {
291354 include_bytes!("../assets/syntaxes.bin")
292355}
293356
294−pub(crate) fn get_integrated_themeset() -> ThemeSet {
357+pub(crate) fn get_integrated_themeset() -> LazyThemeSet {
295358 from_binary(include_bytes!("../assets/themes.bin"), COMPRESS_THEMES)
296359}
297360
361+pub fn get_acknowledgements() -> String {
362+ from_binary(
363+ include_bytes!("../assets/acknowledgements.bin"),
364+ COMPRESS_ACKNOWLEDGEMENTS,
365+ )
366+}
367+
298368pub(crate) fn from_binary<T: serde::de::DeserializeOwned>(v: &[u8], compressed: bool) -> T {
299369 asset_from_contents(v, "n/a", compressed)
300370 .expect("data integrated in binary is never faulty, but make sure `compressed` is in sync!")
@@ -329,6 +399,16 @@ fn asset_from_cache<T: serde::de::DeserializeOwned>(
329399 .map_err(|_| format!("Could not parse cached {}", description).into())
330400}
331401
402+#[cfg(target_os = "macos")]
403+fn macos_dark_mode_active() -> bool {
404+ let mut defaults_cmd = std::process::Command::new("defaults");
405+ defaults_cmd.args(&["read", "-globalDomain", "AppleInterfaceStyle"]);
406+ match defaults_cmd.output() {
407+ Ok(output) => output.stdout == b"Dark\n",
408+ Err(_) => true,
409+ }
410+}
411+
332412#[cfg(test)]
333413mod tests {
334414 use super::*;
@@ -559,13 +639,22 @@ mod tests {
559639 }
560640
561641 #[test]
562− fn syntax_detection_is_case_sensitive() {
642+ fn syntax_detection_is_case_insensitive() {
563643 let mut test = SyntaxDetectionTest::new();
564644
565− assert_ne!(test.syntax_for_file("README.MD"), "Markdown");
645+ assert_eq!(test.syntax_for_file("README.md"), "Markdown");
646+ assert_eq!(test.syntax_for_file("README.mD"), "Markdown");
647+ assert_eq!(test.syntax_for_file("README.Md"), "Markdown");
648+ assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
649+
650+ // Adding a mapping for "MD" in addition to "md" should not break the mapping
566651 test.syntax_mapping
567652 .insert("*.MD", MappingTarget::MapTo("Markdown"))
568653 .ok();
654+
655+ assert_eq!(test.syntax_for_file("README.md"), "Markdown");
656+ assert_eq!(test.syntax_for_file("README.mD"), "Markdown");
657+ assert_eq!(test.syntax_for_file("README.Md"), "Markdown");
569658 assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
570659 }
571660
src/assets/build_assets.rs+31−7
@@ -1,29 +1,43 @@
1+use std::convert::TryInto;
12use std::path::Path;
3+
24use syntect::highlighting::ThemeSet;
35use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
46
57use crate::assets::*;
8+use acknowledgements::build_acknowledgements;
9+
10+mod acknowledgements;
611
712pub fn build(
813 source_dir: &Path,
914 include_integrated_assets: bool,
15+ include_acknowledgements: bool,
1016 target_dir: &Path,
1117 current_version: &str,
1218) -> Result<()> {
13− let theme_set = build_theme_set(source_dir, include_integrated_assets);
19+ let theme_set = build_theme_set(source_dir, include_integrated_assets)?;
1420
1521 let syntax_set_builder = build_syntax_set_builder(source_dir, include_integrated_assets)?;
1622
1723 let syntax_set = syntax_set_builder.build();
1824
25+ let acknowledgements = build_acknowledgements(source_dir, include_acknowledgements)?;
26+
1927 print_unlinked_contexts(&syntax_set);
2028
21− write_assets(&theme_set, &syntax_set, target_dir, current_version)
29+ write_assets(
30+ &theme_set,
31+ &syntax_set,
32+ &acknowledgements,
33+ target_dir,
34+ current_version,
35+ )
2236}
2337
24−fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> ThemeSet {
38+fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> Result<LazyThemeSet> {
2539 let mut theme_set = if include_integrated_assets {
26− crate::assets::get_integrated_themeset()
40+ crate::assets::get_integrated_themeset().try_into()?
2741 } else {
2842 ThemeSet::new()
2943 };
@@ -45,7 +59,7 @@ fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> ThemeS
4559 );
4660 }
4761
48− theme_set
62+ theme_set.try_into()
4963}
5064
5165fn build_syntax_set_builder(
@@ -85,8 +99,9 @@ fn print_unlinked_contexts(syntax_set: &SyntaxSet) {
8599}
86100
87101fn write_assets(
88− theme_set: &ThemeSet,
102+ theme_set: &LazyThemeSet,
89103 syntax_set: &SyntaxSet,
104+ acknowledgements: &Option<String>,
90105 target_dir: &Path,
91106 current_version: &str,
92107) -> Result<()> {
@@ -104,6 +119,15 @@ fn write_assets(
104119 COMPRESS_SYNTAXES,
105120 )?;
106121
122+ if let Some(acknowledgements) = acknowledgements {
123+ asset_to_cache(
124+ acknowledgements,
125+ &target_dir.join("acknowledgements.bin"),
126+ "acknowledgements",
127+ COMPRESS_ACKNOWLEDGEMENTS,
128+ )?;
129+ }
130+
107131 print!(
108132 "Writing metadata to folder {} ... ",
109133 target_dir.to_string_lossy()
@@ -114,7 +138,7 @@ fn write_assets(
114138 Ok(())
115139}
116140
117−fn asset_to_contents<T: serde::Serialize>(
141+pub(crate) fn asset_to_contents<T: serde::Serialize>(
118142 asset: &T,
119143 description: &str,
120144 compressed: bool,
src/assets/build_assets/acknowledgements.rsnew file+222
@@ -0,0 +1,222 @@
1+use std::fs::read_to_string;
2+use std::path::{Path, PathBuf};
3+
4+use walkdir::DirEntry;
5+
6+use crate::error::*;
7+
8+struct PathAndStem {
9+ path: PathBuf,
10+ stem: String,
11+ relative_path: String,
12+}
13+
14+/// Looks for LICENSE and NOTICE files in `source_dir`, does some rudimentary
15+/// analysis, and compiles them together in a single string that is meant to be
16+/// used in the output to `--acknowledgements`
17+pub fn build_acknowledgements(
18+ source_dir: &Path,
19+ include_acknowledgements: bool,
20+) -> Result<Option<String>> {
21+ if !include_acknowledgements {
22+ return Ok(None);
23+ }
24+
25+ let mut acknowledgements = format!("{}\n\n", include_str!("../../../NOTICE"));
26+
27+ // Sort entries so the order is stable over time
28+ let entries = walkdir::WalkDir::new(source_dir).sort_by(|a, b| a.path().cmp(b.path()));
29+ for path_and_stem in entries
30+ .into_iter()
31+ .flatten()
32+ .flat_map(|entry| to_path_and_stem(source_dir, entry))
33+ {
34+ if let Some(license_text) = handle_file(&path_and_stem)? {
35+ append_to_acknowledgements(
36+ &mut acknowledgements,
37+ &path_and_stem.relative_path,
38+ &license_text,
39+ )
40+ }
41+ }
42+
43+ Ok(Some(acknowledgements))
44+}
45+
46+fn to_path_and_stem(source_dir: &Path, entry: DirEntry) -> Option<PathAndStem> {
47+ let path = entry.path();
48+
49+ Some(PathAndStem {
50+ path: path.to_owned(),
51+ stem: path.file_stem().map(|s| s.to_string_lossy().to_string())?,
52+ relative_path: path
53+ .strip_prefix(source_dir)
54+ .map(|p| p.to_string_lossy().to_string())
55+ .ok()?,
56+ })
57+}
58+
59+fn handle_file(path_and_stem: &PathAndStem) -> Result<Option<String>> {
60+ if path_and_stem.stem == "NOTICE" {
61+ handle_notice(&path_and_stem.path)
62+ } else if path_and_stem.stem.to_ascii_uppercase() == "LICENSE" {
63+ handle_license(&path_and_stem.path)
64+ } else {
65+ Ok(None)
66+ }
67+}
68+
69+fn handle_notice(path: &Path) -> Result<Option<String>> {
70+ // Assume NOTICE as defined by Apache License 2.0. These must be part of acknowledgements.
71+ Ok(Some(read_to_string(path)?))
72+}
73+
74+fn handle_license(path: &Path) -> Result<Option<String>> {
75+ let license_text = read_to_string(path)?;
76+
77+ if include_license_in_acknowledgments(&license_text) {
78+ Ok(Some(license_text))
79+ } else if license_not_needed_in_acknowledgements(&license_text) {
80+ Ok(None)
81+ } else {
82+ Err(format!("ERROR: License is of unknown type: {:?}", path).into())
83+ }
84+}
85+
86+fn include_license_in_acknowledgments(license_text: &str) -> bool {
87+ let markers = vec![
88+ // MIT
89+ "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
90+
91+ // BSD
92+ "Redistributions in binary form must reproduce the above copyright notice,",
93+
94+ // Apache 2.0
95+ "Apache License Version 2.0, January 2004 http://www.apache.org/licenses/",
96+ "Licensed under the Apache License, Version 2.0 (the \"License\");",
97+ ];
98+
99+ license_contains_marker(license_text, &markers)
100+}
101+
102+fn license_not_needed_in_acknowledgements(license_text: &str) -> bool {
103+ let markers = vec![
104+ // Public domain
105+ "This is free and unencumbered software released into the public domain.",
106+
107+ // Public domain with stronger wording than above
108+ "DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE",
109+
110+ // Special license of assets/syntaxes/01_Packages/LICENSE
111+ "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."
112+ ];
113+
114+ license_contains_marker(license_text, &markers)
115+}
116+
117+fn license_contains_marker(license_text: &str, markers: &[&str]) -> bool {
118+ let normalized_license_text = normalize_license_text(license_text);
119+ markers.iter().any(|m| normalized_license_text.contains(m))
120+}
121+
122+fn append_to_acknowledgements(
123+ acknowledgements: &mut String,
124+ relative_path: &str,
125+ license_text: &str,
126+) {
127+ acknowledgements.push_str(&format!("## {}\n\n{}", relative_path, license_text));
128+
129+ // Make sure the last char is a newline to not mess up formatting later
130+ if acknowledgements
131+ .chars()
132+ .last()
133+ .expect("acknowledgements is not the empty string")
134+ != '\n'
135+ {
136+ acknowledgements.push('\n');
137+ }
138+
139+ // Add two more newlines to make it easy to distinguish where this text ends
140+ // and the next starts
141+ acknowledgements.push_str("\n\n");
142+}
143+
144+/// Replaces newlines with a space character, and replaces multiple spaces with one space.
145+/// This makes the text easier to analyze.
146+fn normalize_license_text(license_text: &str) -> String {
147+ use regex::Regex;
148+
149+ let whitespace_and_newlines = Regex::new(r"\s").unwrap();
150+ let as_single_line = whitespace_and_newlines.replace_all(license_text, " ");
151+
152+ let many_spaces = Regex::new(" +").unwrap();
153+ many_spaces.replace_all(&as_single_line, " ").to_string()
154+}
155+
156+#[cfg(test)]
157+mod tests {
158+ #[cfg(test)]
159+ use super::*;
160+
161+ #[test]
162+ fn test_normalize_license_text() {
163+ let license_text = "This is a license text with these terms:
164+ * Complicated multi-line
165+ term with indentation";
166+
167+ assert_eq!(
168+ "This is a license text with these terms: * Complicated multi-line term with indentation".to_owned(),
169+ normalize_license_text(license_text),
170+ );
171+ }
172+
173+ #[test]
174+ fn test_normalize_license_text_with_windows_line_endings() {
175+ let license_text = "This license text includes windows line endings\r
176+and we need to handle that.";
177+
178+ assert_eq!(
179+ "This license text includes windows line endings and we need to handle that."
180+ .to_owned(),
181+ normalize_license_text(license_text),
182+ );
183+ }
184+
185+ #[test]
186+ fn test_append_to_acknowledgements_adds_newline_if_missing() {
187+ let mut acknowledgements = "preamble\n\n\n".to_owned();
188+
189+ append_to_acknowledgements(&mut acknowledgements, "some/path", "line without newline");
190+ assert_eq!(
191+ "preamble
192+
193+
194+## some/path
195+
196+line without newline
197+
198+
199+",
200+ acknowledgements
201+ );
202+
203+ append_to_acknowledgements(&mut acknowledgements, "another/path", "line with newline\n");
204+ assert_eq!(
205+ "preamble
206+
207+
208+## some/path
209+
210+line without newline
211+
212+
213+## another/path
214+
215+line with newline
216+
217+
218+",
219+ acknowledgements
220+ );
221+ }
222+}
src/assets/lazy_theme_set.rsnew file+104
@@ -0,0 +1,104 @@
1+use super::*;
2+
3+use std::collections::BTreeMap;
4+use std::convert::TryFrom;
5+
6+use serde::Deserialize;
7+use serde::Serialize;
8+
9+use once_cell::unsync::OnceCell;
10+
11+use syntect::highlighting::{Theme, ThemeSet};
12+
13+/// Same structure as a [`syntect::highlighting::ThemeSet`] but with themes
14+/// stored in raw serialized form, and deserialized on demand.
15+#[derive(Debug, Default, Serialize, Deserialize)]
16+pub struct LazyThemeSet {
17+ /// This is a [`BTreeMap`] because that's what [`syntect::highlighting::ThemeSet`] uses
18+ themes: BTreeMap<String, LazyTheme>,
19+}
20+
21+/// Stores raw serialized data for a theme with methods to lazily deserialize
22+/// (load) the theme.
23+#[derive(Debug, Serialize, Deserialize)]
24+struct LazyTheme {
25+ serialized: Vec<u8>,
26+
27+ #[serde(skip, default = "OnceCell::new")]
28+ deserialized: OnceCell<syntect::highlighting::Theme>,
29+}
30+
31+impl LazyThemeSet {
32+ /// Lazily load the given theme
33+ pub fn get(&self, name: &str) -> Option<&Theme> {
34+ self.themes.get(name).and_then(|lazy_theme| {
35+ lazy_theme
36+ .deserialized
37+ .get_or_try_init(|| lazy_theme.deserialize())
38+ .ok()
39+ })
40+ }
41+
42+ /// Returns the name of all themes.
43+ pub fn themes(&self) -> impl Iterator<Item = &str> {
44+ self.themes.keys().map(|name| name.as_ref())
45+ }
46+}
47+
48+impl LazyTheme {
49+ fn deserialize(&self) -> Result<Theme> {
50+ asset_from_contents(
51+ &self.serialized[..],
52+ "lazy-loaded theme",
53+ COMPRESS_LAZY_THEMES,
54+ )
55+ }
56+}
57+
58+impl TryFrom<LazyThemeSet> for ThemeSet {
59+ type Error = Error;
60+
61+ /// Since the user might want to add custom themes to bat, we need a way to
62+ /// convert from a `LazyThemeSet` to a regular [`ThemeSet`] so that more
63+ /// themes can be added. This function does that pretty straight-forward
64+ /// conversion.
65+ fn try_from(lazy_theme_set: LazyThemeSet) -> Result<Self> {
66+ let mut theme_set = ThemeSet::default();
67+
68+ for (name, lazy_theme) in lazy_theme_set.themes {
69+ theme_set.themes.insert(name, lazy_theme.deserialize()?);
70+ }
71+
72+ Ok(theme_set)
73+ }
74+}
75+
76+#[cfg(feature = "build-assets")]
77+impl TryFrom<ThemeSet> for LazyThemeSet {
78+ type Error = Error;
79+
80+ /// To collect themes, a [`ThemeSet`] is needed. Once all desired themes
81+ /// have been added, we need a way to convert that into [`LazyThemeSet`] so
82+ /// that themes can be lazy-loaded later. This function does that
83+ /// conversion.
84+ fn try_from(theme_set: ThemeSet) -> Result<Self> {
85+ let mut lazy_theme_set = LazyThemeSet::default();
86+
87+ for (name, theme) in theme_set.themes {
88+ // All we have to do is to serialize the theme
89+ let lazy_theme = LazyTheme {
90+ serialized: crate::assets::build_assets::asset_to_contents(
91+ &theme,
92+ &format!("theme {}", name),
93+ COMPRESS_LAZY_THEMES,
94+ )?,
95+ deserialized: OnceCell::new(),
96+ };
97+
98+ // Ok done, now we can add it
99+ lazy_theme_set.themes.insert(name, lazy_theme);
100+ }
101+
102+ Ok(lazy_theme_set)
103+ }
104+}
src/bin/bat/app.rs+2−2
@@ -307,7 +307,7 @@ impl App {
307307 .map(|style_str| {
308308 style_str
309309 .split(',')
310− .map(|x| StyleComponent::from_str(x))
310+ .map(StyleComponent::from_str)
311311 .collect::<Result<Vec<StyleComponent>>>()
312312 })
313313 .transpose()?;
@@ -322,7 +322,7 @@ impl App {
322322 .collect::<Vec<_>>()
323323 })
324324 .or(env_style_components)
325− .unwrap_or_else(|| vec![StyleComponent::Full])
325+ .unwrap_or_else(|| vec![StyleComponent::Default])
326326 .into_iter()
327327 .map(|style| style.components(self.interactive_output))
328328 .fold(HashSet::new(), |mut acc, components| {
src/bin/bat/clap_app.rs+53−30
@@ -1,21 +1,20 @@
11use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
2+use once_cell::sync::Lazy;
23use std::env;
34use std::path::Path;
45
5−lazy_static::lazy_static! {
6− static ref VERSION: String = {
7− #[cfg(feature = "bugreport")]
8− let git_version = bugreport::git_version!(fallback = "");
9− #[cfg(not(feature = "bugreport"))]
10− let git_version = "";
6+static VERSION: Lazy<String> = Lazy::new(|| {
7+ #[cfg(feature = "bugreport")]
8+ let git_version = bugreport::git_version!(fallback = "");
9+ #[cfg(not(feature = "bugreport"))]
10+ let git_version = "";
1111
12− if git_version.is_empty() {
13− crate_version!().to_string()
14− } else {
15− format!("{} ({})", crate_version!(), git_version)
16− }
17− };
18−}
12+ if git_version.is_empty() {
13+ crate_version!().to_string()
14+ } else {
15+ format!("{} ({})", crate_version!(), git_version)
16+ }
17+});
1918
2019pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
2120 let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
@@ -350,6 +349,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
350349 )
351350 .takes_value(true),
352351 )
352+ .arg(
353+ Arg::with_name("ignored-suffix")
354+ .number_of_values(1)
355+ .multiple(true)
356+ .takes_value(true)
357+ .long("ignored-suffix")
358+ .hidden_short_help(true)
359+ .help(
360+ "Ignore extension. For example:\n \
361+ 'bat --ignored-suffix \".dev\" my_file.json.dev' will use JSON syntax, and ignore '.dev'"
362+ )
363+ )
353364 .arg(
354365 Arg::with_name("theme")
355366 .long("theme")
@@ -385,11 +396,20 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
385396 .validator(|val| {
386397 let mut invalid_vals = val.split(',').filter(|style| {
387398 !&[
388− "auto", "full", "plain", "header", "grid", "rule", "numbers", "snip",
399+ "auto",
400+ "full",
401+ "default",
402+ "plain",
403+ "header",
404+ "header-filename",
405+ "header-filesize",
406+ "grid",
407+ "rule",
408+ "numbers",
409+ "snip",
389410 #[cfg(feature = "git")]
390− "changes",
391− ]
392− .contains(style)
411+ "changes",
412+ ].contains(style)
393413 });
394414
395415 if let Some(invalid) = invalid_vals.next() {
@@ -400,7 +420,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
400420 })
401421 .help(
402422 "Comma-separated list of style elements to display \
403− (*auto*, full, plain, changes, header, grid, rule, numbers, snip).",
423+ (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).",
404424 )
405425 .long_help(
406426 "Configure which elements (line numbers, file headers, grid \
@@ -411,11 +431,14 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
411431 '--style=\"..\"' option to the configuration file or export the \
412432 BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
413433 Possible values:\n\n \
414− * full: enables all available components (default).\n \
415− * auto: same as 'full', unless the output is piped.\n \
434+ * default: enables recommended style components (default).\n \
435+ * full: enables all available components.\n \
436+ * auto: same as 'default', unless the output is piped.\n \
416437 * plain: disables all available components.\n \
417438 * changes: show Git modification markers.\n \
418− * header: show filenames before the content.\n \
439+ * header: alias for 'header-filename'.\n \
440+ * header-filename: show filenames before the content.\n \
441+ * header-filesize: show file sizes before the content.\n \
419442 * grid: vertical/horizontal lines to separate side bar\n \
420443 and the header from the content.\n \
421444 * rule: horizontal lines to delimit files.\n \
@@ -510,16 +533,10 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
510533 .help("Show diagnostic information for bug reports.")
511534 )
512535 .arg(
513− Arg::with_name("ignored-suffix")
514− .number_of_values(1)
515− .multiple(true)
516− .takes_value(true)
517− .long("ignored-suffix")
536+ Arg::with_name("acknowledgements")
537+ .long("acknowledgements")
518538 .hidden_short_help(true)
519− .help(
520− "Ignore extension. For example:\n \
521− 'bat --ignored-suffix \".dev\" my_file.json.dev' will use JSON syntax, and ignore '.dev'"
522− )
539+ .help("Show acknowledgements."),
523540 )
524541 .help_message("Print this help message.")
525542 .version_message("Show version information.");
@@ -579,6 +596,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
579596 "Create completely new syntax and theme sets \
580597 (instead of appending to the default sets).",
581598 ),
599+ )
600+ .arg(
601+ Arg::with_name("acknowledgements")
602+ .long("acknowledgements")
603+ .requires("build")
604+ .help("Build acknowledgements.bin."),
582605 ),
583606 )
584607 }
src/bin/bat/config.rs+2−2
@@ -91,7 +91,7 @@ pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseEr
9191 .ok()
9292 .map(|content| get_args_from_str(&content))
9393 .transpose()?
94− .unwrap_or_else(Vec::new))
94+ .unwrap_or_default())
9595}
9696
9797pub fn get_args_from_env_var() -> Option<Result<Vec<OsString>, shell_words::ParseError>> {
@@ -104,7 +104,7 @@ fn get_args_from_str(content: &str) -> Result<Vec<OsString>, shell_words::ParseE
104104 .map(|line| line.trim())
105105 .filter(|line| !line.is_empty())
106106 .filter(|line| !line.starts_with('#'))
107− .map(|line| shell_words::split(line))
107+ .map(shell_words::split)
108108 .collect::<Result<Vec<_>, _>>()?;
109109
110110 Ok(args_per_line
src/bin/bat/directories.rs+3−5
@@ -1,7 +1,7 @@
11use std::env;
22use std::path::{Path, PathBuf};
33
4−use lazy_static::lazy_static;
4+use once_cell::sync::Lazy;
55
66/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
77/// The `XDG_CACHE_HOME` environment variable is checked first. `BAT_CONFIG_DIR`
@@ -68,7 +68,5 @@ impl BatProjectDirs {
6868 }
6969}
7070
71−lazy_static! {
72− pub static ref PROJECT_DIRS: BatProjectDirs =
73− BatProjectDirs::new().expect("Could not get home directory");
74−}
71+pub static PROJECT_DIRS: Lazy<BatProjectDirs> =
72+ Lazy::new(|| BatProjectDirs::new().expect("Could not get home directory"));
src/bin/bat/main.rs+24−10
@@ -47,9 +47,13 @@ fn build_assets(matches: &clap::ArgMatches) -> Result<()> {
4747 .map(Path::new)
4848 .unwrap_or_else(|| PROJECT_DIRS.cache_dir());
4949
50− let blank = matches.is_present("blank");
51−
52− bat::assets::build(source_dir, !blank, target_dir, clap::crate_version!())
50+ bat::assets::build(
51+ source_dir,
52+ !matches.is_present("blank"),
53+ matches.is_present("acknowledgements"),
54+ target_dir,
55+ clap::crate_version!(),
56+ )
5357}
5458
5559fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
@@ -70,13 +74,9 @@ fn get_syntax_mapping_to_paths<'a>(
7074) -> HashMap<&'a str, Vec<String>> {
7175 let mut map = HashMap::new();
7276 for mapping in mappings {
73− match mapping {
74− (_, MappingTarget::MapToUnknown) => {}
75− (_, MappingTarget::MapExtensionToUnknown) => {}
76− (matcher, MappingTarget::MapTo(s)) => {
77− let globs = map.entry(*s).or_insert_with(Vec::new);
78− globs.push(matcher.glob().glob().into());
79− }
77+ if let (matcher, MappingTarget::MapTo(s)) = mapping {
78+ let globs = map.entry(*s).or_insert_with(Vec::new);
79+ globs.push(matcher.glob().glob().into());
8080 }
8181 }
8282 map
@@ -230,6 +230,9 @@ fn invoke_bugreport(app: &App) {
230230 let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
231231 .unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less".
232232
233+ let mut custom_assets_metadata = PROJECT_DIRS.cache_dir().to_path_buf();
234+ custom_assets_metadata.push("metadata.yaml");
235+
233236 let mut report = bugreport!()
234237 .info(SoftwareVersion::default())
235238 .info(OperatingSystem::default())
@@ -254,6 +257,14 @@ fn invoke_bugreport(app: &App) {
254257 "MANPAGER",
255258 ]))
256259 .info(FileContent::new("Config file", config_file()))
260+ .info(FileContent::new(
261+ "Custom assets metadata",
262+ custom_assets_metadata,
263+ ))
264+ .info(DirectoryEntries::new(
265+ "Custom assets",
266+ PROJECT_DIRS.cache_dir(),
267+ ))
257268 .info(CompileTimeInformation::default());
258269
259270 #[cfg(feature = "paging")]
@@ -324,6 +335,9 @@ fn run() -> Result<bool> {
324335 } else if app.matches.is_present("cache-dir") {
325336 writeln!(io::stdout(), "{}", cache_dir())?;
326337 Ok(true)
338+ } else if app.matches.is_present("acknowledgements") {
339+ writeln!(io::stdout(), "{}", bat::assets::get_acknowledgements())?;
340+ Ok(true)
327341 } else {
328342 run_controller(inputs, &config)
329343 }
src/error.rs+4−1
@@ -2,11 +2,14 @@ use std::io::Write;
22use thiserror::Error;
33
44#[derive(Error, Debug)]
5+#[non_exhaustive]
56pub enum Error {
67 #[error(transparent)]
78 Io(#[from] ::std::io::Error),
89 #[error(transparent)]
9− SyntectError(#[from] ::syntect::LoadingError),
10+ SyntectError(#[from] ::syntect::Error),
11+ #[error(transparent)]
12+ SyntectLoadingError(#[from] ::syntect::LoadingError),
1013 #[error(transparent)]
1114 ParseIntError(#[from] ::std::num::ParseIntError),
1215 #[error(transparent)]
src/input.rs+9−2
@@ -1,4 +1,5 @@
11use std::convert::TryFrom;
2+use std::fs;
23use std::fs::File;
34use std::io::{self, BufRead, BufReader, Read};
45use std::path::{Path, PathBuf};
@@ -87,6 +88,7 @@ impl<'a> InputKind<'a> {
8788#[derive(Clone, Default)]
8889pub(crate) struct InputMetadata {
8990 pub(crate) user_provided_name: Option<PathBuf>,
91+ pub(crate) size: Option<u64>,
9092}
9193
9294pub struct Input<'a> {
@@ -116,7 +118,7 @@ impl OpenedInput<'_> {
116118 self.metadata
117119 .user_provided_name
118120 .as_ref()
119− .or_else(|| match self.kind {
121+ .or(match self.kind {
120122 OpenedInputKind::OrdinaryFile(ref path) => Some(path),
121123 _ => None,
122124 })
@@ -130,9 +132,14 @@ impl<'a> Input<'a> {
130132
131133 fn _ordinary_file(path: &Path) -> Self {
132134 let kind = InputKind::OrdinaryFile(path.to_path_buf());
135+ let metadata = InputMetadata {
136+ size: fs::metadata(path).map(|m| m.len()).ok(),
137+ ..InputMetadata::default()
138+ };
139+
133140 Input {
134141 description: kind.description(),
135− metadata: InputMetadata::default(),
142+ metadata,
136143 kind,
137144 }
138145 }
src/less.rs+59−8
@@ -3,21 +3,38 @@
33use std::ffi::OsStr;
44use std::process::Command;
55
6−pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
6+#[derive(Debug, PartialEq)]
7+pub enum LessVersion {
8+ Less(usize),
9+ BusyBox,
10+}
11+
12+pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<LessVersion> {
713 let resolved_path = grep_cli::resolve_binary(less_path.as_ref()).ok()?;
814
915 let cmd = Command::new(resolved_path).arg("--version").output().ok()?;
10− parse_less_version(&cmd.stdout)
16+ if cmd.status.success() {
17+ parse_less_version(&cmd.stdout)
18+ } else {
19+ parse_less_version_busybox(&cmd.stderr)
20+ }
1121}
1222
13−fn parse_less_version(output: &[u8]) -> Option<usize> {
23+fn parse_less_version(output: &[u8]) -> Option<LessVersion> {
1424 if !output.starts_with(b"less ") {
1525 return None;
1626 }
1727
1828 let version = std::str::from_utf8(&output[5..]).ok()?;
1929 let end = version.find(|c: char| !c.is_ascii_digit())?;
20− version[..end].parse::<usize>().ok()
30+ Some(LessVersion::Less(version[..end].parse::<usize>().ok()?))
31+}
32+
33+fn parse_less_version_busybox(output: &[u8]) -> Option<LessVersion> {
34+ match std::str::from_utf8(output) {
35+ Ok(version) if version.contains("BusyBox ") => Some(LessVersion::BusyBox),
36+ _ => None,
37+ }
2138}
2239
2340#[test]
@@ -30,7 +47,7 @@ For information about the terms of redistribution,
3047see the file named README in the less distribution.
3148Homepage: http://www.greenwoodsoftware.com/less";
3249
33− assert_eq!(Some(487), parse_less_version(output));
50+ assert_eq!(Some(LessVersion::Less(487)), parse_less_version(output));
3451}
3552
3653#[test]
@@ -43,7 +60,7 @@ For information about the terms of redistribution,
4360see the file named README in the less distribution.
4461Homepage: http://www.greenwoodsoftware.com/less";
4562
46− assert_eq!(Some(529), parse_less_version(output));
63+ assert_eq!(Some(LessVersion::Less(529)), parse_less_version(output));
4764}
4865
4966#[test]
@@ -56,7 +73,7 @@ For information about the terms of redistribution,
5673see the file named README in the less distribution.
5774Home page: http://www.greenwoodsoftware.com/less";
5875
59− assert_eq!(Some(551), parse_less_version(output));
76+ assert_eq!(Some(LessVersion::Less(551)), parse_less_version(output));
6077}
6178
6279#[test]
@@ -69,7 +86,7 @@ For information about the terms of redistribution,
6986see the file named README in the less distribution.
7087Home page: https://greenwoodsoftware.com/less";
7188
72− assert_eq!(Some(581), parse_less_version(output));
89+ assert_eq!(Some(LessVersion::Less(581)), parse_less_version(output));
7390}
7491
7592#[test]
@@ -77,4 +94,38 @@ fn test_parse_less_version_wrong_program() {
7794 let output = b"more from util-linux 2.34";
7895
7996 assert_eq!(None, parse_less_version(output));
97+ assert_eq!(None, parse_less_version_busybox(output));
98+}
99+
100+#[test]
101+fn test_parse_less_version_busybox() {
102+ let output = b"pkg/less: unrecognized option '--version'
103+BusyBox v1.35.0 (2022-04-21 10:38:11 EDT) multi-call binary.
104+
105+Usage: less [-EFIMmNSRh~] [FILE]...
106+
107+View FILE (or stdin) one screenful at a time
108+
109+ -E Quit once the end of a file is reached
110+ -F Quit if entire file fits on first screen
111+ -I Ignore case in all searches
112+ -M,-m Display status line with line numbers
113+ and percentage through the file
114+ -N Prefix line number to each line
115+ -S Truncate long lines
116+ -R Remove color escape codes in input
117+ -~ Suppress ~s displayed past EOF";
118+
119+ assert_eq!(
120+ Some(LessVersion::BusyBox),
121+ parse_less_version_busybox(output)
122+ );
123+}
124+
125+#[test]
126+fn test_parse_less_version_invalid_utf_8() {
127+ let output = b"\xff";
128+
129+ assert_eq!(None, parse_less_version(output));
130+ assert_eq!(None, parse_less_version_busybox(output));
80131}
src/lib.rs+1
@@ -46,6 +46,7 @@ pub(crate) mod printer;
4646pub mod style;
4747pub(crate) mod syntax_mapping;
4848mod terminal;
49+mod vscreen;
4950pub(crate) mod wrapping;
5051
5152pub use pretty_printer::{Input, PrettyPrinter};
src/line_range.rs+43−1
@@ -47,12 +47,24 @@ impl LineRange {
4747 }
4848 2 => {
4949 new_range.lower = line_numbers[0].parse()?;
50+ let first_byte = line_numbers[1].bytes().next();
5051
51− new_range.upper = if line_numbers[1].bytes().next() == Some(b'+') {
52+ new_range.upper = if first_byte == Some(b'+') {
5253 let more_lines = &line_numbers[1][1..]
5354 .parse()
5455 .map_err(|_| "Invalid character after +")?;
5556 new_range.lower + more_lines
57+ } else if first_byte == Some(b'-') {
58+ // this will prevent values like "-+5" even though "+5" is valid integer
59+ if line_numbers[1][1..].bytes().next() == Some(b'+') {
60+ return Err("Invalid character after -".into());
61+ }
62+ let prior_lines = &line_numbers[1][1..]
63+ .parse()
64+ .map_err(|_| "Invalid character after -")?;
65+ let prev_lower = new_range.lower;
66+ new_range.lower = new_range.lower.saturating_sub(*prior_lines);
67+ prev_lower
5668 } else {
5769 line_numbers[1].parse()?
5870 };
@@ -126,6 +138,36 @@ fn test_parse_plus_fail() {
126138 assert!(range.is_err());
127139}
128140
141+#[test]
142+fn test_parse_minus_success() {
143+ let range = LineRange::from("40:-10").expect("Shouldn't fail on test!");
144+ assert_eq!(30, range.lower);
145+ assert_eq!(40, range.upper);
146+}
147+
148+#[test]
149+fn test_parse_minus_edge_cases_success() {
150+ let range = LineRange::from("5:-4").expect("Shouldn't fail on test!");
151+ assert_eq!(1, range.lower);
152+ assert_eq!(5, range.upper);
153+ let range = LineRange::from("5:-5").expect("Shouldn't fail on test!");
154+ assert_eq!(0, range.lower);
155+ assert_eq!(5, range.upper);
156+ let range = LineRange::from("5:-100").expect("Shouldn't fail on test!");
157+ assert_eq!(0, range.lower);
158+ assert_eq!(5, range.upper);
159+}
160+
161+#[test]
162+fn test_parse_minus_fail() {
163+ let range = LineRange::from("40:-z");
164+ assert!(range.is_err());
165+ let range = LineRange::from("40:-+10");
166+ assert!(range.is_err());
167+ let range = LineRange::from("40:-");
168+ assert!(range.is_err());
169+}
170+
129171#[derive(Copy, Clone, Debug, PartialEq)]
130172pub enum RangeCheckResult {
131173 // Within one of the given ranges
src/output.rs+7−5
@@ -4,7 +4,7 @@ use std::process::Child;
44
55use crate::error::*;
66#[cfg(feature = "paging")]
7−use crate::less::retrieve_less_version;
7+use crate::less::{retrieve_less_version, LessVersion};
88#[cfg(feature = "paging")]
99use crate::paging::PagingMode;
1010#[cfg(feature = "paging")]
@@ -83,13 +83,13 @@ impl OutputType {
8383 let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager;
8484
8585 if args.is_empty() || replace_arguments_to_less {
86− p.arg("--RAW-CONTROL-CHARS");
86+ p.arg("-R"); // Short version of --RAW-CONTROL-CHARS for maximum compatibility
8787 if single_screen_action == SingleScreenAction::Quit {
88− p.arg("--quit-if-one-screen");
88+ p.arg("-F"); // Short version of --quit-if-one-screen for compatibility
8989 }
9090
9191 if wrapping_mode == WrappingMode::NoWrapping(true) {
92− p.arg("--chop-long-lines");
92+ p.arg("-S"); // Short version of --chop-long-lines for compatibility
9393 }
9494
9595 // Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
@@ -103,7 +103,9 @@ impl OutputType {
103103 None => {
104104 p.arg("--no-init");
105105 }
106− Some(version) if (version < 530 || (cfg!(windows) && version < 558)) => {
106+ Some(LessVersion::Less(version))
107+ if (version < 530 || (cfg!(windows) && version < 558)) =>
108+ {
107109 p.arg("--no-init");
108110 }
109111 _ => {}
src/preprocessor.rs+10−3
@@ -53,26 +53,33 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
5353 let tab_width = if tab_width == 0 { 4 } else { tab_width };
5454
5555 let mut idx = 0;
56+ let mut line_idx = 0;
5657 let len = input.len();
5758 while idx < len {
5859 if let Some((chr, skip_ahead)) = try_parse_utf8_char(&input[idx..]) {
5960 idx += skip_ahead;
61+ line_idx += 1;
6062
6163 match chr {
6264 // space
6365 ' ' => output.push('·'),
6466 // tab
6567 '\t' => {
66− if tab_width == 1 {
68+ let tab_stop = tab_width - ((line_idx - 1) % tab_width);
69+ line_idx = 0;
70+ if tab_stop == 1 {
6771 output.push('↹');
6872 } else {
6973 output.push('├');
70− output.push_str(&"─".repeat(tab_width - 2));
74+ output.push_str(&"─".repeat(tab_stop - 2));
7175 output.push('┤');
7276 }
7377 }
7478 // line feed
75− '\x0A' => output.push_str("␊\x0A"),
79+ '\x0A' => {
80+ output.push_str("␊\x0A");
81+ line_idx = 0;
82+ }
7683 // carriage return
7784 '\x0D' => output.push('␍'),
7885 // null
src/pretty_printer.rs+6
@@ -164,6 +164,12 @@ impl<'a> PrettyPrinter<'a> {
164164 self
165165 }
166166
167+ /// Whether to print binary content or nonprintable characters (default: no)
168+ pub fn show_nonprintable(&mut self, yes: bool) -> &mut Self {
169+ self.config.show_nonprintable = yes;
170+ self
171+ }
172+
167173 /// Whether to show "snip" markers between visible line ranges (default: no)
168174 pub fn snip(&mut self, yes: bool) -> &mut Self {
169175 self.active_style_components.snip = yes;
src/printer.rs+147−95
@@ -4,6 +4,8 @@ use std::vec::Vec;
44use ansi_term::Colour::{Fixed, Green, Red, Yellow};
55use ansi_term::Style;
66
7+use bytesize::ByteSize;
8+
79use console::AnsiCodeIterator;
810
911use syntect::easy::HighlightLines;
@@ -29,7 +31,9 @@ use crate::error::*;
2931use crate::input::OpenedInput;
3032use crate::line_range::RangeCheckResult;
3133use crate::preprocessor::{expand_tabs, replace_nonprintable};
34+use crate::style::StyleComponent;
3235use crate::terminal::{as_terminal_escaped, to_ansi_color};
36+use crate::vscreen::AnsiStyle;
3337use crate::wrapping::WrappingMode;
3438
3539pub(crate) trait Printer {
@@ -118,7 +122,7 @@ pub(crate) struct InteractivePrinter<'a> {
118122 config: &'a Config<'a>,
119123 decorations: Vec<Box<dyn Decoration>>,
120124 panel_width: usize,
121− ansi_prefix_sgr: String,
125+ ansi_style: AnsiStyle,
122126 content_type: Option<ContentType>,
123127 #[cfg(feature = "git")]
124128 pub line_changes: &'a Option<LineChanges>,
@@ -202,7 +206,7 @@ impl<'a> InteractivePrinter<'a> {
202206 config,
203207 decorations,
204208 content_type: input.reader.content_type,
205− ansi_prefix_sgr: String::new(),
209+ ansi_style: AnsiStyle::new(),
206210 #[cfg(feature = "git")]
207211 line_changes,
208212 highlighter_from_set,
@@ -249,6 +253,21 @@ impl<'a> InteractivePrinter<'a> {
249253 }
250254 }
251255
256+ fn print_header_component_indent(&mut self, handle: &mut dyn Write) -> std::io::Result<()> {
257+ if self.config.style_components.grid() {
258+ write!(
259+ handle,
260+ "{}{}",
261+ " ".repeat(self.panel_width),
262+ self.colors
263+ .grid
264+ .paint(if self.panel_width > 0 { "│ " } else { "" }),
265+ )
266+ } else {
267+ write!(handle, "{}", " ".repeat(self.panel_width))
268+ }
269+ }
270+
252271 fn preprocess(&self, text: &str, cursor: &mut usize) -> String {
253272 if self.config.tab_width > 0 {
254273 return expand_tabs(text, self.config.tab_width, cursor);
@@ -286,25 +305,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
286305 return Ok(());
287306 }
288307
289− if self.config.style_components.grid() {
290− self.print_horizontal_line(handle, '┬')?;
291−
292− write!(
293− handle,
294− "{}{}",
295− " ".repeat(self.panel_width),
296− self.colors
297− .grid
298− .paint(if self.panel_width > 0 { "│ " } else { "" }),
299− )?;
300− } else {
301− // Only pad space between files, if we haven't already drawn a horizontal rule
302− if add_header_padding && !self.config.style_components.rule() {
303− writeln!(handle)?;
304− }
305− write!(handle, "{}", " ".repeat(self.panel_width))?;
306− }
307−
308308 let mode = match self.content_type {
309309 Some(ContentType::BINARY) => " <BINARY>",
310310 Some(ContentType::UTF_16LE) => " <UTF-16LE>",
@@ -314,17 +314,60 @@ impl<'a> Printer for InteractivePrinter<'a> {
314314 };
315315
316316 let description = &input.description;
317+ let metadata = &input.metadata;
318+
319+ // We use this iterator to have a deterministic order for
320+ // header components. HashSet has arbitrary order, but Vec is ordered.
321+ let header_components: Vec<StyleComponent> = [
322+ (
323+ StyleComponent::HeaderFilename,
324+ self.config.style_components.header_filename(),
325+ ),
326+ (
327+ StyleComponent::HeaderFilesize,
328+ self.config.style_components.header_filesize(),
329+ ),
330+ ]
331+ .iter()
332+ .filter(|(_, is_enabled)| *is_enabled)
333+ .map(|(component, _)| *component)
334+ .collect();
335+
336+ // Print the cornering grid before the first header component
337+ if self.config.style_components.grid() {
338+ self.print_horizontal_line(handle, '┬')?;
339+ } else {
340+ // Only pad space between files, if we haven't already drawn a horizontal rule
341+ if add_header_padding && !self.config.style_components.rule() {
342+ writeln!(handle)?;
343+ }
344+ }
317345
318− writeln!(
319− handle,
320− "{}{}{}",
321− description
322− .kind()
323− .map(|kind| format!("{}: ", kind))
324− .unwrap_or_else(|| "".into()),
325− self.colors.filename.paint(description.title()),
326− mode
327− )?;
346+ header_components.iter().try_for_each(|component| {
347+ self.print_header_component_indent(handle)?;
348+
349+ match component {
350+ StyleComponent::HeaderFilename => writeln!(
351+ handle,
352+ "{}{}{}",
353+ description
354+ .kind()
355+ .map(|kind| format!("{}: ", kind))
356+ .unwrap_or_else(|| "".into()),
357+ self.colors.header_value.paint(description.title()),
358+ mode
359+ ),
360+
361+ StyleComponent::HeaderFilesize => {
362+ let bsize = metadata
363+ .size
364+ .map(|s| format!("{}", ByteSize(s)))
365+ .unwrap_or_else(|| "-".into());
366+ writeln!(handle, "Size: {}", self.colors.header_value.paint(bsize))
367+ }
368+ _ => Ok(()),
369+ }
370+ })?;
328371
329372 if self.config.style_components.grid() {
330373 if self.content_type.map_or(false, |c| c.is_text()) || self.config.show_nonprintable {
@@ -402,9 +445,21 @@ impl<'a> Printer for InteractivePrinter<'a> {
402445 return Ok(());
403446 }
404447 };
405− highlighter_from_set
448+
449+ // skip syntax highlighting on long lines
450+ let too_long = line.len() > 1024 * 16;
451+
452+ let for_highlighting: &str = if too_long { "\n" } else { &line };
453+
454+ let mut highlighted_line = highlighter_from_set
406455 .highlighter
407− .highlight(&line, highlighter_from_set.syntax_set)
456+ .highlight_line(for_highlighting, highlighter_from_set.syntax_set)?;
457+
458+ if too_long {
459+ highlighted_line[0].1 = &line;
460+ }
461+
462+ highlighted_line
408463 };
409464
410465 if out_of_range {
@@ -420,6 +475,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
420475 let highlight_this_line =
421476 self.config.highlighted_lines.0.check(line_number) == RangeCheckResult::InRange;
422477
478+ if highlight_this_line && self.config.theme == "ansi" {
479+ self.ansi_style.update("^[4m");
480+ }
481+
423482 let background_color = self
424483 .background_color_highlight
425484 .filter(|_| highlight_this_line);
@@ -444,35 +503,51 @@ impl<'a> Printer for InteractivePrinter<'a> {
444503 let italics = self.config.use_italic_text;
445504
446505 for &(style, region) in &regions {
447− let text = &*self.preprocess(region, &mut cursor_total);
448− let text_trimmed = text.trim_end_matches(|c| c == '\r' || c == '\n');
449− write!(
450− handle,
451− "{}",
452− as_terminal_escaped(
453− style,
454− text_trimmed,
455− true_color,
456− colored_output,
457− italics,
458− background_color
459− )
460− )?;
506+ let ansi_iterator = AnsiCodeIterator::new(region);
507+ for chunk in ansi_iterator {
508+ match chunk {
509+ // ANSI escape passthrough.
510+ (ansi, true) => {
511+ self.ansi_style.update(ansi);
512+ write!(handle, "{}", ansi)?;
513+ }
461514
462− if text.len() != text_trimmed.len() {
463− if let Some(background_color) = background_color {
464− let ansi_style = Style {
465− background: to_ansi_color(background_color, true_color),
466− ..Default::default()
467− };
468− let width = if cursor_total <= cursor_max {
469− cursor_max - cursor_total + 1
470− } else {
471− 0
472− };
473− write!(handle, "{}", ansi_style.paint(" ".repeat(width)))?;
515+ // Regular text.
516+ (text, false) => {
517+ let text = &*self.preprocess(text, &mut cursor_total);
518+ let text_trimmed = text.trim_end_matches(|c| c == '\r' || c == '\n');
519+
520+ write!(
521+ handle,
522+ "{}",
523+ as_terminal_escaped(
524+ style,
525+ &format!("{}{}", self.ansi_style, text_trimmed),
526+ true_color,
527+ colored_output,
528+ italics,
529+ background_color
530+ )
531+ )?;
532+
533+ if text.len() != text_trimmed.len() {
534+ if let Some(background_color) = background_color {
535+ let ansi_style = Style {
536+ background: to_ansi_color(background_color, true_color),
537+ ..Default::default()
538+ };
539+
540+ let width = if cursor_total <= cursor_max {
541+ cursor_max - cursor_total + 1
542+ } else {
543+ 0
544+ };
545+ write!(handle, "{}", ansi_style.paint(" ".repeat(width)))?;
546+ }
547+ write!(handle, "{}", &text[text_trimmed.len()..])?;
548+ }
549+ }
474550 }
475− write!(handle, "{}", &text[text_trimmed.len()..])?;
476551 }
477552 }
478553
@@ -482,31 +557,12 @@ impl<'a> Printer for InteractivePrinter<'a> {
482557 } else {
483558 for &(style, region) in &regions {
484559 let ansi_iterator = AnsiCodeIterator::new(region);
485− let mut ansi_prefix: String = String::new();
486560 for chunk in ansi_iterator {
487561 match chunk {
488562 // ANSI escape passthrough.
489− (text, true) => {
490− let is_ansi_csi = text.starts_with("\x1B[");
491−
492− if is_ansi_csi && text.ends_with('m') {
493− // It's an ANSI SGR sequence.
494− // We should be mostly safe to just append these together.
495− ansi_prefix.push_str(text);
496− if text == "\x1B[0m" {
497− self.ansi_prefix_sgr = "\x1B[0m".to_owned();
498− } else {
499− self.ansi_prefix_sgr.push_str(text);
500− }
501− } else if is_ansi_csi {
502− // It's a regular CSI sequence.
503− // We should be mostly safe to just append these together.
504− ansi_prefix.push_str(text);
505− } else {
506− // It's probably a VT100 code.
507− // Passing it through is the safest bet.
508− write!(handle, "{}", text)?;
509− }
563+ (ansi, true) => {
564+ self.ansi_style.update(ansi);
565+ write!(handle, "{}", ansi)?;
510566 }
511567
512568 // Regular text.
@@ -556,10 +612,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
556612 "{}\n{}",
557613 as_terminal_escaped(
558614 style,
559− &*format!(
560− "{}{}{}",
561− self.ansi_prefix_sgr, ansi_prefix, line_buf
562− ),
615+ &*format!("{}{}", self.ansi_style, line_buf),
563616 self.config.true_color,
564617 self.config.colored_output,
565618 self.config.use_italic_text,
@@ -585,19 +638,13 @@ impl<'a> Printer for InteractivePrinter<'a> {
585638 "{}",
586639 as_terminal_escaped(
587640 style,
588− &*format!(
589− "{}{}{}",
590− self.ansi_prefix_sgr, ansi_prefix, line_buf
591− ),
641+ &*format!("{}{}", self.ansi_style, line_buf),
592642 self.config.true_color,
593643 self.config.colored_output,
594644 self.config.use_italic_text,
595645 background_color
596646 )
597647 )?;
598−
599− // Clear the ANSI prefix buffer.
600− ansi_prefix.clear();
601648 }
602649 }
603650 }
@@ -618,6 +665,11 @@ impl<'a> Printer for InteractivePrinter<'a> {
618665 writeln!(handle)?;
619666 }
620667
668+ if highlight_this_line && self.config.theme == "ansi" {
669+ self.ansi_style.update("^[24m");
670+ write!(handle, "\x1B[24m")?;
671+ }
672+
621673 Ok(())
622674 }
623675}
@@ -628,7 +680,7 @@ const DEFAULT_GUTTER_COLOR: u8 = 238;
628680pub struct Colors {
629681 pub grid: Style,
630682 pub rule: Style,
631− pub filename: Style,
683+ pub header_value: Style,
632684 pub git_added: Style,
633685 pub git_removed: Style,
634686 pub git_modified: Style,
@@ -657,7 +709,7 @@ impl Colors {
657709 Colors {
658710 grid: gutter_style,
659711 rule: gutter_style,
660− filename: Style::new().bold(),
712+ header_value: Style::new().bold(),
661713 git_added: Green.normal(),
662714 git_removed: Red.normal(),
663715 git_modified: Yellow.normal(),
src/style.rs+30−4
@@ -3,6 +3,7 @@ use std::str::FromStr;
33
44use crate::error::*;
55
6+#[non_exhaustive]
67#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
78pub enum StyleComponent {
89 Auto,
@@ -11,9 +12,12 @@ pub enum StyleComponent {
1112 Grid,
1213 Rule,
1314 Header,
15+ HeaderFilename,
16+ HeaderFilesize,
1417 LineNumbers,
1518 Snip,
1619 Full,
20+ Default,
1721 Plain,
1822}
1923
@@ -22,7 +26,7 @@ impl StyleComponent {
2226 match self {
2327 StyleComponent::Auto => {
2428 if interactive_terminal {
25− StyleComponent::Full.components(interactive_terminal)
29+ StyleComponent::Default.components(interactive_terminal)
2630 } else {
2731 StyleComponent::Plain.components(interactive_terminal)
2832 }
@@ -31,14 +35,25 @@ impl StyleComponent {
3135 StyleComponent::Changes => &[StyleComponent::Changes],
3236 StyleComponent::Grid => &[StyleComponent::Grid],
3337 StyleComponent::Rule => &[StyleComponent::Rule],
34− StyleComponent::Header => &[StyleComponent::Header],
38+ StyleComponent::Header => &[StyleComponent::HeaderFilename],
39+ StyleComponent::HeaderFilename => &[StyleComponent::HeaderFilename],
40+ StyleComponent::HeaderFilesize => &[StyleComponent::HeaderFilesize],
3541 StyleComponent::LineNumbers => &[StyleComponent::LineNumbers],
3642 StyleComponent::Snip => &[StyleComponent::Snip],
3743 StyleComponent::Full => &[
3844 #[cfg(feature = "git")]
3945 StyleComponent::Changes,
4046 StyleComponent::Grid,
41− StyleComponent::Header,
47+ StyleComponent::HeaderFilename,
48+ StyleComponent::HeaderFilesize,
49+ StyleComponent::LineNumbers,
50+ StyleComponent::Snip,
51+ ],
52+ StyleComponent::Default => &[
53+ #[cfg(feature = "git")]
54+ StyleComponent::Changes,
55+ StyleComponent::Grid,
56+ StyleComponent::HeaderFilename,
4257 StyleComponent::LineNumbers,
4358 StyleComponent::Snip,
4459 ],
@@ -58,9 +73,12 @@ impl FromStr for StyleComponent {
5873 "grid" => Ok(StyleComponent::Grid),
5974 "rule" => Ok(StyleComponent::Rule),
6075 "header" => Ok(StyleComponent::Header),
76+ "header-filename" => Ok(StyleComponent::HeaderFilename),
77+ "header-filesize" => Ok(StyleComponent::HeaderFilesize),
6178 "numbers" => Ok(StyleComponent::LineNumbers),
6279 "snip" => Ok(StyleComponent::Snip),
6380 "full" => Ok(StyleComponent::Full),
81+ "default" => Ok(StyleComponent::Default),
6482 "plain" => Ok(StyleComponent::Plain),
6583 _ => Err(format!("Unknown style '{}'", s).into()),
6684 }
@@ -89,7 +107,15 @@ impl StyleComponents {
89107 }
90108
91109 pub fn header(&self) -> bool {
92− self.0.contains(&StyleComponent::Header)
110+ self.header_filename() || self.header_filesize()
111+ }
112+
113+ pub fn header_filename(&self) -> bool {
114+ self.0.contains(&StyleComponent::HeaderFilename)
115+ }
116+
117+ pub fn header_filesize(&self) -> bool {
118+ self.0.contains(&StyleComponent::HeaderFilesize)
93119 }
94120
95121 pub fn numbers(&self) -> bool {
src/syntax_mapping.rs+25−2
@@ -8,6 +8,7 @@ use globset::{Candidate, GlobBuilder, GlobMatcher};
88pub mod ignored_suffixes;
99
1010#[derive(Debug, Clone, Copy, PartialEq)]
11+#[non_exhaustive]
1112pub enum MappingTarget<'a> {
1213 /// For mapping a path to a specific syntax.
1314 MapTo(&'a str),
@@ -40,6 +41,9 @@ impl<'a> SyntaxMapping<'a> {
4041 pub fn builtin() -> SyntaxMapping<'a> {
4142 let mut mapping = Self::empty();
4243 mapping.insert("*.h", MappingTarget::MapTo("C++")).unwrap();
44+ mapping
45+ .insert(".clang-format", MappingTarget::MapTo("YAML"))
46+ .unwrap();
4347 mapping.insert("*.fs", MappingTarget::MapTo("F#")).unwrap();
4448 mapping
4549 .insert("build", MappingTarget::MapToUnknown)
@@ -116,13 +120,32 @@ impl<'a> SyntaxMapping<'a> {
116120 mapping.insert(glob, MappingTarget::MapTo("INI")).unwrap();
117121 }
118122
123+ // unix mail spool
124+ for glob in &["/var/spool/mail/*", "/var/mail/*"] {
125+ mapping.insert(glob, MappingTarget::MapTo("Email")).unwrap()
126+ }
127+
119128 // pacman hooks
120129 mapping
121130 .insert("*.hook", MappingTarget::MapTo("INI"))
122131 .unwrap();
123132
124− if let Some(xdg_config_home) = std::env::var_os("XDG_CONFIG_HOME") {
125− let git_config_path = Path::new(&xdg_config_home).join("git");
133+ // Global git config files rooted in `$XDG_CONFIG_HOME/git/` or `$HOME/.config/git/`
134+ // See e.g. https://git-scm.com/docs/git-config#FILES
135+ if let Some(xdg_config_home) =
136+ std::env::var_os("XDG_CONFIG_HOME").filter(|val| !val.is_empty())
137+ {
138+ insert_git_config_global(&mut mapping, &xdg_config_home);
139+ }
140+ if let Some(default_config_home) = std::env::var_os("HOME")
141+ .filter(|val| !val.is_empty())
142+ .map(|home| Path::new(&home).join(".config"))
143+ {
144+ insert_git_config_global(&mut mapping, &default_config_home);
145+ }
146+
147+ fn insert_git_config_global(mapping: &mut SyntaxMapping, config_home: impl AsRef<Path>) {
148+ let git_config_path = config_home.as_ref().join("git");
126149
127150 mapping
128151 .insert(
src/vscreen.rsnew file+212
@@ -0,0 +1,212 @@
1+use std::fmt::{Display, Formatter};
2+
3+// Wrapper to avoid unnecessary branching when input doesn't have ANSI escape sequences.
4+pub struct AnsiStyle {
5+ attributes: Option<Attributes>,
6+}
7+
8+impl AnsiStyle {
9+ pub fn new() -> Self {
10+ AnsiStyle { attributes: None }
11+ }
12+
13+ pub fn update(&mut self, sequence: &str) -> bool {
14+ match &mut self.attributes {
15+ Some(a) => a.update(sequence),
16+ None => {
17+ self.attributes = Some(Attributes::new());
18+ self.attributes.as_mut().unwrap().update(sequence)
19+ }
20+ }
21+ }
22+}
23+
24+impl Display for AnsiStyle {
25+ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
26+ match self.attributes {
27+ Some(ref a) => a.fmt(f),
28+ None => Ok(()),
29+ }
30+ }
31+}
32+
33+struct Attributes {
34+ foreground: String,
35+ background: String,
36+ underlined: String,
37+
38+ /// The character set to use.
39+ /// REGEX: `\^[()][AB0-3]`
40+ charset: String,
41+
42+ /// A buffer for unknown sequences.
43+ unknown_buffer: String,
44+
45+ /// ON: ^[1m
46+ /// OFF: ^[22m
47+ bold: String,
48+
49+ /// ON: ^[2m
50+ /// OFF: ^[22m
51+ dim: String,
52+
53+ /// ON: ^[4m
54+ /// OFF: ^[24m
55+ underline: String,
56+
57+ /// ON: ^[3m
58+ /// OFF: ^[23m
59+ italic: String,
60+
61+ /// ON: ^[9m
62+ /// OFF: ^[29m
63+ strike: String,
64+}
65+
66+impl Attributes {
67+ pub fn new() -> Self {
68+ Attributes {
69+ foreground: "".to_owned(),
70+ background: "".to_owned(),
71+ underlined: "".to_owned(),
72+ charset: "".to_owned(),
73+ unknown_buffer: "".to_owned(),
74+ bold: "".to_owned(),
75+ dim: "".to_owned(),
76+ underline: "".to_owned(),
77+ italic: "".to_owned(),
78+ strike: "".to_owned(),
79+ }
80+ }
81+
82+ /// Update the attributes with an escape sequence.
83+ /// Returns `false` if the sequence is unsupported.
84+ pub fn update(&mut self, sequence: &str) -> bool {
85+ let mut chars = sequence.char_indices().skip(1);
86+
87+ if let Some((_, t)) = chars.next() {
88+ match t {
89+ '(' => self.update_with_charset('(', chars.map(|(_, c)| c)),
90+ ')' => self.update_with_charset(')', chars.map(|(_, c)| c)),
91+ '[' => {
92+ if let Some((i, last)) = chars.last() {
93+ // SAFETY: Always starts with ^[ and ends with m.
94+ self.update_with_csi(last, &sequence[2..i])
95+ } else {
96+ false
97+ }
98+ }
99+ _ => self.update_with_unsupported(sequence),
100+ }
101+ } else {
102+ false
103+ }
104+ }
105+
106+ fn sgr_reset(&mut self) {
107+ self.foreground.clear();
108+ self.background.clear();
109+ self.underlined.clear();
110+ self.bold.clear();
111+ self.dim.clear();
112+ self.underline.clear();
113+ self.italic.clear();
114+ self.strike.clear();
115+ }
116+
117+ fn update_with_sgr(&mut self, parameters: &str) -> bool {
118+ let mut iter = parameters
119+ .split(';')
120+ .map(|p| if p.is_empty() { "0" } else { p })
121+ .map(|p| p.parse::<u16>())
122+ .map(|p| p.unwrap_or(0)); // Treat errors as 0.
123+
124+ while let Some(p) = iter.next() {
125+ match p {
126+ 0 => self.sgr_reset(),
127+ 1 => self.bold = format!("\x1B[{}m", parameters),
128+ 2 => self.dim = format!("\x1B[{}m", parameters),
129+ 3 => self.italic = format!("\x1B[{}m", parameters),
130+ 4 => self.underline = format!("\x1B[{}m", parameters),
131+ 23 => self.italic.clear(),
132+ 24 => self.underline.clear(),
133+ 22 => {
134+ self.bold.clear();
135+ self.dim.clear();
136+ }
137+ 30..=39 => self.foreground = Self::parse_color(p, &mut iter),
138+ 40..=49 => self.background = Self::parse_color(p, &mut iter),
139+ 58..=59 => self.underlined = Self::parse_color(p, &mut iter),
140+ 90..=97 => self.foreground = Self::parse_color(p, &mut iter),
141+ 100..=107 => self.foreground = Self::parse_color(p, &mut iter),
142+ _ => {
143+ // Unsupported SGR sequence.
144+ // Be compatible and pretend one just wasn't was provided.
145+ }
146+ }
147+ }
148+
149+ true
150+ }
151+
152+ fn update_with_csi(&mut self, finalizer: char, sequence: &str) -> bool {
153+ if finalizer == 'm' {
154+ self.update_with_sgr(sequence)
155+ } else {
156+ false
157+ }
158+ }
159+
160+ fn update_with_unsupported(&mut self, sequence: &str) -> bool {
161+ self.unknown_buffer.push_str(sequence);
162+ false
163+ }
164+
165+ fn update_with_charset(&mut self, kind: char, set: impl Iterator<Item = char>) -> bool {
166+ self.charset = format!("\x1B{}{}", kind, set.take(1).collect::<String>());
167+ true
168+ }
169+
170+ fn parse_color(color: u16, parameters: &mut dyn Iterator<Item = u16>) -> String {
171+ match color % 10 {
172+ 8 => match parameters.next() {
173+ Some(5) /* 256-color */ => format!("\x1B[{};5;{}m", color, join(";", 1, parameters)),
174+ Some(2) /* 24-bit color */ => format!("\x1B[{};2;{}m", color, join(";", 3, parameters)),
175+ Some(c) => format!("\x1B[{};{}m", color, c),
176+ _ => "".to_owned(),
177+ },
178+ 9 => "".to_owned(),
179+ _ => format!("\x1B[{}m", color),
180+ }
181+ }
182+}
183+
184+impl Display for Attributes {
185+ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
186+ write!(
187+ f,
188+ "{}{}{}{}{}{}{}{}{}",
189+ self.foreground,
190+ self.background,
191+ self.underlined,
192+ self.charset,
193+ self.bold,
194+ self.dim,
195+ self.underline,
196+ self.italic,
197+ self.strike,
198+ )
199+ }
200+}
201+
202+fn join(
203+ delimiter: &str,
204+ limit: usize,
205+ iterator: &mut dyn Iterator<Item = impl ToString>,
206+) -> String {
207+ iterator
208+ .take(limit)
209+ .map(|i| i.to_string())
210+ .collect::<Vec<String>>()
211+ .join(delimiter)
212+}
tests/benchmarks/.gitignorenew file+1
@@ -0,0 +1 @@
1+/benchmark-results
tests/benchmarks/comparison.shdeleted−33
@@ -1,33 +0,0 @@
1−#!/usr/bin/env bash
2−
3−cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4−
5−if ! command -v hyperfine > /dev/null 2>&1; then
6− echo "'hyperfine' does not seem to be installed."
7− echo "You can get it here: https://github.com/sharkdp/hyperfine"
8− exit 1
9−fi
10−
11−SRC="test-src/jquery-3.3.1.js"
12−
13−
14−cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
15−cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
16−cmd_pygmentize="pygmentize -g '$SRC'"
17−cmd_highlight="highlight -O truecolor '$SRC'"
18−cmd_ccat="ccat --color=always '$SRC'"
19−cmd_source_highlight="source-highlight --failsafe --infer-lang -f esc -i '$SRC'"
20−cmd_hicat="hicat '$SRC'"
21−cmd_coderay="coderay '$SRC'"
22−cmd_rouge="rougify '$SRC'"
23−
24−hyperfine --warmup 3 \
25− "$cmd_bat" \
26− "$cmd_bat_simple" \
27− "$cmd_pygmentize" \
28− "$cmd_highlight" \
29− "$cmd_ccat" \
30− "$cmd_source_highlight" \
31− "$cmd_hicat" \
32− "$cmd_coderay" \
33− "$cmd_rouge" \
tests/benchmarks/highlighting-speed-src/grep-output-ansi-sequences.txtnew file+2272
@@ -0,0 +1,2272 @@
1+.github/ISSUE_TEMPLATE/syntax_request.md:3:about: Request adding a new syntax to bat.
2+.github/ISSUE_TEMPLATE/syntax_request.md:14:Bat supports locally-installed language definitions. See the link below:
3+.github/ISSUE_TEMPLATE/syntax_request.md:16:https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions
4+.github/ISSUE_TEMPLATE/question.md:3:about: Ask a question about 'bat'.
5+.github/ISSUE_TEMPLATE/bug_report.md:21:**How did you install `bat`?**
6+.github/ISSUE_TEMPLATE/bug_report.md:27:**bat version and environment**
7+.github/ISSUE_TEMPLATE/bug_report.md:31:in which you're running bat. To do this, run the full `bat` command that demonstrates
8+.github/ISSUE_TEMPLATE/bug_report.md:34: bat [other options and arguments…] --diagnostic
9+.github/ISSUE_TEMPLATE/bug_report.md:40:If you are running bat 0.17.1 or older (where --diagnostic is not available), please
10+.github/ISSUE_TEMPLATE/bug_report.md:43: https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh
11+.github/ISSUE_TEMPLATE/bug_report.md:46:are on Windows, please let us know your bat version and your Windows version.
12+.github/workflows/CICD.yml:69: - name: Build and install bat
13+.github/workflows/CICD.yml:76: - name: Build and install bat with updated assets
14+.github/workflows/CICD.yml:94: run: bat --list-languages
15+.github/workflows/CICD.yml:96: run: bat --list-themes
16+.github/workflows/CICD.yml:235: - name: Run bat
17+.github/workflows/CICD.yml:242: - name: Show diagnostics (bat --diagnostic)
18+.github/workflows/CICD.yml:302: cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "$ARCHIVE_DIR"
19+.github/workflows/CICD.yml:308: cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.bash "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.bash"
20+.github/workflows/CICD.yml:309: cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
21+.github/workflows/CICD.yml:310: cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/_bat.ps1 "$ARCHIVE_DIR/autocomplete/_${{ env.PROJECT_NAME }}.ps1"
22+.github/workflows/CICD.yml:311: cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh"
23+.github/workflows/CICD.yml:355: install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
24+.github/workflows/CICD.yml:359: install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.bash "${DPKG_DIR}/usr/share/bash-completion/completions/${{ env.PROJECT_NAME }}"
25+.github/workflows/CICD.yml:360: install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish"
26+.github/workflows/CICD.yml:361: install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
27+README.md:2: <img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
28+README.md:3: <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>
29+README.md:4: <img src="https://img.shields.io/crates/l/bat.svg" alt="license">
30+README.md:5: <a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
31+README.md:16: [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
32+README.md:24:`bat` supports syntax highlighting for a large number of programming and markup
33+README.md:31:`bat` communicates with `git` to show modifications with respect to the index
34+README.md:45:By default, `bat` pipes its own output to a pager (e.g. `less`) if the output is too large for one screen.
35+README.md:46: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.
36+README.md:47: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.
37+README.md:51:Even with a pager set, you can still use `bat` to concatenate files :wink:.
38+README.md:52:Whenever `bat` detects a non-interactive terminal (i.e. when you pipe into another process or into a file), `bat` will act as a drop-in replacement for `cat` and fall back to printing the plain file contents, regardless of the `--pager` option's value.
39+README.md:59:> bat README.md
40+README.md:65:> bat src/*.rs
41+README.md:73:> curl -s https://sh.rustup.rs | bat
42+README.md:79:> yaml2json .travis.yml | json_pp | bat -l json
43+README.md:84:> bat -A /etc/hosts
44+README.md:90:bat > note.md # quickly create a new file
45+README.md:92:bat header.md content.md footer.md > document.md
46+README.md:94:bat -n main.rs # show line numbers (only)
47+README.md:96:bat f - g # output 'f', then stdin, then 'g'.
48+README.md:103:You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
49+README.md:104:use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
50+README.md:108:fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
51+README.md:115:You can use the `-exec` option of `find` to preview all search results with `bat`:
52+README.md:118:find … -exec bat {} +
53+README.md:121:If you happen to use [`fd`](https://github.com/sharkdp/fd), you can use the `-X`/`--exec-batch` option to do the same:
54+README.md:124:fd … -X bat
55+README.md:129:With [`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md), `bat` can be used as the printer for [`ripgrep`](https://github.com/BurntSushi/ripgrep) search results.
56+README.md:132:batgrep needle src/
57+README.md:137:`bat` can be combined with `tail -f` to continuously monitor a given file with syntax highlighting.
58+README.md:140:tail -f /var/log/pacman.log | bat --paging=never -l log
59+README.md:148:You can combine `bat` with `git show` to view an older version of a given file with proper syntax
60+README.md:152:git show v0.6.0:src/main.rs | bat -l rs
61+README.md:157:You can combine `bat` with `git diff` to view lines around code changes with proper syntax
62+README.md:160:batdiff() {
63+README.md:161: git diff --name-only --diff-filter=d | xargs bat --diff
64+README.md:164:If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
65+README.md:170:The line numbers and Git modification markers in the output of `bat` can make it hard to copy
66+README.md:171:the contents of a file. To prevent this, you can call `bat` with the `-p`/`--plain` option or
67+README.md:174:bat main.cpp | xclip
68+README.md:176:`bat` will detect that the output is being redirected and print the plain file contents.
69+README.md:180:`bat` can be used as a colorizing pager for `man`, by setting the
70+README.md:184:export MANPAGER="sh -c 'col -bx | bat -l man -p'"
71+README.md:187:(replace `bat` with `batcat` if you are on Debian or Ubuntu)
72+README.md:192:If you prefer to have this bundled in a new command, you can also use [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
73+README.md:196:Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145) with Mandocs `man` implementation.
74+README.md:200:The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) script is a wrapper that will format code and print it with `bat`.
75+README.md:205:[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions)
76+README.md:210:`bat` is available on [Ubuntu since 20.04 ("Focal")](https://packages.ubuntu.com/search?keywords=bat&exact=1) and [Debian since August 2021 (Debian 11 - "Bullseye")](https://packages.debian.org/bullseye/bat).
77+README.md:215:sudo apt install bat
78+README.md:218:**Important**: If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
79+README.md:219:clash with another package](https://github.com/sharkdp/bat/issues/982)). You can set up a `bat -> batcat` symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:
80+README.md:222:ln -s /usr/bin/batcat ~/.local/bin/bat
81+README.md:229:the most recent release of `bat`, download the latest `.deb` package from the
82+README.md:230:[release page](https://github.com/sharkdp/bat/releases) and install it via:
83+README.md:233:sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
84+README.md:238:You can install [the `bat` package](https://pkgs.alpinelinux.org/packages?name=bat)
85+README.md:242:apk add bat
86+README.md:247:You can install [the `bat` package](https://www.archlinux.org/packages/community/x86_64/bat/)
87+README.md:251:pacman -S bat
88+README.md:256:You can install [the `bat` package](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506) from the official [Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/) repository.
89+README.md:259:dnf install bat
90+README.md:264:You can install [the `bat` package](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat) from dev-kit.
91+README.md:267:emerge sys-apps/bat
92+README.md:272:You can install [the `bat` package](https://packages.gentoo.org/packages/sys-apps/bat)
93+README.md:276:emerge sys-apps/bat
94+README.md:281:You can install `bat` via xbps-install:
95+README.md:283:xbps-install -S bat
96+README.md:288:You can install `bat` via pkg:
97+README.md:290:pkg install bat
98+README.md:295:You can install a precompiled [`bat` package](https://www.freshports.org/textproc/bat) with pkg:
99+README.md:298:pkg install bat
100+README.md:304:cd /usr/ports/textproc/bat
101+README.md:310:You can install `bat` package using [`pkg_add(1)`](https://man.openbsd.org/pkg_add.1):
102+README.md:313:pkg_add bat
103+README.md:318:You can install `bat` using the [nix package manager](https://nixos.org/nix):
104+README.md:321:nix-env -i bat
105+README.md:326:You can install `bat` with zypper:
106+README.md:329:zypper install bat
107+README.md:335:Existing packages may be available, but are not officially supported and may contain [issues](https://github.com/sharkdp/bat/issues/1519).
108+README.md:339:You can install `bat` with [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) or [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat):
109+README.md:342:brew install bat
110+README.md:347:Or install `bat` with [MacPorts](https://ports.macports.org/port/bat/summary):
111+README.md:350:port install bat
112+README.md:355:There are a few options to install `bat` on Windows. Once you have installed `bat`,
113+README.md:356:take a look at the ["Using `bat` on Windows"](#using-bat-on-windows) section.
114+README.md:364:You can install `bat` via [Chocolatey](https://chocolatey.org/packages/Bat):
115+README.md:366:choco install bat
116+README.md:371:You can install `bat` via [scoop](https://scoop.sh/):
117+README.md:373:scoop install bat
118+README.md:378:You can download prebuilt binaries from the [Release page](https://github.com/sharkdp/bat/releases),
119+README.md:384:Check out the [Release page](https://github.com/sharkdp/bat/releases) for
120+README.md:385:prebuilt versions of `bat` for many different architectures. Statically-linked
121+README.md:390:If you want to build `bat` from source, you need Rust 1.46 or
122+README.md:394:cargo install --locked bat
123+README.md:404:Use `bat --list-themes` to get a list of all available themes for syntax
124+README.md:405:highlighting. To select the `TwoDark` theme, call `bat` with the
125+README.md:406:`--theme=TwoDark` option or set the `BAT_THEME` environment variable to
126+README.md:407:`TwoDark`. Use `export BAT_THEME="TwoDark"` in your shell's startup file to
127+README.md:408:make the change permanent. Alternatively, use `bat`s
128+README.md:409:[configuration file](https://github.com/sharkdp/bat#configuration-file).
129+README.md:414:bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
130+README.md:417:`bat` looks good on a dark background by default. However, if your terminal uses a
131+README.md:420:['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
132+README.md:424:`bat` has three themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
133+README.md:444:You can use the `--style` option to control the appearance of `bat`s output.
134+README.md:446:and line numbers but no grid and no file header. Set the `BAT_STYLE` environment
135+README.md:447:variable to make these changes permanent or use `bat`s
136+README.md:448:[configuration file](https://github.com/sharkdp/bat#configuration-file).
137+README.md:452:Should you find that a particular syntax is not available within `bat`, you can follow these
138+README.md:453:instructions to easily add new syntaxes to your current `bat` installation.
139+README.md:455:`bat` uses the excellent [`syntect`](https://github.com/trishume/syntect/)
140+README.md:466: mkdir -p "$(bat --config-dir)/syntaxes"
141+README.md:467: cd "$(bat --config-dir)/syntaxes"
142+README.md:477: bat cache --build
143+README.md:480:3. Finally, use `bat --list-languages` to check if the new languages are available.
144+README.md:485: bat cache --clear
145+README.md:488:4. If you think that a specific syntax should be included in `bat` by default, please
146+README.md:490: instructions [here](doc/assets.md): [Open Syntax Request](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md).
147+README.md:498:mkdir -p "$(bat --config-dir)/themes"
148+README.md:499:cd "$(bat --config-dir)/themes"
149+README.md:505:bat cache --build
150+README.md:508:Finally, use `bat --list-themes` to check if the new themes are available.
151+README.md:516:(use `bat --list-languages` for an overview).
152+README.md:518:Note: You probably want to use this option as an entry in `bat`s configuration file instead
153+README.md:539:`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
154+README.md:541:`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
155+README.md:544:**Note**: If `PAGER` is `more` or `most`, `bat` will silently use `less` instead to ensure support for colors.
156+README.md:547:`PAGER`/`BAT_PAGER` variables:
157+README.md:550:export BAT_PAGER="less -RF"
158+README.md:553:Instead of using environment variables, you can also use `bat`s [configuration file](https://github.com/sharkdp/bat#configuration-file) to configure the pager (`--pager` option).
159+README.md:556:`bat` will pass the following command line options to the pager: `-R`/`--RAW-CONTROL-CHARS`,
160+README.md:572:`bat` expands tabs to 4 spaces by itself, not relying on the pager. To change this, simply add the
161+README.md:575:**Note**: Defining tab stops for the pager (via the `--pager` argument by `bat`, or via the `LESS`
162+README.md:578:sidebar. Calling `bat` with `--tabs=0` will override it and let tabs be consumed by the pager.
163+README.md:582:If you make use of the dark mode feature in macOS, you might want to configure `bat` to use a different
164+README.md:587:alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
165+README.md:593:`bat` can also be customized with a configuration file. The location of the file is dependent
166+README.md:596:bat --config-file
167+README.md:599:Alternatively, you can use the `BAT_CONFIG_PATH` environment variable to point `bat` to a
168+README.md:602:export BAT_CONFIG_PATH="/path/to/bat.conf"
169+README.md:607:bat --generate-config-file
170+README.md:612:The configuration file is a simple list of command line arguments. Use `bat --help` to see a full list of possible options and values. In addition, you can add comments by prepending a line with the `#` character.
171+README.md:629:## Using `bat` on Windows
172+README.md:631:`bat` mostly works out-of-the-box on Windows, but a few features may need extra configuration.
173+README.md:653:or by setting `BAT_PAGER` to an empty string.
174+README.md:657:`bat` on Windows does not natively support Cygwin's unix-style paths (`/cygdrive/*`). When passed an absolute cygwin path as an argument, `bat` will encounter the following error: `The system cannot find the path specified. (os error 3)`
175+README.md:662:bat() {
176+README.md:671: command bat "${args[@]}"
177+README.md:679:If an input file contains color codes or other ANSI escape sequences, `bat` will have problems
178+README.md:682:passing the `--color=never --wrap=never` options to `bat`.
179+README.md:686:`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
180+README.md:694:`24bit`. Otherwise, `bat` will not be able to determine whether or not 24-bit escape sequences
181+README.md:699:Please try a different theme (see `bat --list-themes` for a list). The `OneHalfDark` and
182+README.md:704:`bat` natively supports UTF-8 as well as UTF-16. For every other file encoding, you may need to
183+README.md:709:iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
184+README.md:712:by `bat`.
185+README.md:718:git clone --recursive https://github.com/sharkdp/bat
186+README.md:721:cd bat
187+README.md:730:# Build a bat binary with modified syntaxes and themes
188+README.md:735:If you want to build an application that uses `bat`s pretty-printing
189+README.md:736:features as a library, check out the [the API documentation](https://docs.rs/bat/).
190+README.md:738:when you depend on `bat` as a library.
191+README.md:753:Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
192+README.md:757:`bat` tries to achieve the following goals:
193+README.md:768:Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
194+README.md:770:`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
195+.gitmodules:198: url = https://github.com/ArmandPhilippot/coldark-bat.git
196+.gitmodules:202: branch = bat-source
197+examples/list_syntaxes_and_themes.rs:1:/// A simple program that prints its own source code using the bat library
198+examples/list_syntaxes_and_themes.rs:2:use bat::PrettyPrinter;
199+examples/inputs.rs:3:use bat::{Input, PrettyPrinter};
200+examples/yaml.rs:2:use bat::{Input, PrettyPrinter};
201+examples/advanced.rs:1:/// A program that prints its own source code using the bat library
202+examples/advanced.rs:2:use bat::{PagingMode, PrettyPrinter, WrappingMode};
203+examples/cat.rs:1:/// A very simple colorized `cat` clone, using `bat` as a library.
204+examples/cat.rs:2:/// See `src/bin/bat` for the full `bat` application.
205+examples/cat.rs:3:use bat::PrettyPrinter;
206+examples/simple.rs:1:/// A simple program that prints its own source code using the bat library
207+examples/simple.rs:2:use bat::PrettyPrinter;
208+.gitignore:5:/assets/completions/bat.bash
209+.gitignore:6:/assets/completions/bat.fish
210+.gitignore:7:/assets/completions/bat.zsh
211+.gitignore:8:/assets/manual/bat.1
212+src/input.rs:12:/// This tells bat how to refer to the input.
213+src/error.rs:22: #[error("Use of bat as a pager is disallowed in order to avoid infinite recursion problems")]
214+src/error.rs:23: InvalidPagerValueBat,
215+src/error.rs:53: Red.paint("[bat error]"),
216+src/error.rs:59: writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
217+src/lib.rs:1://! `bat` is a library to print syntax highlighted content.
218+src/lib.rs:13://! use bat::PrettyPrinter;
219+src/macros.rs:2:macro_rules! bat_warning {
220+src/macros.rs:5: eprintln!("{}: {}", Yellow.paint("[bat warning]"), format!($($arg)*));
221+src/syntax_mapping.rs:52: "**/bat/config",
222+src/pager.rs:10: /// From the env var BAT_PAGER
223+src/pager.rs:11: EnvVarBatPager,
224+src/pager.rs:23: /// bat
225+src/pager.rs:24: Bat,
226+src/pager.rs:48: Some("bat") => PagerKind::Bat,
227+src/pager.rs:86: let bat_pager = env::var("BAT_PAGER");
228+src/pager.rs:89: let (cmd, source) = match (config_pager, &bat_pager, &pager) {
229+src/pager.rs:91: (_, Ok(bat_pager), _) => (bat_pager.as_str(), PagerSource::EnvVarBatPager),
230+src/pager.rs:105: // If PAGER=bat, silently use 'less' instead to prevent
231+src/pager.rs:107: // Never silently use 'less' if BAT_PAGER or --pager has been
232+src/pager.rs:109: matches!(kind, PagerKind::More | PagerKind::Most | PagerKind::Bat)
233+src/assets.rs:16:use crate::{bat_warning, SyntaxMapping};
234+src/assets.rs:218: bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
235+src/assets.rs:222: bat_warning!("Unknown theme '{}', using default.", theme)
236+src/printer.rs:278: (but will be present if the output of 'bat' is piped). You can use 'bat -A' \
237+src/printer.rs:280: Yellow.paint("[bat warning]"),
238+src/output.rs:62: if pager.kind == PagerKind::Bat {
239+src/output.rs:63: return Err(Error::InvalidPagerValueBat);
240+src/output.rs:78: // ANSI color sequences printed by bat. If someone has set PAGER="less -F", we
241+src/output.rs:81: // We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER
242+src/output.rs:82: // or bats '--pager' command line option.
243+src/bin/bat/input.rs:1:use bat::input::Input;
244+src/bin/bat/config.rs:10: env::var("BAT_CONFIG_PATH")
245+src/bin/bat/config.rs:16:pub fn generate_config_file() -> bat::error::Result<()> {
246+src/bin/bat/config.rs:46: let default_config = r#"# This is `bat`s configuration file. Each line either contains a comment or
247+src/bin/bat/config.rs:47:# a command-line option that you want to pass to `bat` by default. You can
248+src/bin/bat/config.rs:48:# run `bat --help` to get a list of all possible configuration options.
249+src/bin/bat/config.rs:50:# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
250+src/bin/bat/config.rs:62:# enable mouse scrolling support in `bat` when running inside tmux. This might
251+src/bin/bat/config.rs:98: env::var("BAT_OPTS").ok().map(|s| get_args_from_str(&s))
252+src/bin/bat/directories.rs:7:/// The `XDG_CACHE_HOME` environment variable is checked first. `BAT_CONFIG_DIR`
253+src/bin/bat/directories.rs:9:/// The fallback directories are `~/.cache/bat` and `~/.config/bat`, respectively.
254+src/bin/bat/directories.rs:10:pub struct BatProjectDirs {
255+src/bin/bat/directories.rs:15:impl BatProjectDirs {
256+src/bin/bat/directories.rs:16: fn new() -> Option<BatProjectDirs> {
257+src/bin/bat/directories.rs:17: let cache_dir = BatProjectDirs::get_cache_dir()?;
258+src/bin/bat/directories.rs:19: // Checks whether or not $BAT_CONFIG_DIR exists. If it doesn't, set our config dir
259+src/bin/bat/directories.rs:22: if let Some(config_dir_op) = env::var_os("BAT_CONFIG_DIR").map(PathBuf::from) {
260+src/bin/bat/directories.rs:34: config_dir_op.map(|d| d.join("bat"))?
261+src/bin/bat/directories.rs:37: Some(BatProjectDirs {
262+src/bin/bat/directories.rs:44: // on all OS prefer BAT_CACHE_PATH if set
263+src/bin/bat/directories.rs:45: let cache_dir_op = env::var_os("BAT_CACHE_PATH").map(PathBuf::from);
264+src/bin/bat/directories.rs:59: cache_dir_op.map(|d| d.join("bat"))
265+src/bin/bat/directories.rs:72: pub static ref PROJECT_DIRS: BatProjectDirs =
266+src/bin/bat/directories.rs:73: BatProjectDirs::new().expect("Could not get home directory");
267+src/bin/bat/app.rs:17:use bat::{
268+src/bin/bat/app.rs:19: bat_warning,
269+src/bin/bat/app.rs:56: // Skip the arguments in bats config file
270+src/bin/bat/app.rs:62: // Read arguments from bats config file
271+src/bin/bat/app.rs:191: .or_else(|| env::var("BAT_TABS").ok())
272+src/bin/bat/app.rs:204: .or_else(|| env::var("BAT_THEME").ok())
273+src/bin/bat/app.rs:305: let env_style_components: Option<Vec<StyleComponent>> = env::var("BAT_STYLE")
274+src/bin/bat/app.rs:336: bat_warning!("Style 'rule' is a subset of style 'grid', 'rule' will not be visible.");
275+src/bin/bat/assets.rs:9:use bat::assets::HighlightingAssets;
276+src/bin/bat/assets.rs:10:use bat::assets_metadata::AssetsMetadata;
277+src/bin/bat/assets.rs:11:use bat::error::*;
278+src/bin/bat/assets.rs:34: in '{}' are not compatible with this version of bat ({}). To solve this, \
279+src/bin/bat/assets.rs:35: either rebuild the cache (bat cache --build) or remove \
280+src/bin/bat/assets.rs:36: the custom syntaxes/themes (bat cache --clear).\n\
281+src/bin/bat/assets.rs:38: https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions",
282+src/bin/bat/main.rs:28:use bat::{
283+src/bin/bat/main.rs:52: bat::assets::build(source_dir, !blank, target_dir, clap::crate_version!())
284+src/bin/bat/main.rs:60: println!("bat has been built without the 'build-assets' feature. The 'cache --build' option is not available.");
285+src/bin/bat/main.rs:207: and are added to the cache with `bat cache --build`. \
286+src/bin/bat/main.rs:209: https://github.com/sharkdp/bat#adding-new-themes",
287+src/bin/bat/main.rs:230: let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
288+src/bin/bat/main.rs:243: "BAT_PAGER",
289+src/bin/bat/main.rs:244: "BAT_CACHE_PATH",
290+src/bin/bat/main.rs:245: "BAT_CONFIG_PATH",
291+src/bin/bat/main.rs:246: "BAT_OPTS",
292+src/bin/bat/main.rs:247: "BAT_STYLE",
293+src/bin/bat/main.rs:248: "BAT_TABS",
294+src/bin/bat/main.rs:249: "BAT_THEME",
295+src/bin/bat/main.rs:280: println!("bat has been built without the 'bugreport' feature. The '--diagnostic' option is not available.");
296+src/bin/bat/clap_app.rs:43: "Note: `bat -h` prints a short and concise overview while `bat --help` gives all \
297+src/bin/bat/clap_app.rs:127: data to bat from STDIN when bat does not otherwise know \
298+src/bin/bat/clap_app.rs:290: if the output of bat is piped to another program, but you want \
299+src/bin/bat/clap_app.rs:306: set BAT_PAGER to an empty string. To control which pager is used, see the \
300+src/bin/bat/clap_app.rs:330: PAGER and BAT_PAGER environment variables. The default pager is 'less'. \
301+src/bin/bat/clap_app.rs:363: BAT_THEME environment variable (e.g.: export \
302+src/bin/bat/clap_app.rs:364: BAT_THEME=\"...\").",
303+src/bin/bat/clap_app.rs:412: BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
304+src/bin/bat/clap_app.rs:497: .help("Show bat's configuration directory."),
305+src/bin/bat/clap_app.rs:503: .help("Show bat's cache directory."),
306+src/bin/bat/clap_app.rs:521: 'bat --ignored-suffix \".dev\" my_file.json.dev' will use JSON syntax, and ignore '.dev'"
307+src/bin/bat/clap_app.rs:528: // enable the 'bat cache' subcommand.
308+src/assets/serialized_syntax_set.rs:14: /// The data to use is embedded into the bat binary.
309+src/assets/build_assets.rs:246: if std::env::var("BAT_PRINT_SYNTAX_DEPENDENCIES").is_ok() {
310+src/assets/build_assets.rs:248: // BAT_PRINT_SYNTAX_DEPENDENCIES=1 cargo run -- cache --build --source assets --blank --target /tmp
311+src/assets/build_assets.rs:342:/// BAT_SYNTAX_DEPENDENCIES_TO_GRAPHVIZ_DOT_FILE=/tmp/bat-syntax-dependencies.dot cargo run -- cache --build --source assets --blank --target /tmp
312+src/assets/build_assets.rs:343:/// dot /tmp/bat-syntax-dependencies.dot -Tpng -o /tmp/bat-syntax-dependencies.png
313+src/assets/build_assets.rs:344:/// open /tmp/bat-syntax-dependencies.png
314+src/assets/build_assets.rs:350: if let Ok(dot_file_path) = std::env::var("BAT_SYNTAX_DEPENDENCIES_TO_GRAPHVIZ_DOT_FILE") {
315+src/assets/build_assets.rs:424: if std::env::var("BAT_INCLUDE_SYNTAX_DEPENDENTS").is_ok() {
316+src/assets/assets_metadata.rs:12: bat_version: Option<String>,
317+src/assets/assets_metadata.rs:22: bat_version: Some(current_version.to_owned()),
318+src/assets/assets_metadata.rs:48: /// => assume that these were created by an old version of bat and return
319+src/assets/assets_metadata.rs:69: Version::parse(current_version).expect("bat follows semantic versioning");
320+src/assets/assets_metadata.rs:71: .bat_version
321+src/assets/build_assets/graphviz_utils.rs:30: writeln!(dot_file, "digraph BatSyntaxDependencies {{")?;
322+build.rs:2:// For more details, see https://github.com/sharkdp/bat/issues/372
323+build.rs:4:// For bat-as-a-library, no build script is required. The build script is for
324+build.rs:5:// the manpage and completions, which are only relevant to the bat application.
325+build.rs:17: let project_name = option_env!("PROJECT_NAME").unwrap_or("bat");
326+build.rs:54: "assets/manual/bat.1.in",
327+build.rs:55: out_dir.join("assets/manual/bat.1"),
328+build.rs:59: "assets/completions/bat.bash.in",
329+build.rs:60: out_dir.join("assets/completions/bat.bash"),
330+build.rs:64: "assets/completions/bat.fish.in",
331+build.rs:65: out_dir.join("assets/completions/bat.fish"),
332+build.rs:69: "assets/completions/_bat.ps1.in",
333+build.rs:70: out_dir.join("assets/completions/_bat.ps1"),
334+build.rs:74: "assets/completions/bat.zsh.in",
335+build.rs:75: out_dir.join("assets/completions/bat.zsh"),
336+build.rs:89:// const BIN_NAME: &str = "bat";
337+.git/info/refs:21:b41fb0df6cf831081754c27a4c33227c166eee69 refs/heads/bat-0.16-updates
338+.git/info/refs:22:b5a40d0866e6a190fbee095ac104fdc6ec168d0a refs/heads/bat-0.18.2-release
339+.git/info/refs:23:fa0d448cd3e652ffd3c5caa4caa4bdbe2973241c refs/heads/bat-config-file
340+.git/info/refs:24:27516c6f26dc1319dc2516e7caf1aafbe8d30aa0 refs/heads/bat-diagnostic-option
341+.git/info/refs:25:cd501edcbded4dc344e0a0478472b0a4819c2251 refs/heads/bat-diff
342+.git/info/refs:26:d77742b2e425cd76e2ca90a75efba4205e280859 refs/heads/bat-diff-fixes
343+.git/info/refs:215:f1f8807a38052c8138c6f8d1b3bf125e30588712 refs/remotes/origin/bat-v0.18.3-candidate
344+.git/FETCH_HEAD:1:619cf6e6d6641dbb913dddd56907a54c6a9f6ce6 branch 'master' of https://github.com/sharkdp/bat
345+.git/FETCH_HEAD:2:8244eb8ef88cc1b64d27991d6a5c7c69586b8a13 not-for-merge branch 'ci-experiment' of https://github.com/sharkdp/bat
346+.git/FETCH_HEAD:3:271842d87c816cb80dc0a1c48eefee99c9439db6 not-for-merge branch 'create_highlighted_versions-wrong-path-repro' of https://github.com/sharkdp/bat
347+.git/FETCH_HEAD:4:c42ec074ea6accdc38b8d9278bc3810343e2d1a3 not-for-merge branch 'dependabot/submodules/assets/syntaxes/02_Extra/PowerShell-742f0b5' of https://github.com/sharkdp/bat
348+.git/FETCH_HEAD:5:fb9c30b1f7ff648d8aa8fb35a8ff669513c8e91f not-for-merge branch 'dependabot/submodules/assets/syntaxes/02_Extra/SCSS_Sass-d3d9404' of https://github.com/sharkdp/bat
349+.git/FETCH_HEAD:6:179d905bb92eee7272cf6fbb38db88f9294df94a not-for-merge branch 'dependabot/submodules/assets/syntaxes/02_Extra/TypeScript-ba45efd' of https://github.com/sharkdp/bat
350+.git/FETCH_HEAD:7:b146958ecbb8c8c926159509ca7fb32a8573f897 not-for-merge branch 'release-v0.18.3' of https://github.com/sharkdp/bat
351+.git/logs/HEAD:14:a946f3ae23e7d6d9aa6361c034e9b62859b4dbff e92e13cd4332196617df7a07bc6c55d1fd4834bb David Peter <mail@david-peter.de> 1631038809 +0200 rebase (continue) (pick): Use BAT_CONFIG_DIR and BAT_CACHE_PATH
352+.git/modules/assets/themes/Coldark/FETCH_HEAD:1:e44750b2a9629dd12d8ed3ad9fd50c77232170b9 not-for-merge branch 'master' of https://github.com/ArmandPhilippot/coldark-bat
353+.git/modules/assets/themes/Coldark/logs/refs/heads/master:1:0000000000000000000000000000000000000000 b4a1c74d8d5bdd136ec530e5905b810272472545 sharkdp <davidpeter@web.de> 1603543180 +0200 clone: from https://github.com/ArmandPhilippot/coldark-bat.git
354+.git/modules/assets/themes/Coldark/logs/refs/remotes/origin/HEAD:1:0000000000000000000000000000000000000000 b4a1c74d8d5bdd136ec530e5905b810272472545 sharkdp <davidpeter@web.de> 1603543180 +0200 clone: from https://github.com/ArmandPhilippot/coldark-bat.git
355+.git/modules/assets/themes/Coldark/logs/HEAD:1:0000000000000000000000000000000000000000 b4a1c74d8d5bdd136ec530e5905b810272472545 sharkdp <davidpeter@web.de> 1603543180 +0200 clone: from https://github.com/ArmandPhilippot/coldark-bat.git
356+.git/modules/assets/themes/Coldark/config:8: url = https://github.com/ArmandPhilippot/coldark-bat.git
357+.git/modules/assets/themes/gruvbox/FETCH_HEAD:1:64c47250e54298b91e2cf8d401320009aba9f991 not-for-merge branch 'bat-source' of https://github.com/subnut/gruvbox-tmTheme
358+.git/packed-refs:22:b41fb0df6cf831081754c27a4c33227c166eee69 refs/heads/bat-0.16-updates
359+.git/packed-refs:23:b5a40d0866e6a190fbee095ac104fdc6ec168d0a refs/heads/bat-0.18.2-release
360+.git/packed-refs:24:fa0d448cd3e652ffd3c5caa4caa4bdbe2973241c refs/heads/bat-config-file
361+.git/packed-refs:25:27516c6f26dc1319dc2516e7caf1aafbe8d30aa0 refs/heads/bat-diagnostic-option
362+.git/packed-refs:26:cd501edcbded4dc344e0a0478472b0a4819c2251 refs/heads/bat-diff
363+.git/packed-refs:27:d77742b2e425cd76e2ca90a75efba4205e280859 refs/heads/bat-diff-fixes
364+.git/packed-refs:216:f1f8807a38052c8138c6f8d1b3bf125e30588712 refs/remotes/origin/bat-v0.18.3-candidate
365+.git/config:7: url = https://github.com/sharkdp/bat.git
366+.git/config:13: slug = sharkdp/bat
367+.git/config:143:[branch "bat-config-file"]
368+.git/config:145: merge = refs/heads/bat-config-file
369+.git/config:176:[branch "bat-diff"]
370+.git/config:178: merge = refs/heads/bat-diff
371+.git/config:228: remote = git@github.com:lavifb/bat.git
372+.git/config:231: url = https://github.com/lavifb/bat
373+.git/config:234: remote = git@github.com:majecty/bat.git
374+.git/config:237: url = https://github.com/majecty/bat
375+.git/config:246: remote = git@github.com:reidwagner/bat.git
376+.git/config:315: remote = git@github.com:hrlmartins/bat.git
377+.git/config:369: remote = git@github.com:fvictorio/bat.git
378+.git/config:378: remote = git@github.com:eth-p/bat.git
379+.git/config:387: remote = git@github.com:Kogia-sima/bat.git
380+.git/config:426: remote = git@github.com:neuronull/bat.git
381+.git/config:429: remote = git@github.com:jmick414/bat.git
382+.git/config:435: remote = git@github.com:dtolnay/bat.git
383+.git/config:441: remote = git@github.com:eth-p/bat.git
384+.git/config:444: remote = git@github.com:neuronull/bat.git
385+.git/config:482:[branch "bat-diff-fixes"]
386+.git/config:484: merge = refs/heads/bat-diff-fixes
387+.git/config:486: remote = git@github.com:lzutao/bat.git
388+.git/config:507: remote = git@github.com:eth-p/bat.git
389+.git/config:510: remote = git@github.com:eth-p/bat.git
390+.git/config:513: remote = git@github.com:kopecs/bat.git
391+.git/config:516: remote = git@github.com:eth-p/bat.git
392+.git/config:540: remote = git@github.com:rxt1077/bat.git
393+.git/config:558: remote = git@github.com:alexnovak/bat.git
394+.git/config:561: remote = git@github.com:guidocella/bat.git
395+.git/config:564: remote = git@github.com:gsomix/bat.git
396+.git/config:567: remote = git@github.com:caioalonso/bat.git
397+.git/config:579: remote = git@github.com:mk12/bat.git
398+.git/config:585: remote = git@github.com:kjmph/bat.git
399+.git/config:591: remote = git@github.com:Kienyew/bat.git
400+.git/config:603: remote = git@github.com:alexanderkarlis/bat.git
401+.git/config:609: remote = git@github.com:ahmedelgabri/bat.git
402+.git/config:615: remote = git@github.com:Kienyew/bat.git
403+.git/config:618: remote = git@github.com:eth-p/bat.git
404+.git/config:620:[branch "bat-0.16-updates"]
405+.git/config:622: merge = refs/heads/bat-0.16-updates
406+.git/config:624: remote = git@github.com:henil/bat.git
407+.git/config:627: remote = git@github.com:AkshatGadhwal/bat.git
408+.git/config:633: remote = git@github.com:loganintech/bat.git
409+.git/config:639: remote = git@github.com:mzegar/bat.git
410+.git/config:642: remote = git@github.com:AkshatGadhwal/bat.git
411+.git/config:645: remote = git@github.com:AkshatGadhwal/bat.git
412+.git/config:651: remote = git@github.com:jacobmischka/bat.git
413+.git/config:657: url = https://github.com/forkeith/bat.git
414+.git/config:660: remote = git@github.com:ArmandPhilippot/bat.git
415+.git/config:664: url = https://github.com/ArmandPhilippot/coldark-bat.git
416+.git/config:666: remote = git@github.com:adrian-rivera/bat.git
417+.git/config:669: remote = git@github.com:eth-p/bat.git
418+.git/config:681: remote = git@github.com:MarcoIeni/bat.git
419+.git/config:690: remote = git@github.com:Enselic/bat.git
420+.git/config:696: remote = git@github.com:stku1985/bat.git
421+.git/config:699: remote = git@github.com:mk12/bat.git
422+.git/config:702: remote = git@github.com:j0hnmeow/bat.git
423+.git/config:708: remote = git@github.com:Enselic/bat.git
424+.git/config:713:[branch "bat-diagnostic-option"]
425+.git/config:715: merge = refs/heads/bat-diagnostic-option
426+.git/config:717: url = https://github.com/niklasmohrin/bat.git
427+.git/config:723: remote = git@github.com:paulsmith/bat.git
428+.git/config:735: remote = git@github.com:Enselic/bat.git
429+.git/config:762: remote = git@github.com:Enselic/bat.git
430+.git/config:771: remote = git@github.com:brightly-salty/bat.git
431+.git/config:774: remote = git@github.com:eth-p/bat.git
432+.git/config:804: remote = git@github.com:matklad/bat.git
433+.git/config:827:[branch "bat-0.18.2-release"]
434+.git/config:829: merge = refs/heads/bat-0.18.2-release
435+.git/config:831: remote = git@github.com:Enselic/bat.git
436+.git/config:834: remote = git@github.com:steffahn/bat.git
437+.git/config:837: remote = git@github.com:SarveshMD/bat.git
438+.git/config:840: remote = git@github.com:Enselic/bat.git
439+.git/config:852: remote = git@github.com:Enselic/bat.git
440+.git/config:861: remote = git@github.com:bojan88/bat.git
441+.git/config:870: remote = git@github.com:Enselic/bat.git
442+.git/config:882: remote = git@github.com:Enselic/bat.git
443+CHANGELOG.md:6:- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
444+CHANGELOG.md:25:- Include git hash in `bat -V` and `bat --version` output if present. See #1921 (@Enselic)
445+CHANGELOG.md:42:## `bat` as a library
446+CHANGELOG.md:45:- 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)
447+CHANGELOG.md:67:- Fix for a security vulnerability on Windows. Prior to this release, `bat` would execute programs called `less`/`less.exe` from the current working directory (instead of the one from `PATH`) with priority. An attacker might be able to use this by placing a malicious program in a shared directory where the user would execute `bat`. `bat` users on Windows are advised to upgrade to this version. See #1724 and #1472 (@Ry0taK).
448+CHANGELOG.md:92:- The `LESS` environment variable is now included in `bat --diagnostic`, see #1589 (@Enselic)
449+CHANGELOG.md:98:- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)
450+CHANGELOG.md:112:- Use a pager when `bat --list-languages` is called, see #1394 (@stku1985)
451+CHANGELOG.md:117:- Only print themes hint in interactive mode (`bat --list-themes`), see #1439 (@rsteube)
452+CHANGELOG.md:122:- If `PAGER` (but not `BAT_PAGER` or `--pager`) is `more` or `most`, silently use `less` instead to ensure support for colors, see #1063 (@Enselic)
453+CHANGELOG.md:123:- If `PAGER` is `bat`, silently use `less` to prevent recursion. For `BAT_PAGER` or `--pager`, exit with error, see #1413 (@Enselic)
454+CHANGELOG.md:125:- `BAT_CONFIG_PATH` ignored by `bat` if non-existent, see #1550 (@sharkdp)
455+CHANGELOG.md:147:## `bat` as a library
456+CHANGELOG.md:160:- Running `bat` without arguments fails ("output file is also an input"), see #1396
457+CHANGELOG.md:168:- Pass `-S` ("chop long lines") to `less` if `--wrap=never` is set in `bat`, see #1255 (@gahag)
458+CHANGELOG.md:173:- Throw an error when `bat` is being used as `pager`, see #1343 (@adrian-rivera)
459+CHANGELOG.md:225:## `bat` as a library
460+CHANGELOG.md:246:- Cannot run `bat` with relative paths, see #1022
461+CHANGELOG.md:247:- bat mishighlights Users that start with digits in SSH config, see #984
462+CHANGELOG.md:268:- bat now prints an error if an invalid syntax is specified via `-l` or `--map-syntax`, see #1004 (@eth-p)
463+CHANGELOG.md:270:## `bat` as a library
464+CHANGELOG.md:276:- Compilation problems with `onig_sys` on various platforms have been resolved by upgrading to `syntect 4.2`, which includes a new `onig` version that allows to build `onig_sys` without the `bindgen` dependency. This removes the need for `libclang(-dev)` to be installed to compile `bat`. Package maintainers might want to remove `clang` as a build dependency. See #650 for more details.
465+CHANGELOG.md:284: Users suffering from #865 ("no color for bat in ssh from a Windows client") can use the `ansi-dark` and `ansi-light` themes from now on.
466+CHANGELOG.md:303:- Performance improvements when using custom caches (via `bat cache --build`): the `bat` startup time should now be twice as fast (@lzutao).
467+CHANGELOG.md:309:## `bat` as a library
468+CHANGELOG.md:320: in the header. This is useful when piping input into `bat`. See #654 and #892 (@neuronull).
469+CHANGELOG.md:336:- When saving/reading user-provided syntaxes or themes, `bat` will now maintain a
470+CHANGELOG.md:337: `metadata.yaml` file which includes information about the `bat` version which was
471+CHANGELOG.md:342:## `bat` as a library
472+CHANGELOG.md:346: API is still available (basically everything that is not in the root `bat`
473+CHANGELOG.md:349: Note that this should still be considered a "beta" release of `bat`-as-a-library.
474+CHANGELOG.md:354: everything required by `bat` the application. When depending on bat as a library, downstream
475+CHANGELOG.md:358: bat = { version = "0.14", default-features = false }
476+CHANGELOG.md:371:## `bat` as a library
477+CHANGELOG.md:373:Beginning with this release, `bat` can be used as a library (#423).
478+CHANGELOG.md:378:- Second attempt, complete restructuring of the `bat` crate, see #679 (@DrSensor)
479+CHANGELOG.md:383:That being said, you can start using it! See the example programs in [`examples/`](https://github.com/sharkdp/bat/tree/master/examples).
480+CHANGELOG.md:385:You can see the API documentation here: https://docs.rs/bat/
481+CHANGELOG.md:390: users need to update their bat config files (`bat --config-file`), if they have any `--map-syntax` settings
482+CHANGELOG.md:407:- `BAT_CACHE_PATH` can be used to place cached `bat` assets in a non-standard path, see #829 (@neuronull)
483+CHANGELOG.md:413:- 'bat cache' still takes precedence over existing files, see #666 (@sharkdp)
484+CHANGELOG.md:425:- Enabled LTO, making `bat` about 10% faster, see #719 (@bolinfest, @sharkdp)
485+CHANGELOG.md:426:- Suggestions non how to configure `bat` for MacOS dark mode, see README (@jerguslejko)
486+CHANGELOG.md:427:- Extended ["Integration with other tools"](https://github.com/sharkdp/bat#integration-with-other-tools) section (@eth-p)
487+CHANGELOG.md:428:- Updated [instrutions on how to use `bat` as a `man`-pager](https://github.com/sharkdp/bat#man), see #652, see #667 (@sharkdp)
488+CHANGELOG.md:456:- `bat` is now in the official Ubuntu and Debian repositories, see #323 and #705 (@MarcoFalke)
489+CHANGELOG.md:457:- `bat` can now be installed via MacPorts, see #675 (@bn3t)
490+CHANGELOG.md:476:- Binary file content can now be viewed with `bat -A`, see #623, #640 (@pjsier and @sharkdp)
491+CHANGELOG.md:477:- `bat` can now be used as a man pager. Take a look at the README and #523 for more details.
492+CHANGELOG.md:506:- `bat` is now in the official Gentoo repositories, see #588 (@toku-sa-n)
493+CHANGELOG.md:507:- `bat` is now in the official Alpine Linux repositories, see #586 (@5paceToast)
494+CHANGELOG.md:508:- `bat` is in the official Fedora repositories, see #610 (@ignatenkobrain)
495+CHANGELOG.md:534:- New ["Integration with other tools"](https://github.com/sharkdp/bat#integration-with-other-tools) section in the README.
496+CHANGELOG.md:544:- `bat` is now available on Chocolatey, see #541 (@rasmuskriest)
497+CHANGELOG.md:554:- **Change the default configuration directory on macOS** to `~/.config/bat`, see #442 (@lavifb). If you are on macOS, you need to copy your configuration directory from the previous place (`~/Library/Preferences/bat`) to the new place (`~/.config/bat`).
498+CHANGELOG.md:559:- Rename `bat cache --init` to `bat cache --build`, see #498
499+CHANGELOG.md:560:- Move the `--config-dir` and `--cache-dir` options from `bat cache` to `bat` and hide them from the help text.
500+CHANGELOG.md:596:- Added `BAT_CONFIG_PATH` environment variable to set a non-default path for `bat`s configuration file, see #375 (@deg4uss3r)
501+CHANGELOG.md:618:- Avoid endless recursion when `PAGER="bat"`, see #383 (@rodorgas)
502+CHANGELOG.md:622:- `bat` is now available on openSUSE, see #405 (@dmarcoux)
503+CHANGELOG.md:651: The configuration file path can be accessed via `bat --config-file`. On Linux,
504+CHANGELOG.md:652: it is stored in `~/.config/bat/config`.
505+CHANGELOG.md:654:- Support for the `BAT_OPTS` environment variable with the same format as specified
506+CHANGELOG.md:664: bat --map-syntax .config:json ...
507+CHANGELOG.md:667: The option can be use multiple times. Note that you can easily make these mappings permanent by using bats new configuration file.
508+CHANGELOG.md:671:- Support pager command-line arguments in `PAGER` and `BAT_PAGER`, see #352 (@Foxboron)
509+CHANGELOG.md:689:- Bat Panics on Haskell Source Code, see #314
510+CHANGELOG.md:695:- Updated documentation on how to configure `bat`s pager
511+CHANGELOG.md:703:- `bat` is now available via [Termux](https://termux.com/), see #341 (@fornwall)
512+CHANGELOG.md:705:- `bat` is now available via [nix](https://nixos.org/nix), see #344 (@mgttlinger)
513+CHANGELOG.md:707:- `bat` is now available via [Docker](https://hub.docker.com/r/danlynn/bat/), see #331 (@danlynn)
514+CHANGELOG.md:717:- Bat Panics on Haskell Source Code, see #314
515+CHANGELOG.md:730: `--tabs` command-line option or the `BAT_TABS` environment variable. The
516+CHANGELOG.md:733:- Added support for the `BAT_STYLE` environment variable, see #208 (@ms2300)
517+CHANGELOG.md:764:- Added README section about "`bat` on Windows" (@Aankhen)
518+CHANGELOG.md:772:- Fixed panic when running `bat --list-languages | head`, see #232 (@mchlrhw)
519+CHANGELOG.md:786:- Major refactorings, enabling some progress on #150. In non-interactive mode, `bat` will now copy input bytes 1:1.
520+CHANGELOG.md:792:- New themes in `$BAT_CONFIG_DIR/themes` are now loaded *in addition* to
521+CHANGELOG.md:798:* Using `bat cache --init` leads to duplicated syntaxes, see #206
522+CHANGELOG.md:811:- The syntax highlighting theme can now be controlled by the `BAT_THEME` environment variable, see [README](https://github.com/sharkdp/bat#highlighting-theme) and #177 (@mandx)
523+CHANGELOG.md:812:- The `PAGER` and `BAT_PAGER` environment variables can be used to control the pager that `bat` uses, see #158 and the [new README section](https://github.com/sharkdp/bat#using-a-different-pager)
524+CHANGELOG.md:818:- The customization of syntax sets and theme sets is now separated. Syntax definitions are now loaded *in addition* to the ones that are stored in the `bat` binary by default. Please refer to these new sections in the README: [Adding new syntaxes](https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions), [Adding new themes](https://github.com/sharkdp/bat#adding-new-themes), also see #172
525+CHANGELOG.md:830:- `bat` is now in the official [Arch package repositories](https://www.archlinux.org/packages/community/x86_64/bat/).
526+CHANGELOG.md:839:- Fix problem with `cargo test` when `bat` is not checked out in a Git repository, see #161
527+CHANGELOG.md:874:- [Comparison with alternative projects](https://github.com/sharkdp/bat/blob/master/doc/alternatives.md).
528+CHANGELOG.md:875:- New "bat" logo in the README, see #119 (@jraulhernandezi)
529+CHANGELOG.md:895: `bat cache`. See `bat cache -h` for all available commands.
530+CHANGELOG.md:900:* Process substitution can now be used with bat (`bat <(echo a) <(echo b)`), see #80
531+CHANGELOG.md:912:- Added a new statically linked version of bat (`..-musl-..`)
532+CONTRIBUTING.md:3:Thank you for considering to contribute to `bat`!
533+CONTRIBUTING.md:9:If your contribution changes the behavior of `bat` (as opposed to a typo-fix
534+CONTRIBUTING.md:12:therefore helps to get your changes into a new `bat` release faster.
535+CONTRIBUTING.md:28:Please check out the [Development](https://github.com/sharkdp/bat#development)
536+CONTRIBUTING.md:35:[feature request ticket](https://github.com/sharkdp/bat/issues/new?assignees=&labels=feature-request&template=feature_request.md)
537+CONTRIBUTING.md:42:the [Customization](https://github.com/sharkdp/bat#customization) section
538+CONTRIBUTING.md:47:[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
539+Cargo.toml:5:homepage = "https://github.com/sharkdp/bat"
540+Cargo.toml:7:name = "bat"
541+Cargo.toml:8:repository = "https://github.com/sharkdp/bat"
542+Cargo.toml:16:# Feature required for bat the application. Should be disabled when depending on
543+Cargo.toml:17:# bat as a library.
544+Cargo.toml:40:# You need to use one of these if you depend on bat as a library:
545+doc/fzf-preview.sh:6: bat \
546+doc/preview.sh:47:bat --color always \
547+doc/assets.md:3:Should you find that a particular syntax is not available within `bat` and think it should be included in `bat` by default, you can follow the instructions outlined below.
548+doc/assets.md:5:`bat` uses the excellent [syntect](https://github.com/trishume/syntect) library to highlight source
549+doc/assets.md:20:3. Run the `assets/create.sh` script. It calls `bat cache --build` to parse all available
550+doc/assets.md:23:4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the
551+doc/assets.md:24: `bat` binary.
552+doc/assets.md:26:5. Use `bat --list-languages` to check if the new languages are available.
553+doc/assets.md:31: file. A new binary cache file will be created once before every new release of `bat`. This
554+doc/assets.md:36:`bat` has a set of syntax highlighting regression tests in `tests/syntax-tests`. The main idea is
555+doc/assets.md:38:for some language is suddenly not working anymore or (2) `bat` suddenly crashes for some input (due
556+doc/assets.md:43:1. Make sure that you are running the **latest version of `bat`** and that `bat` is available on
557+doc/assets.md:45: your version of `bat` already has the new syntax builtin.
558+doc/assets.md:50: be `test.rb` (adapt extension) but can also be adapted if that is necessary in order for `bat` to
559+doc/assets.md:53: under the respective license and that the license is compatible with `bat`s license. If it
560+doc/assets.md:62:6. Use `cat` or `bat --language=txt` to display the content of this file and make sure that the
561+doc/assets.md:70:themes (`bat cache --clear`).
562+doc/README-ja.md:2: <img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
563+doc/README-ja.md:3: <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>
564+doc/README-ja.md:4: <img src="https://img.shields.io/crates/l/bat.svg" alt="license">
565+doc/README-ja.md:5: <a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
566+doc/README-ja.md:16: [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
567+doc/README-ja.md:24:`bat` は多くのプログラミング言語やマークアップ言語の
568+doc/README-ja.md:31:`bat` は `git` とも連携しており、差分を表現する記号が表示されます
569+doc/README-ja.md:45:出力が1つの画面に対して大きすぎる場合、`bat` は自身の出力をページャー(例えば `less`) にパイプで繋げます。
570+doc/README-ja.md:50:`bat` は非対話型のターミナルを検出すると(すなわち他のプロセスにパイプしたりファイル出力していると)、
571+doc/README-ja.md:51:`bat` は `cat` の完全互換として振る舞い、
572+doc/README-ja.md:59:> bat README.md
573+doc/README-ja.md:65:> bat src/*.rs
574+doc/README-ja.md:73:> curl -s https://sh.rustup.rs | bat
575+doc/README-ja.md:79:> yaml2json .travis.yml | json_pp | bat -l json
576+doc/README-ja.md:84:> bat -A /etc/hosts
577+doc/README-ja.md:87:`cat` の代わりに `bat` を使用する際の例:
578+doc/README-ja.md:90:bat > note.md # quickly create a new file
579+doc/README-ja.md:92:bat header.md content.md footer.md > document.md
580+doc/README-ja.md:94:bat -n main.rs # show line numbers (only)
581+doc/README-ja.md:96:bat f - g # output 'f', then stdin, then 'g'.
582+doc/README-ja.md:103:[`fzf`](https://github.com/junegunn/fzf) のプレビューウィンドウに `bat` を使用できます。
583+doc/README-ja.md:104:その場合、`bat` の `--color=always` オプションを用いてカラー出力を強制しなければなりません。
584+doc/README-ja.md:107:fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
585+doc/README-ja.md:114:`find` の `-exec` オプションを使用して、`bat` ですべての検索結果をプレビューできます:
586+doc/README-ja.md:116:find … -exec bat {} +
587+doc/README-ja.md:119:[`fd`](https://github.com/sharkdp/fd) を使用している場合は、`-X` /`-exec-batch` オプションを使用して同じことを行うことができます:
588+doc/README-ja.md:121:fd … -X bat
589+doc/README-ja.md:126:[`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md) では、[`ripgrep`](https://github.com/BurntSushi/ripgrep) 検索結果のプリンターとして `bat` を使用できます。
590+doc/README-ja.md:129:batgrep needle src/
591+doc/README-ja.md:134:`bat` を `tail -f` と組み合わせて、構文強調表示を使用して特定のファイルを継続的に監視できます。
592+doc/README-ja.md:136:tail -f /var/log/pacman.log | bat --paging=never -l log
593+doc/README-ja.md:142:`bat` を `git show` と組み合わせて、
594+doc/README-ja.md:145:git show v0.6.0:src/main.rs | bat -l rs
595+doc/README-ja.md:152:`bat` の出力の行番号と Git 変更マーカーにより、ファイルの内容をコピーするのが難しくなる場合があります。
596+doc/README-ja.md:153:これを防ぐには、`-p` / `-plain` オプションを使用して `bat` を呼び出すか、
597+doc/README-ja.md:156:bat main.cpp | xclip
598+doc/README-ja.md:158:`bat` は出力がリダイレクトされていることを検出し、プレーンファイルの内容を出力します。
599+doc/README-ja.md:162:`bat` は `MANPAGER` 環境変数を設定することにより、
600+doc/README-ja.md:166:export MANPAGER="sh -c 'col -bx | bat -l man -p'"
601+doc/README-ja.md:173:これを新しいコマンドにバンドルしたい場合は [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md) も使用できます。
602+doc/README-ja.md:179:[`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) スクリプトは、コードをフォーマットし、`bat` で印刷するラッパーです。
603+doc/README-ja.md:184:[![Packaging status](https://repology.org/badge/vertical-allrepos/bat.svg)](https://repology.org/project/bat/versions)
604+doc/README-ja.md:189:Ubuntu Eoan 19.10 または Debian 不安定版 sid 以降の [the Ubuntu `bat` package](https://packages.ubuntu.com/eoan/bat) または [the Debian `bat` package](https://packages.debian.org/sid/bat) からインストールできます:
605+doc/README-ja.md:192:apt install bat
606+doc/README-ja.md:195:`apt` を使用して `bat` をインストールした場合、実行可能ファイルの名前が `bat` ではなく `batcat` になることがあります([他のパッケージとの名前衝突のため](https://github.com/sharkdp/bat/issues/982))。`bat -> batcat` のシンボリックリンクまたはエイリアスを設定することで、実行可能ファイル名が異なることによる問題の発生を防ぎ、他のディストリビューションと一貫性を保てます。
607+doc/README-ja.md:199:ln -s /usr/bin/batcat ~/.local/bin/bat
608+doc/README-ja.md:205:batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
609+doc/README-ja.md:208:sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
610+doc/README-ja.md:214:公式のソースから [`bat` package](https://pkgs.alpinelinux.org/packages?name=bat) をインストールできます:
611+doc/README-ja.md:217:apk add bat
612+doc/README-ja.md:222:[Arch Linuxの公式リソース](https://www.archlinux.org/packages/community/x86_64/bat/)
613+doc/README-ja.md:226:pacman -S bat
614+doc/README-ja.md:231:公式の [Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/) リポジトリから [the `bat` package](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506) をインストールできます。
615+doc/README-ja.md:234:dnf install bat
616+doc/README-ja.md:240:[the `bat` package](https://packages.gentoo.org/packages/sys-apps/bat) をインストールできます。
617+doc/README-ja.md:243:emerge sys-apps/bat
618+doc/README-ja.md:248:xbps-install経由で `bat` をインストールできます。
619+doc/README-ja.md:250:xbps-install -S bat
620+doc/README-ja.md:255:pkg を使用してプリコンパイルされた [`bat` package](https://www.freshports.org/textproc/bat) をインストールできます:
621+doc/README-ja.md:258:pkg install bat
622+doc/README-ja.md:264:cd /usr/ports/textproc/bat
623+doc/README-ja.md:270:`bat` を [nix package manager](https://nixos.org/nix) 経由でインストールすることができます:
624+doc/README-ja.md:273:nix-env -i bat
625+doc/README-ja.md:278:`bat` をzypperでインストールすることができます:
626+doc/README-ja.md:281:zypper install bat
627+doc/README-ja.md:286:[Homebrew](http://braumeister.org/formula/bat)で `bat` をインストールできます:
628+doc/README-ja.md:289:brew install bat
629+doc/README-ja.md:292:または [MacPorts](https://ports.macports.org/port/bat/summary) で `bat` をインストールします:
630+doc/README-ja.md:295:port install bat
631+doc/README-ja.md:300:Windowsにbatをインストールするいくつかのオプションがあります。
632+doc/README-ja.md:301:batをインストールしたら [Windowsでのbatの使用](#windows-での-bat-の利用) セクションをご覧ください。
633+doc/README-ja.md:305:[Chocolatey](https://chocolatey.org/packages/Bat) から `bat` をインストールできます:
634+doc/README-ja.md:307:choco install bat
635+doc/README-ja.md:312:[scoop](https://scoop.sh/) から `bat` をインストールできます:
636+doc/README-ja.md:314:scoop install bat
637+doc/README-ja.md:321:[リリースページ](https://github.com/sharkdp/bat/releases) からビルド済みのバイナリをダウンロードできます。
638+doc/README-ja.md:327:コンテナ内で `bat` を使いたい方のために [Docker image](https://hub.docker.com/r/danlynn/bat/) が用意されています:
639+doc/README-ja.md:329:docker pull danlynn/bat
640+doc/README-ja.md:330:alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
641+doc/README-ja.md:339:ansible-galaxy install aeimer.install_bat
642+doc/README-ja.md:344:# Playbook to install bat
643+doc/README-ja.md:347: - aeimer.install_bat
644+doc/README-ja.md:350:- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
645+doc/README-ja.md:351:- [GitHub](https://github.com/aeimer/ansible-install-bat)
646+doc/README-ja.md:364:多くの異なるアーキテクチャのためのプレビルドバージョンを[リリースページ](https://github.com/sharkdp/bat/releases)からチェックしてみてください。静的にリンクされている多くのバイナリも利用できます: ファイル名に `musl` を含むアーカイブを探してみてください。
647+doc/README-ja.md:369:`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
648+doc/README-ja.md:373:cargo install --locked bat
649+doc/README-ja.md:382:`bat --list-themes` を使うと現在利用可能なシンタックスハイライトのテーマを入手できます。
650+doc/README-ja.md:384:`--theme=TwoDark` オプションをつけるか `BAT_THEME` という環境変数に
651+doc/README-ja.md:385:`TwoDark` を代入する必要があります。 シェルの起動ファイルに `export BAT_THEME="TwoDark"`
652+doc/README-ja.md:386:と定義すればその設定が変わることはないでしょう。あるいは、 `bat` の
653+doc/README-ja.md:392:bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
654+doc/README-ja.md:395:`bat` はデフォルトだと黒い背景色のターミナルに適しています。
655+doc/README-ja.md:402:`--style` を使うことで `bat` の表示の見た目を変更することができます。
656+doc/README-ja.md:405:環境変数に `BAT_STYLE` を定義するとこれらの設定を永続的に使用することができます。
657+doc/README-ja.md:410:`bat` はシンタックスハイライトのための [`syntect`](https://github.com/trishume/syntect/)
658+doc/README-ja.md:418:mkdir -p "$(bat --config-dir)/syntaxes"
659+doc/README-ja.md:419:cd "$(bat --config-dir)/syntaxes"
660+doc/README-ja.md:429:bat cache --build
661+doc/README-ja.md:432:最後に `bat --list-languages` と入力すると新しい言語が利用可能かどうかチェックします。
662+doc/README-ja.md:437:bat cache --clear
663+doc/README-ja.md:446:mkdir -p "$(bat --config-dir)/themes"
664+doc/README-ja.md:447:cd "$(bat --config-dir)/themes"
665+doc/README-ja.md:453:bat cache --build
666+doc/README-ja.md:456:最後に、 `bat --list-themes` で新しいテーマが利用可能かチェックします
667+doc/README-ja.md:460:`bat` は環境変数 `PAGER` に使用するページャーを明記します。
668+doc/README-ja.md:463:または、`PAGER` を上書きする環境変数として `BAT_PAGER` を定義することも可能です。
669+doc/README-ja.md:466:`PAGER`/`BAT_PAGER` 環境変数を定義してください:
670+doc/README-ja.md:469:export BAT_PAGER="less -RF"
671+doc/README-ja.md:472:環境変数を利用する代わりに、 `bat` の [設定ファイル](#設定ファイル) を使用して設定も可能です(`--pager` オプション)
672+doc/README-ja.md:475:`bat` はページャーの以下のコマンドラインオプション を受け付けるでしょう:
673+doc/README-ja.md:491:macOSでダークモード機能を使用する場合、OSテーマに基づいて異なるテーマを使用するように `bat` を構成することができます。
674+doc/README-ja.md:496:alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
675+doc/README-ja.md:501:`bat` は設定ファイルでカスタマイズすることが可能です。ファイルの場所はOSに依存します。
676+doc/README-ja.md:504:bat --config-file
677+doc/README-ja.md:507:または、`BAT_CONFIG_PATH` 環境変数を使用して、`bat` が
678+doc/README-ja.md:510:export BAT_CONFIG_PATH="/path/to/bat.conf"
679+doc/README-ja.md:515:この設定ファイルはコマンドライン引数の単純なリストです。 `bat --help` を利用すると、利用可能なオプションとその値を閲覧することができます。さらに、`#` でコメント文を加えることができます。
680+doc/README-ja.md:535:## Windows での `bat` の利用
681+doc/README-ja.md:537:Windows 上で `bat` はほとんど動作しますが、いくつかの機能は設定を必要をする場合があります。
682+doc/README-ja.md:555:`BAT_PAGER` に空文字を設定することでページングを完全に無効にできます。
683+doc/README-ja.md:559:Windows上の `bat` は Cygwin のunix風のpath(`/cygdrive/*`)をネイティブサポートしていません。絶対的なcygwinパスを引数として受けたときに、 `bat` は以下のエラーを返すでしょう: `The system cannot find the path specified. (os error 3)`
684+doc/README-ja.md:564:bat() {
685+doc/README-ja.md:573: command bat "${args[@]}"
686+doc/README-ja.md:581:`bat` はターミナルがトゥルーカラーをサポートしている/していないに関係なくサポートします。
687+doc/README-ja.md:588:`24bit` のどちらかを代入してください。さもなければ、`bat` はどの色を使うのか決定することができません。または、24-bit エスケープシーケンスがサポートされません
688+doc/README-ja.md:593:異なるテーマを試してみてください(`bat --list-themes` でテーマを閲覧できます)。
689+doc/README-ja.md:598:`bat` は UTF-16 と同様に UTF-8 をネイティブにサポートします。
690+doc/README-ja.md:603:iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
691+doc/README-ja.md:605:注: `bat` が構文を自動検出できない場合は
692+doc/README-ja.md:612:git clone --recursive https://github.com/sharkdp/bat
693+doc/README-ja.md:615:cd bat
694+doc/README-ja.md:624:# Build a bat binary with modified syntaxes and themes
695+doc/README-ja.md:636:`bat` は以下の目標を達成しようと試みています:
696+doc/README-ja.md:647:Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
697+doc/README-ja.md:649:`bat` は MIT License 及び Apache License 2.0 の両方の条件の下で配布されています。
698+doc/README-ko.md:2: <img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
699+doc/README-ko.md:3: <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>
700+doc/README-ko.md:4: <img src="https://img.shields.io/crates/l/bat.svg" alt="license">
701+doc/README-ko.md:5: <a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
702+doc/README-ko.md:16: [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
703+doc/README-ko.md:24:`bat`은 다양한 프로그래밍 및 마크업 언어의 문법 강조(syntax highlighting) 기능을
704+doc/README-ko.md:31:`bat`은 `git`을 통해 인덱스와 함께 변경분을 표시합니다
705+doc/README-ko.md:44:`bat`은 기본적으로 한 화면에 비해 출력이 큰 경우 `less`와 같은 페이저(pager)로
706+doc/README-ko.md:46:만약 `bat`을 언제나 `cat`처럼 작동하게 하려면 (출력을 페이지하지 않기),
707+doc/README-ko.md:48:셸(shell) 설정에서 `cat`을 `bat`의 alias로 사용하려면,
708+doc/README-ko.md:49:`alias cat='bat --paging=never'`를 써서 기본 행동을 유지할 수 있습니다.
709+doc/README-ko.md:53:페이저(pager)를 사용하더라도 `bat`은 파일들을 연결(concatenate)할 수 있습니다
710+doc/README-ko.md:55:`bat`이 비대화형(non-interactive) 터미널(예를 들어, 다른 프로세스나 파일에
711+doc/README-ko.md:56:연결(pipe)한 경우)을 감지하면, `bat`은 `--pager` 옵션의 값과 상관없이 `cat`과
712+doc/README-ko.md:64:> bat README.md
713+doc/README-ko.md:70:> bat src/*.rs
714+doc/README-ko.md:78:> curl -s https://sh.rustup.rs | bat
715+doc/README-ko.md:84:> yaml2json .travis.yml | json_pp | bat -l json
716+doc/README-ko.md:89:> bat -A /etc/hosts
717+doc/README-ko.md:95:bat > note.md # quickly create a new file
718+doc/README-ko.md:97:bat header.md content.md footer.md > document.md
719+doc/README-ko.md:99:bat -n main.rs # show line numbers (only)
720+doc/README-ko.md:101:bat f - g # output 'f', then stdin, then 'g'.
721+doc/README-ko.md:108:`bat`을 [`fzf`](https://github.com/junegunn/fzf)의 프리뷰로 쓸 수 있습니다.
722+doc/README-ko.md:109:이를 위해서는 `bat`의 `--color=always` 옵션으로 항상 컬러 출력이 나오게 해야
723+doc/README-ko.md:113:fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
724+doc/README-ko.md:120:`find`의 `-exec` 옵션을 사용하여 모든 검색 결과를 `bat`로 미리 볼 수 있습니다:
725+doc/README-ko.md:122:find … -exec bat {} +
726+doc/README-ko.md:125:[`fd`](https://github.com/sharkdp/fd)를 사용하는 경우, `-X`/`--exec-batch`
727+doc/README-ko.md:128:fd … -X bat
728+doc/README-ko.md:133:[`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)을
729+doc/README-ko.md:134:통해 `bat`로 [`ripgrep`](https://github.com/BurntSushi/ripgrep)의 검색 결과를
730+doc/README-ko.md:138:batgrep needle src/
731+doc/README-ko.md:143:`bat`와 `tail -f`를 함께 사용하여 주어진 파일을 문법 강조하며 지속적으로
732+doc/README-ko.md:146:tail -f /var/log/pacman.log | bat --paging=never -l log
733+doc/README-ko.md:154:`bat`과 `git show`를 함께 사용하여 주어진 파일의 이전 버전을 올바른 문법 강조로
734+doc/README-ko.md:157:git show v0.6.0:src/main.rs | bat -l rs
735+doc/README-ko.md:162:`bat`과 `git diff`를 함께 사용하여 수정된 코드 주위의 줄들을 올바른 문법 강조로
736+doc/README-ko.md:165:batdiff() {
737+doc/README-ko.md:166: git diff --name-only --diff-filter=d | xargs bat --diff
738+doc/README-ko.md:170:[`bat-extras`](https://github.com/eth-p/bat-extras)의 `batdiff`를 확인해 보세요.
739+doc/README-ko.md:177:`bat` 출력에 줄 번호와 Git 수정 내역이 포함되어서 파일의 내용을 복사하기
740+doc/README-ko.md:179:이 경우에는 `bat`의 `-p`/`--plain` 옵션을 사용하거나 간단히 `xclip`으로 출력을
741+doc/README-ko.md:182:bat main.cpp | xclip
742+doc/README-ko.md:184:`bat`는 출력이 우회되고 있다는 것을 감지하여 파일 내용 그대로를 출력합니다.
743+doc/README-ko.md:188:`MANPAGER` 환경 변수 설정을 통해 `bat`을 `man`의 컬러 페이저(pager)로 쓸 수
744+doc/README-ko.md:192:export MANPAGER="sh -c 'col -bx | bat -l man -p'"
745+doc/README-ko.md:195:(Debian이나 Ubuntu를 사용한다면 `bat`을 `batcat`으로 치환하세요.)
746+doc/README-ko.md:200:[`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)을 쓸
747+doc/README-ko.md:207:[작동하지 않습니다](https://github.com/sharkdp/bat/issues/1145).
748+doc/README-ko.md:211:[`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md)
749+doc/README-ko.md:212:스크립트는 코드를 포맷하고 `bat`으로 출력하는 래퍼(wrapper)입니다.
750+doc/README-ko.md:217:[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions)
751+doc/README-ko.md:222:`bat`은 [Ubuntu](https://packages.ubuntu.com/eoan/bat)와
752+doc/README-ko.md:223:[Debian](https://packages.debian.org/sid/bat) 패키지 배포 과정에 도입되는 중이며,
753+doc/README-ko.md:225:현재 Debain에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다.
754+doc/README-ko.md:230:apt install bat
755+doc/README-ko.md:233:**중요**: 만약 `bat`을 이와 같이 설치한다면, ([다른 패키지와의 이름
756+doc/README-ko.md:234:충돌](https://github.com/sharkdp/bat/issues/982)로 인하여) `bat` 대신에
757+doc/README-ko.md:235:`batcat`이라는 이름의 실행 파일로 설치될 수 있음을 참고하세요.
758+doc/README-ko.md:236:이에 따른 문제들과 다른 배포판들과의 일관성을 위하여 `bat -> batcat` symlink
759+doc/README-ko.md:240:ln -s /usr/bin/batcat ~/.local/bin/bat
760+doc/README-ko.md:247:`bat`을 원한다면, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서
761+doc/README-ko.md:251:sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
762+doc/README-ko.md:257:[`bat` 패키지](https://pkgs.alpinelinux.org/packages?name=bat)를 설치할 수
763+doc/README-ko.md:261:apk add bat
764+doc/README-ko.md:267:[`bat` 패키지](https://www.archlinux.org/packages/community/x86_64/bat/)를
765+doc/README-ko.md:271:pacman -S bat
766+doc/README-ko.md:279:[`bat` 패키지](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506)를
767+doc/README-ko.md:283:dnf install bat
768+doc/README-ko.md:288:dev-kit을 통해 [`bat` 패키지](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat)를 설치할 수 있습니다:
769+doc/README-ko.md:291:emerge sys-apps/bat
770+doc/README-ko.md:297:[`bat` 패키지](https://packages.gentoo.org/packages/sys-apps/bat)를 설치할 수
771+doc/README-ko.md:301:emerge sys-apps/bat
772+doc/README-ko.md:306:xbps-install을 이용해 `bat`을 설치할 수 있습니다:
773+doc/README-ko.md:308:xbps-install -S bat
774+doc/README-ko.md:313:pkg를 이용해 `bat`을 설치할 수 있습니다:
775+doc/README-ko.md:315:pkg install bat
776+doc/README-ko.md:321:[`bat` 패키지](https://www.freshports.org/textproc/bat)를 설치할 수 있습니다:
777+doc/README-ko.md:324:pkg install bat
778+doc/README-ko.md:330:cd /usr/ports/textproc/bat
779+doc/README-ko.md:336:[nix package manager](https://nixos.org/nix)를 이용해 `bat`을 설치할 수
780+doc/README-ko.md:340:nix-env -i bat
781+doc/README-ko.md:345:zypper를 이용해 `bat`을 설치할 수 있습니다:
782+doc/README-ko.md:348:zypper install bat
783+doc/README-ko.md:355:[문제](https://github.com/sharkdp/bat/issues/1519)가 있을 수 있습니다.
784+doc/README-ko.md:360:[macOS의 Homebrew](https://formulae.brew.sh/formula/bat) 또는
785+doc/README-ko.md:361:[Linux의 Homebrew](https://formulae.brew.sh/formula-linux/bat)를 이용하여
786+doc/README-ko.md:362:`bat`을 설치할 수 있습니다.
787+doc/README-ko.md:365:brew install bat
788+doc/README-ko.md:370:[MacPorts](https://ports.macports.org/port/bat/summary)를 이용하여 `bat`을
789+doc/README-ko.md:374:port install bat
790+doc/README-ko.md:379:Windows에서 `bat`을 설치할 수 있는 몇 가지 옵션들이 있습니다.
791+doc/README-ko.md:380:먼저 `bat`을 설치한 후,
792+doc/README-ko.md:381:["Windows에서 `bat` 사용하기"](#windows에서-bat-사용하기) 섹션을 살펴보세요.
793+doc/README-ko.md:390:[Chocolatey](https://chocolatey.org/packages/Bat)를 이용해 `bat`을 설치할 수
794+doc/README-ko.md:393:choco install bat
795+doc/README-ko.md:398:[scoop](https://scoop.sh/)을 이용해 `bat`을 설치할 수 있습니다:
796+doc/README-ko.md:400:scoop install bat
797+doc/README-ko.md:405:[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 사전 빌드된
798+doc/README-ko.md:413:[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다양한 아키텍처를
799+doc/README-ko.md:419:`bat`의 소스를 빌드하기 위해서는, Rust 1.46 이상이 필요합니다.
800+doc/README-ko.md:423:cargo install --locked bat
801+doc/README-ko.md:435:`bat --list-themes`을 사용하여 사용 가능한 문법 강조 테마들의 목록을 확인할 수
802+doc/README-ko.md:437:`TwoDark` 테마를 선택하려면, `--theme=TwoDark` 옵션과 함께 `bat`을 사용하거나
803+doc/README-ko.md:438:`BAT_THEME` 환경 변수를 `TwoDark`로 설정하세요.
804+doc/README-ko.md:439:셸 시작 파일에 `export BAT_THEME="TwoDark"` 를 정의해 영구적으로 설정할 수
805+doc/README-ko.md:441:이 밖에 `bat`의 [설정 파일](#설정-파일)을 이용할 수 있습니다.
806+doc/README-ko.md:447:bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
807+doc/README-ko.md:450:`bat`은 기본적으로 어두운 배경에 적합합니다.
808+doc/README-ko.md:458:`bat`은 트루컬러 지원이 되더라도 항상
809+doc/README-ko.md:478:- 만약 터미널 테마를 바꾼다면, 이미 화면 상의 `bat`의 출력도 이에 맞추어
810+doc/README-ko.md:483:`--style` 옵션을 이용하면 `bat`의 출력 모양을 조절할 수 있습니다.
811+doc/README-ko.md:486:`BAT_STYLE` 환경 변수를 정의하여 이러한 수정을 영구적으로 하거나 `bat`의
812+doc/README-ko.md:491:만약 `bat`에서 특정 문법이 지원되지 않을 경우, 다음의 절차를 통해 현재 `bat`
813+doc/README-ko.md:494:`bat`은 문법 강조를 위해 훌륭한
814+doc/README-ko.md:506: mkdir -p "$(bat --config-dir)/syntaxes"
815+doc/README-ko.md:507: cd "$(bat --config-dir)/syntaxes"
816+doc/README-ko.md:517: bat cache --build
817+doc/README-ko.md:520:3. 마지막으로, `bat --list-languages`로 새로 추가한 언어가 사용 가능한지
818+doc/README-ko.md:526: bat cache --clear
819+doc/README-ko.md:529:4. 만약 특정 문법이 `bat`에 기본적으로 포함되어 있어야 한다고 생각한다면, 방침과
820+doc/README-ko.md:531: 주세요: [문법 요청하기](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md).
821+doc/README-ko.md:539:mkdir -p "$(bat --config-dir)/themes"
822+doc/README-ko.md:540:cd "$(bat --config-dir)/themes"
823+doc/README-ko.md:546:bat cache --build
824+doc/README-ko.md:549:마지막으로 `bat --list-themes`을 통해 새로 추가한 테마들이 사용 가능한지
825+doc/README-ko.md:559:(`bat --list-languages`를 통해 개요를 확인하세요).
826+doc/README-ko.md:561:참고: 이 옵션은 커맨드 라인에 넘겨 주는 것보다는 `bat`의 설정 파일에 넣는 것이
827+doc/README-ko.md:584:`bat`은 환경 변수 `PAGER`에 명시된 페이저를 사용합니다.
828+doc/README-ko.md:586:만약 다른 페이저를 사용하고 싶다면, `PAGER` 변수를 수정하거나 `BAT_PAGER` 환경
829+doc/README-ko.md:589:만약 커맨드라인 인수들을 페이저에게 넘겨 주려면, `PAGER`/`BAT_PAGER` 변수로
830+doc/README-ko.md:593:export BAT_PAGER="less -RF"
831+doc/README-ko.md:596:환경 변수를 사용하는 대신, `bat`의 [설정 파일](#설정-파일)로 페이저를 설정할
832+doc/README-ko.md:600:옵션이 지정되어 있지 않다면), `bat`은 다음 옵션들을 페이저로 넘겨줍니다:
833+doc/README-ko.md:619:`bat`은 페이저에 의존하지 않고 탭을 4 스페이스로 확장합니다.
834+doc/README-ko.md:623:**참고**: (`bat`의 `--pager` 인자 혹은 `less`의 `LESS` 환경 변수를 통해)
835+doc/README-ko.md:627:`bat`을 `--tabs=0`과 함께 호출하면 이를 오버라이드하여 페이저가 탭을 처리하게
836+doc/README-ko.md:632:macOS에서 다크 모드를 사용하고 있다면, `bat`가 OS 테마에 따라 다른 테마를
837+doc/README-ko.md:638:alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
838+doc/README-ko.md:643:`bat`는 설정 파일로도 사용자화 할 수 있습니다.
839+doc/README-ko.md:647:bat --config-file
840+doc/README-ko.md:650:또는, `BAT_CONFIG_PATH` 환경 변수를 사용하여 `bat`가 설정 파일의 기본 경로
841+doc/README-ko.md:653:export BAT_CONFIG_PATH="/path/to/bat.conf"
842+doc/README-ko.md:658:bat --generate-config-file
843+doc/README-ko.md:664:`bat --help`로 가능한 모든 옵션과 값들을 확인하세요.
844+doc/README-ko.md:682:## Windows에서 `bat` 사용하기
845+doc/README-ko.md:684:`bat`는 대부분의 경우 Windows에서 기본적으로 잘 작동하지만, 일부 기능은 추가적인
846+doc/README-ko.md:715:`BAT_PAGER`을 빈 문자열로 설정하여 페이징을 완전히 비활성화 할 수 있습니다.
847+doc/README-ko.md:719:Windows에서의 `bat`은 기본적으로 Cygwin의 unix 스타일 경로(`/cygdrive/*`)를
848+doc/README-ko.md:721:Cygwin 절대 경로를 인자로 받았을 때, `bat`은 다음과 같은 오류를 반환합니다:
849+doc/README-ko.md:728:bat() {
850+doc/README-ko.md:737: command bat "${args[@]}"
851+doc/README-ko.md:745:`bat`은 터미널의 트루컬러 지원 여부와 상관 없이 동작합니다.
852+doc/README-ko.md:754:그렇지 않을 경우, `bat`은 24비트 확장열(escape sequence)이 지원되는지 여부를
853+doc/README-ko.md:759:다른 테마를 사용해 보세요 (`bat --list-themes`에서 목록을 볼 수 있습니다).
854+doc/README-ko.md:764:`bat`은 기본적으로 UTF-8과 UTF-16을 지원합니다.
855+doc/README-ko.md:770:iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
856+doc/README-ko.md:772:참고: `bat`으로 문법 자동 감지가 되지 않는 경우에는 `-l`/`--language` 옵션을
857+doc/README-ko.md:779:git clone --recursive https://github.com/sharkdp/bat
858+doc/README-ko.md:782:cd bat
859+doc/README-ko.md:791:# 수정된 문법과 테마가 적용된 bat 바이너리 빌드
860+doc/README-ko.md:796:`bat`의 pretty-printing 기능을 라이브러리로 사용하는 애플리케이션을 만들고
861+doc/README-ko.md:797:싶다면, [API 문서](https://docs.rs/bat/)를 살펴보세요.
862+doc/README-ko.md:798:참고로 `bat`에 라이브러리로써 의존한다면, `regex-onig`나 `regex-fancy`를
863+doc/README-ko.md:814:만약 `bat`의 취약점을 발견하였다면, [David Peter](https://david-peter.de/)에게 메일로 연락주시기 바랍니다.
864+doc/README-ko.md:818:`bat`은 다음과 같은 목표를 달성하려고 합니다:
865+doc/README-ko.md:829:Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
866+doc/README-ko.md:831:`bat`는 여러분의 선택에 따라 MIT 라이센스 또는 Apache 라이센스 2.0의 조건에 따라
867+doc/alternatives.md:3:The following table tries to give an overview *from `bat`s perspective*, i.e. we only compare
868+doc/alternatives.md:4:categories which are relevant for `bat`. Some of these projects have completely different goals and
869+doc/alternatives.md:5:if you are not looking for a program like `bat`, this comparison might not be for you.
870+doc/alternatives.md:7:| | bat | [pygments](http://pygments.org/) | [highlight](http://www.andre-simon.de/doku/highlight/highlight.php) | [ccat](https://github.com/jingweno/ccat) | [source-highlight](https://www.gnu.org/software/src-highlite/) | [hicat](https://github.com/rstacruz/hicat) | [coderay](https://github.com/rubychan/coderay) | [rouge](https://github.com/jneen/rouge) |
871+doc/alternatives.md:9:| Drop-in `cat` replacement | :heavy_check_mark: [*](https://github.com/sharkdp/bat/issues/134) | :x: | :x: | (:heavy_check_mark:) | :x: | :x: [*](https://github.com/rstacruz/hicat/issues/6) | :x: | :x: |
872+doc/alternatives.md:43:cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
873+doc/alternatives.md:44:cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
874+doc/alternatives.md:54: "$cmd_bat" \
875+doc/alternatives.md:55: "$cmd_bat_simple" \
876+doc/README-ru.md:2: <img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
877+doc/README-ru.md:3: <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>
878+doc/README-ru.md:4: <img src="https://img.shields.io/crates/l/bat.svg" alt="license">
879+doc/README-ru.md:5: <a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
880+doc/README-ru.md:16: [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
881+doc/README-ru.md:24:`bat` поддерживает выделение синтаксиса для огромного количества языков программирования и разметки:
882+doc/README-ru.md:29:`bat` использует `git`, чтобы показать изменения в коде
883+doc/README-ru.md:42:`bat` умеет перенаправлять вывод в `less`, если вывод не помещается на экране полностью.
884+doc/README-ru.md:47:`bat` обнаружит неинтерактивный терминал (например, когда вы перенаправляете вывод в файл или процесс), он будет работать как утилита `cat` и выведет содержимое файлов как обычный текст (без подсветки синтаксиса).
885+doc/README-ru.md:54:> bat README.md
886+doc/README-ru.md:60:> bat src/*.rs
887+doc/README-ru.md:66:> curl -s https://sh.rustup.rs | bat
888+doc/README-ru.md:72:> yaml2json .travis.yml | json_pp | bat -l json
889+doc/README-ru.md:77:> bat -A /etc/hosts
890+doc/README-ru.md:83:bat > note.md # мгновенно создаем новый файл
891+doc/README-ru.md:85:bat header.md content.md footer.md > document.md
892+doc/README-ru.md:87:bat -n main.rs # показываем только количество строк
893+doc/README-ru.md:89:bat f - g # выводит 'f' в stdin, а потом 'g'.
894+doc/README-ru.md:96:Вы можете использовать флаг `-exec` в `find`, чтобы посмотреть превью всех файлов в `bat`
895+doc/README-ru.md:98:find … -exec bat {} +
896+doc/README-ru.md:101:Если вы используете [`fd`](https://github.com/sharkdp/fd), применяйте для этого флаг `-X`/`--exec-batch`:
897+doc/README-ru.md:103:fd … -X bat
898+doc/README-ru.md:108:С помощью [`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md), `bat` может быть использован для вывода результата запроса [`ripgrep`](https://github.com/BurntSushi/ripgrep)
899+doc/README-ru.md:111:batgrep needle src/
900+doc/README-ru.md:116:`bat` может быть использован вместе с `tail -f`, чтобы выводить содержимое файла с подсветкой синтаксиса в реальном времени.
901+doc/README-ru.md:118:tail -f /var/log/pacman.log | bat --paging=never -l log
902+doc/README-ru.md:124:Вы можете использовать `bat` с `git show`, чтобы просмотреть старую версию файла с выделением синтаксиса:
903+doc/README-ru.md:126:git show v0.6.0:src/main.rs | bat -l rs
904+doc/README-ru.md:136:bat main.cpp | xclip
905+doc/README-ru.md:138:`bat` обнаружит перенаправление вывода и выведет обычный текст без выделения синтаксиса.
906+doc/README-ru.md:142:`bat` может быть использован в виде выделения цвета для `man`, для этого установите переменную окружения
907+doc/README-ru.md:146:export MANPAGER="sh -c 'col -bx | bat -l man -p'"
908+doc/README-ru.md:152:Если вы хотите сделать этой одной командой, вы можете использовать [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
909+doc/README-ru.md:158:[`Prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) — скрипт, который форматирует код и выводит его с помощью `bat`.
910+doc/README-ru.md:163:[![Packaging status](https://repology.org/badge/vertical-allrepos/bat.svg)](https://repology.org/project/bat/versions)
911+doc/README-ru.md:168:`bat` есть в репозиториях [Ubuntu](https://packages.ubuntu.com/eoan/bat) и
912+doc/README-ru.md:169:[Debian](https://packages.debian.org/sid/bat) и доступен начиная с Ubuntu Eoan 19.10. На Debian `bat` пока что доступен только с нестабильной веткой "Sid".
913+doc/README-ru.md:171:Если ваша версия Ubuntu/Debian достаточно новая, вы можете установить `bat` так:
914+doc/README-ru.md:174:apt install bat
915+doc/README-ru.md:177:Если вы установили `bat` таким образом, то бинарный файл может быть установлен как `batcat` вместо `bat` (из-за [конфликта имени с другим пакетом](https://github.com/sharkdp/bat/issues/982)). Вы можете сделать симлинк или алиас `bat -> batcat`, чтобы предотвратить подобные проблемы и в других дистрибутивах.
916+doc/README-ru.md:181:ln -s /usr/bin/batcat ~/.local/bin/bat
917+doc/README-ru.md:187:Если пакет еще недоступен в вашем Ubuntu/Debian дистрибутиве или вы хотите установить самую последнюю версию `bat`, то вы можете скачать самый последний `deb`-пакет отсюда:
918+doc/README-ru.md:188:[release page](https://github.com/sharkdp/bat/releases) и установить так:
919+doc/README-ru.md:191:sudo dpkg -i bat_0.18.3_amd64.deb # измените архитектуру и версию
920+doc/README-ru.md:196:Вы можете установить [`bat`](https://pkgs.alpinelinux.org/packages?name=bat) из официальных источников:
921+doc/README-ru.md:199:apk add bat
922+doc/README-ru.md:204:Вы можете установить [`bat`](https://www.archlinux.org/packages/community/x86_64/bat/) из официального источника:
923+doc/README-ru.md:207:pacman -S bat
924+doc/README-ru.md:212:Вы можете установить [`bat`](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506) из официального репозитория [Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/).
925+doc/README-ru.md:215:dnf install bat
926+doc/README-ru.md:220:Вы можете установить [`bat`](https://packages.gentoo.org/packages/sys-apps/bat) из официальных источников:
927+doc/README-ru.md:223:emerge sys-apps/bat
928+doc/README-ru.md:228:Вы можете установить `bat` с помощью `xbps-install`:
929+doc/README-ru.md:230:xbps-install -S bat
930+doc/README-ru.md:235:Вы можете установить [`bat`](https://www.freshports.org/textproc/bat) с помощью `pkg`:
931+doc/README-ru.md:238:pkg install bat
932+doc/README-ru.md:244:cd /usr/ports/textproc/bat
933+doc/README-ru.md:250:Вы можете установить `bat`, используя [nix package manager](https://nixos.org/nix):
934+doc/README-ru.md:253:nix-env -i bat
935+doc/README-ru.md:258:Вы можете установить `bat` с помощью `zypper`:
936+doc/README-ru.md:261:zypper install bat
937+doc/README-ru.md:266:Вы можете установить `bat` с помощью [Homebrew](http://braumeister.org/formula/bat):
938+doc/README-ru.md:269:brew install bat
939+doc/README-ru.md:272:Или же установить его с помощью [MacPorts](https://ports.macports.org/port/bat/summary):
940+doc/README-ru.md:275:port install bat
941+doc/README-ru.md:280:Есть несколько способов установить `bat`. Как только вы установили его, посмотрите на секцию ["Использование `bat` в Windows"](#using-bat-on-windows).
942+doc/README-ru.md:284:Вы можете установить `bat` с помощью [Chocolatey](https://chocolatey.org/packages/Bat):
943+doc/README-ru.md:286:choco install bat
944+doc/README-ru.md:291:Вы можете установить `bat` с помощью [scoop](https://scoop.sh/):
945+doc/README-ru.md:293:scoop install bat
946+doc/README-ru.md:300:Их вы можете скачать на [странице релизов](https://github.com/sharkdp/bat/releases).
947+doc/README-ru.md:306:Вы можете использовать [Docker image](https://hub.docker.com/r/danlynn/bat/), чтобы запустить `bat` в контейнере:
948+doc/README-ru.md:308:docker pull danlynn/bat
949+doc/README-ru.md:309:alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
950+doc/README-ru.md:314:Вы можете установить `bat` с [Ansible](https://www.ansible.com/):
951+doc/README-ru.md:318:ansible-galaxy install aeimer.install_bat
952+doc/README-ru.md:323:# Playbook для установки bat
953+doc/README-ru.md:326: - aeimer.install_bat
954+doc/README-ru.md:329:- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
955+doc/README-ru.md:330:- [GitHub](https://github.com/aeimer/ansible-install-bat)
956+doc/README-ru.md:342:Перейдите на [страницу релизов](https://github.com/sharkdp/bat/releases) для
957+doc/README-ru.md:343:скомпилированных файлов `bat` для различных платформ. Бинарные файлы со статической связкой так же доступны: выбирайте архив с `musl` в имени.
958+doc/README-ru.md:347:Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.46 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
959+doc/README-ru.md:350:cargo install --locked bat
960+doc/README-ru.md:357:Используйте `bat --list-themes`, чтобы вывести список всех доступных тем. Для выбора темы `TwoDark` используйте `bat` с флагом
961+doc/README-ru.md:358:`--theme=TwoDark` или выставьте переменную окружения `BAT_THEME` в `TwoDark`. Используйте `export BAT_THEME="TwoDark"` в конфигурационном файле вашей оболочки, чтобы изменить ее навсегда. Или же используйте [конфигурационный файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
962+doc/README-ru.md:362:bat --list-themes | fzf --preview="bat --theme={} --color=always /путь/к/файлу"
963+doc/README-ru.md:365:`bat` отлично смотрится на темном фоне. Однако если ваш терминал использует светлую тему, то такие темы как `GitHub` или `OneHalfLight` будут смотреться куда лучше!
964+doc/README-ru.md:366:Вы также можете использовать новую тему, для этого перейдите [в раздел добавления тем](https://github.com/sharkdp/bat#добавление-новых-тем).
965+doc/README-ru.md:370:Вы можете использовать флаг `--style`, чтобы изменять внешний вид вывода в `bat`.
966+doc/README-ru.md:371:Например, вы можете использовать `--style=numbers,changes`, чтобы показать только количество строк и изменений в Git. Установите переменную окружения `BAT_STYLE` чтобы изменить это навсегда, или используйте [конфиг файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
967+doc/README-ru.md:375:`bat` использует [`syntect`](https://github.com/trishume/syntect/) для выделения синтаксиса. `syntect` может читать
968+doc/README-ru.md:382:mkdir -p "$(bat --config-dir)/syntaxes"
969+doc/README-ru.md:383:cd "$(bat --config-dir)/syntaxes"
970+doc/README-ru.md:393:bat cache --build
971+doc/README-ru.md:396:Теперь вы можете использовать `bat --list-languages`, чтобы проверить, доступны ли новые языки.
972+doc/README-ru.md:401:bat cache --clear
973+doc/README-ru.md:410:mkdir -p "$(bat --config-dir)/themes"
974+doc/README-ru.md:411:cd "$(bat --config-dir)/themes"
975+doc/README-ru.md:417:bat cache --build
976+doc/README-ru.md:420:Теперь используйте `bat --list-themes`, чтобы проверить доступность новых тем.
977+doc/README-ru.md:424:`bat` использует пейджер, указанный в переменной окружения `PAGER`. Если она не задана, то используется `less`.
978+doc/README-ru.md:425:Если вы желаете использовать другой пейджер, вы можете либо изменить переменную `PAGER`, либо `BAT_PAGER` чтобы перезаписать то, что указано в `PAGER`.
979+doc/README-ru.md:430:export BAT_PAGER="less -RF"
980+doc/README-ru.md:433:Так же вы можете использовать [файл конфигурации](https://github.com/sharkdp/bat#configuration-file) `bat` (флаг `--pager`).
981+doc/README-ru.md:436:`bat` задаст следующие флаги для пейджера:
982+doc/README-ru.md:449:Если вы используете темный режим в macOS, возможно вы захотите чтобы `bat` использовал другую тему, основанную на теме вашей ОС. Следующий сниппет использует тему `default`, когда у вас включен темный режим, и тему `GitHub`, когда включен светлый.
983+doc/README-ru.md:452:alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
984+doc/README-ru.md:457:`bat` также может быть кастомизирован с помощью файла конфигурации. Его местоположение зависит от вашей ОС: чтобы посмотреть его путь, введите
985+doc/README-ru.md:459:bat --config-file
986+doc/README-ru.md:462:Также вы можете установить переменную окружения `BAT_CONFIG_PATH`, чтобы изменить путь к файлу конфигурации.
987+doc/README-ru.md:464:export BAT_CONFIG_PATH="/path/to/bat.conf"
988+doc/README-ru.md:469:bat --generate-config-file
989+doc/README-ru.md:474:Файл конфигурации - это всего лишь набор аргументов. Введите `bat --help`, чтобы просмотреть список всех возможных флагов и аргументов. Также вы можете закомментировать строку с помощью `#`.
990+doc/README-ru.md:494:## Использование `bat` в Windows
991+doc/README-ru.md:496:`bat` полностью работоспособен "из коробки", но для некоторых возможностей могут понадобиться дополнительные настройки.
992+doc/README-ru.md:509:или установить `BAT_PAGER` равным пустой строке.
993+doc/README-ru.md:513:Из коробки `bat` не поддерживает пути в стиле Unix (`/cygdrive/*`). Когда указан абсолютный путь cygwin, `bat` выдаст следующую ошибку: `The system cannot find the path specified. (os error 3)`
994+doc/README-ru.md:518:bat() {
995+doc/README-ru.md:527: command bat "${args[@]}"
996+doc/README-ru.md:535:`bat` поддерживает терминалы *с* и *без* поддержки truecolor. Однако подсветка синтаксиса не оптимизирована для терминалов с 8-битными цветами, и рекомендуется использовать терминалы с поддержкой 24-битных цветов (`terminator`, `konsole`, `iTerm2`, ...).
997+doc/README-ru.md:539:`24bit`. Иначе `bat` не сможет определить поддержку 24-битных цветов (и будет использовать 8-битные).
998+doc/README-ru.md:543:Используйте другую тему (`bat --list-themes` выведет список всех установленных тем). Темы `OneHalfDark` и
999+doc/README-ru.md:548:`bat` поддерживает UTF-8 и UTF-16. Файлы в других кодировках, возможно, придётся перекодировать, так как кодировка может быть распознана неверно. Используйте `iconv`.
1000+doc/README-ru.md:551:iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
1001+doc/README-ru.md:553:Внимание: вам может понадобится флаг `-l`/`--language`, если `bat` не сможет автоматически определить синтаксис.
1002+doc/README-ru.md:559:git clone --recursive https://github.com/sharkdp/bat
1003+doc/README-ru.md:562:cd bat
1004+doc/README-ru.md:571:# Компилирование исполняего файла bat с другим синтаксисом и темами
1005+doc/README-ru.md:583:Цели проекта `bat`:
1006+doc/README-ru.md:590:Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
1007+doc/README-ru.md:593:Copyright (c) 2018-2021 [Разработчики bat](https://github.com/sharkdp/bat).
1008+doc/README-ru.md:595:`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
1009+doc/release-checklist.md:5:See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
1010+doc/release-checklist.md:27: sure that it is available on the `PATH` (`bat --version` should show the
1011+doc/release-checklist.md:41: this, install the latest `bat` version again (to include the new synaxes
1012+doc/release-checklist.md:50:- [ ] Go to https://github.com/sharkdp/bat/releases/new to create the new
1013+Cargo.lock:85:name = "bat"
1014+LICENSE-MIT:1:Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
1015+assets/themes/Coldark/README.md:5:# Coldark - Bat
1016+assets/themes/Coldark/README.md:7:![GitHub License](https://img.shields.io/github/license/ArmandPhilippot/coldark-bat?colorA=111b27&color=d0dae7&logo=Github&logoColor=e3eaf2&style=for-the-badge) ![GitHub package.json version](https://img.shields.io/github/package-json/v/ArmandPhilippot/coldark-bat?colorA=111b27&color=d0dae7&logo=Github&logoColor=e3eaf2&style=for-the-badge)
1017+assets/themes/Coldark/README.md:15:This Coldark version is designed for [bat](https://github.com/sharkdp/bat) command.
1018+assets/themes/Coldark/README.md:21:The `bat` version uses almost the same colors as [VS code version](https://github.com/ArmandPhilippot/coldark-vscode). The scopes seems a little different and a little less complete, hence the difference.
1019+assets/themes/Coldark/README.md:69:1. Install `bat` (on Manjaro: `pacman -S bat`)
1020+assets/themes/Coldark/README.md:70:2. Create themes folder: `mkdir -p "$(bat --config-dir)/themes"`
1021+assets/themes/Coldark/README.md:71:3. Go inside this new folder: `cd "$(bat --config-dir)/themes"`
1022+assets/themes/Coldark/README.md:72:4. Clone this repo: `git clone https://github.com/ArmandPhilippot/coldark-bat`
1023+assets/themes/Coldark/README.md:73:5. Update the binary cache: `bat cache --build`
1024+assets/themes/Coldark/README.md:75:Then, if you use `bat --list-themes`, you should see the themes.
1025+assets/themes/Coldark/README.md:77:Coldark Bat is now present in [bat repo](https://github.com/sharkdp/bat). It may be present in the list of themes in a future version without having to install it manually.
1026+assets/themes/Coldark/README.md:81:To select one of the Coldark themes, call `bat` with the `--theme=Coldark-Cold` (or `--theme=Coldark-Dark`) option or set the `BAT_THEME` environment variable to `Coldark-Cold` (or `Coldark-Dark`). Use `export BAT_THEME="Coldark-Cold"` (or `export BAT_THEME="Coldark-Dark"`) in your shell's startup file to make the change permanent.
1027+assets/themes/Coldark/README.md:91:| [![Coldark Cold PHP](./assets/coldark-cold-bat-php.jpg)](./assets/coldark-cold-bat-php.jpg) | [![Coldark Cold Markdown](./assets/coldark-cold-bat-markdown.jpg)](./assets/coldark-cold-bat-markdown.jpg) |
1028+assets/themes/Coldark/README.md:97:| [![Coldark Dark PHP](./assets/coldark-dark-bat-php.jpg)](./assets/coldark-dark-bat-php.jpg) | [![Coldark Dark Markdown](./assets/coldark-dark-bat-markdown.jpg)](./assets/coldark-dark-bat-markdown.jpg) |
1029+assets/themes/Coldark/README.md:101:This project is open source and available under the [MIT License](https://github.com/ArmandPhilippot/coldark-bat/blob/master/LICENSE).
1030+assets/themes/Coldark/Coldark-Cold.tmTheme:6: Project: Coldark Bat
1031+assets/themes/Coldark/Coldark-Cold.tmTheme:7: Repository: https://github.com/ArmandPhilippot/coldark-bat
1032+assets/themes/Coldark/package.json:2: "name": "coldark-bat",
1033+assets/themes/Coldark/package.json:15: "homepage": "https://github.com/ArmandPhilippot/coldark-bat#readme",
1034+assets/themes/Coldark/package.json:18: "url": "https://github.com/ArmandPhilippot/coldark-bat"
1035+assets/themes/Coldark/package.json:21: "url": "https://github.com/ArmandPhilippot/coldark-bat/issues"
1036+assets/themes/Coldark/CHANGELOG.md:10:## [v1.0.5](https://github.com/ArmandPhilippot/coldark-bat/compare/v1.0.4...v1.0.5)
1037+assets/themes/Coldark/CHANGELOG.md:19:- fix: change red color for both versions [`93ee1f3`](https://github.com/ArmandPhilippot/coldark-bat/commit/93ee1f3fb5e08ecf66baee03dd3900c0abcdc1e9)
1038+assets/themes/Coldark/CHANGELOG.md:21:## [v1.0.4](https://github.com/ArmandPhilippot/coldark-bat/compare/v1.0.3...v1.0.4) - 2020-10-28
1039+assets/themes/Coldark/CHANGELOG.md:25:- Update Coldark Colors / Complete Markdown syntax highlighting [`a355b1d`](https://github.com/ArmandPhilippot/coldark-bat/commit/a355b1d75611d12d322dd47f2ea7799b663a7738)
1040+assets/themes/Coldark/CHANGELOG.md:26:- Update colors, logo, banner & add some screenshots [`0b13521`](https://github.com/ArmandPhilippot/coldark-bat/commit/0b13521b6018c04d00304121bcf47fe04fa266ee)
1041+assets/themes/Coldark/CHANGELOG.md:27:- build: update auto-changelog command [`2cd0f6e`](https://github.com/ArmandPhilippot/coldark-bat/commit/2cd0f6ea22280c892b564348aab72a45f7b28223)
1042+assets/themes/Coldark/CHANGELOG.md:29:## [v1.0.3](https://github.com/ArmandPhilippot/coldark-bat/compare/v1.0.2...v1.0.3) - 2020-10-19
1043+assets/themes/Coldark/CHANGELOG.md:33:- fix: color for pseudo-class/element in CSS [`1fada34`](https://github.com/ArmandPhilippot/coldark-bat/commit/1fada3494ae545fd186b1cb6c7d98c5860bcbcfe)
1044+assets/themes/Coldark/CHANGELOG.md:35:## [v1.0.2](https://github.com/ArmandPhilippot/coldark-bat/compare/v1.0.1...v1.0.2) - 2020-10-18
1045+assets/themes/Coldark/CHANGELOG.md:39:- fix: update scopes to be up to date with VS Code theme [`e92f6a7`](https://github.com/ArmandPhilippot/coldark-bat/commit/e92f6a7d7832d269cdec0754a198a589a4567a00)
1046+assets/themes/Coldark/CHANGELOG.md:41:## [v1.0.1](https://github.com/ArmandPhilippot/coldark-bat/compare/v1.0.0...v1.0.1) - 2020-10-17
1047+assets/themes/Coldark/CHANGELOG.md:45:- docs: fix export command [`0439c73`](https://github.com/ArmandPhilippot/coldark-bat/commit/0439c73d4af9c6a3254467dc7c6a758796f78267)
1048+assets/themes/Coldark/CHANGELOG.md:51:- feat: Coldark for bat command [`18fa11d`](https://github.com/ArmandPhilippot/coldark-bat/commit/18fa11d259bd4c1b5d3278b1ef91dbf8a13e5ee1)
1049+assets/themes/Coldark/CHANGELOG.md:52:- Initial commit [`80b7c34`](https://github.com/ArmandPhilippot/coldark-bat/commit/80b7c34079e11ae69fdd94d5839305fedd9fe847)
1050+assets/themes/Coldark/CHANGELOG.md:53:- docs: add README [`e904c4d`](https://github.com/ArmandPhilippot/coldark-bat/commit/e904c4d78e3ff7653b25a6215441ad643408aedf)
1051+assets/themes/Coldark/Coldark-Dark.tmTheme:6: Project: Coldark Bat
1052+assets/themes/Coldark/Coldark-Dark.tmTheme:7: Repository: https://github.com/ArmandPhilippot/coldark-bat
1053+assets/themes/Solarized/samples/test.md:26: a verbatim or "code" block
1054+assets/themes/onehalf/README.md:43: - [x] [bat](https://github.com/sharkdp/bat)
1055+assets/themes/base16.tmTheme:8: the bat theme base16-256 instead.
1056+assets/themes/ansi.tmTheme:26: Explicitly set the gutter color since bat falls back to a
1057+assets/themes/DarkNeon/Mou/Dark Neon Eighties.txt:77:VERBATIM
1058+assets/themes/DarkNeon/Mou/Dark Neon.txt:77:VERBATIM
1059+assets/themes/DarkNeon/Mou/Dark Neon Light.txt:77:VERBATIM
1060+assets/themes/TwoDark/icons/Prefs/icon_script.tmPreferences:6: <string>source.dosbatch, source.shell</string>
1061+assets/themes/TwoDark/src/svg/gfx_quick-panel-row-selected.svg:60:pQxTwpjGFbAti4KEppoxavUgB0Kt5geqNtU3yigwdL9zPN5DHw0QItval6DB1kZEzQTiJdJEmU3x
1062+assets/themes/gruvbox/README.md:4:This branch is being used as a submodule in [bat](https://github.com/sharkdp/bat) for the _gruvbox_ family of themes
1063+assets/themes/gruvbox/gruvbox-dark.tmTheme:259: <string>entity.name.val.declaration, entity.name.variable, meta.definition.variable, storage.type.variable, support.type.custom-property, support.type.variable-name, variable, variable.interpolation variable, variable.other.interpolation variable, variable.parameter.dosbatch, variable.parameter.output.function.matlab, variable.parameter.sass</string>
1064+assets/themes/gruvbox/gruvbox-light.tmTheme:259: <string>entity.name.val.declaration, entity.name.variable, meta.definition.variable, storage.type.variable, support.type.custom-property, support.type.variable-name, variable, variable.interpolation variable, variable.other.interpolation variable, variable.parameter.dosbatch, variable.parameter.output.function.matlab, variable.parameter.sass</string>
1065+assets/syntaxes/02_Extra/Slim/Demo/demo.slim:152:/ Verbatim
1066+assets/syntaxes/02_Extra/Slim/Demo/demo.slim:163: 'Verbatim text with space after
1067+assets/syntaxes/02_Extra/Slim/Syntaxes/Ruby Slim.YAML-tmLanguage:130: comment: Verbatim text (can include HTML tags and copied lines)
1068+assets/syntaxes/02_Extra/Slim/Syntaxes/Ruby Slim.tmLanguage:326: <string>Verbatim text (can include HTML tags and copied lines)</string>
1069+assets/syntaxes/02_Extra/LLVM/README.md:2:LLVM syntax highlighting definitions based on [LLVM.tmBundle](https://github.com/whitequark/LLVM.tmBundle) created by [whitequark](https://github.com/whitequark) for [bat](https://github.com/sharkdp/bat).
1070+assets/syntaxes/02_Extra/Puppet/Puppet.sublime-build:8: "cmd": ["puppet.bat", "parser", "validate", "--color=false", "$file" ]
1071+assets/syntaxes/02_Extra/Slim.sublime-syntax:117: comment: Verbatim text (can include HTML tags and copied lines)
1072+assets/syntaxes/02_Extra/Assembly (x86_64).sublime-syntax:463: - match: '(?i)\bat\b'
1073+assets/syntaxes/02_Extra/HTML (Twig).sublime-syntax:377: - match: '(?<=(?:[a-zA-Z0-9_\x{7f}-\x{ff}\]\)\''\"]\|)|\{%\sfilter\s)(batch|convert_encoding|date|date_modify|default|e(?:scape)?|format|join|merge|number_format|replace|round|slice|split|trim)(\()'
1074+assets/syntaxes/02_Extra/HTML (Twig).sublime-syntax:479: - match: (?<=\s)((?:end)?(?:autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless|trans|verbatim)|as|do|else|elseif|extends|flush|from|ignore missing|import|include|only|use|with)(?=\s)
1075+assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax:2325: |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
1076+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:3584: // The advantage of this approach is its simplicity. For the case of batch compilation,
1077+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:37221: // Literal files are always included verbatim. An "include" or "exclude" specification cannot
1078+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:48035: var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
1079+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:48036: if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
1080+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:48038: verbatimTargetName = "default" /* Default */;
1081+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:48040: var targetName = getInternalSymbolName(target, verbatimTargetName);
1082+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:48085: ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
1083+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:48094: serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
1084+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:98916: // If he number will be printed verbatim and it doesn't already contain a dot, add one
1085+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:101096: * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
1086+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:105964: // Get next batch of affected files
1087+assets/syntaxes/02_Extra/TypeScript/tsserver/typingsInstaller.js:108618: // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
1088+assets/syntaxes/02_Extra/TypeScript/tsserver/tsc.js:39425: var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
1089+assets/syntaxes/02_Extra/TypeScript/tsserver/tsc.js:39426: if (verbatimTargetName === "export=" && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
1090+assets/syntaxes/02_Extra/TypeScript/tsserver/tsc.js:39427: verbatimTargetName = "default";
1091+assets/syntaxes/02_Extra/TypeScript/tsserver/tsc.js:39429: var targetName = getInternalSymbolName(target, verbatimTargetName);
1092+assets/syntaxes/02_Extra/TypeScript/tsserver/tsc.js:39452: ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
1093+assets/syntaxes/02_Extra/TypeScript/tsserver/tsc.js:39457: serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
1094+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:3595: // The advantage of this approach is its simplicity. For the case of batch compilation,
1095+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:37232: // Literal files are always included verbatim. An "include" or "exclude" specification cannot
1096+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:48046: var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
1097+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:48047: if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
1098+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:48049: verbatimTargetName = "default" /* Default */;
1099+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:48051: var targetName = getInternalSymbolName(target, verbatimTargetName);
1100+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:48096: ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
1101+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:48105: serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
1102+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:98927: // If he number will be printed verbatim and it doesn't already contain a dot, add one
1103+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:101107: * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
1104+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:105975: // Get next batch of affected files
1105+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserver.js:108629: // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
1106+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:3789: // The advantage of this approach is its simplicity. For the case of batch compilation,
1107+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:37426: // Literal files are always included verbatim. An "include" or "exclude" specification cannot
1108+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:48240: var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
1109+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:48241: if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
1110+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:48243: verbatimTargetName = "default" /* Default */;
1111+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:48245: var targetName = getInternalSymbolName(target, verbatimTargetName);
1112+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:48290: ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
1113+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:48299: serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
1114+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:99121: // If he number will be printed verbatim and it doesn't already contain a dot, add one
1115+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:101301: * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
1116+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:106169: // Get next batch of affected files
1117+assets/syntaxes/02_Extra/TypeScript/tsserver/typescriptServices.js:108823: // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
1118+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:3789: // The advantage of this approach is its simplicity. For the case of batch compilation,
1119+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:37426: // Literal files are always included verbatim. An "include" or "exclude" specification cannot
1120+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:48240: var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
1121+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:48241: if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
1122+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:48243: verbatimTargetName = "default" /* Default */;
1123+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:48245: var targetName = getInternalSymbolName(target, verbatimTargetName);
1124+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:48290: ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
1125+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:48299: serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
1126+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:99121: // If he number will be printed verbatim and it doesn't already contain a dot, add one
1127+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:101301: * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
1128+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:106169: // Get next batch of affected files
1129+assets/syntaxes/02_Extra/TypeScript/tsserver/tsserverlibrary.js:108823: // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
1130+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:3789: // The advantage of this approach is its simplicity. For the case of batch compilation,
1131+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:37426: // Literal files are always included verbatim. An "include" or "exclude" specification cannot
1132+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:48240: var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
1133+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:48241: if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
1134+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:48243: verbatimTargetName = "default" /* Default */;
1135+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:48245: var targetName = getInternalSymbolName(target, verbatimTargetName);
1136+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:48290: ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
1137+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:48299: serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
1138+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:99121: // If he number will be printed verbatim and it doesn't already contain a dot, add one
1139+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:101301: * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
1140+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:106169: // Get next batch of affected files
1141+assets/syntaxes/02_Extra/TypeScript/tsserver/typescript.js:108823: // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
1142+assets/syntaxes/02_Extra/TypeScript/tsserver/lib.scripthost.d.ts:161: * Gets/sets the script mode - interactive(true) or batch(false).
1143+assets/syntaxes/02_Extra/TypeScript/TypeScript.tmLanguage:6080: |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
1144+assets/syntaxes/02_Extra/TypeScript/TypeScriptReact.tmLanguage:6026: |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
1145+assets/syntaxes/02_Extra/Org mode/README.org:25:- [X] =Verbatim=
1146+assets/syntaxes/02_Extra/PowerShell/examples/test.ps1:281:a.bat
1147+assets/syntaxes/02_Extra/PowerShell/examples/test.ps1:282:aa.bat
1148+assets/syntaxes/02_Extra/PowerShell/examples/test.ps1:283:aaa.bat
1149+assets/syntaxes/02_Extra/PowerShell/examples/test.ps1:284:aaaa.bat
1150+assets/syntaxes/02_Extra/PowerShell/PowerShellSyntax.tmLanguage:255: <string>(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)</string>
1151+assets/syntaxes/02_Extra/PowerShell/PowerShellSyntax.tmLanguage:503: <string>(?:(\p{L}|\d|_|-|\\|\:)*\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b</string>
1152+assets/syntaxes/02_Extra/ssh-config/src/options.yaml:54: BatchMode:
1153+assets/syntaxes/02_Extra/ssh-config/SSH Config.sublime-syntax:215: BatchMode|CanonicalizeFallbackLocal|CheckHostIP|Compression|
1154+assets/syntaxes/02_Extra/ssh-config/Support/SSH Config.sublime-completions:41: "trigger": "BatchMode",
1155+assets/syntaxes/02_Extra/ssh-config/Support/SSH Config.sublime-completions:42: "contents": "BatchMode",
1156+assets/syntaxes/02_Extra/ssh-config/Support/SSH Config.sublime-completions:47: "trigger": "batchmode",
1157+assets/syntaxes/02_Extra/ssh-config/Support/SSH Config.sublime-completions:48: "contents": "BatchMode ${0:{ yes | no \\}}",
1158+assets/syntaxes/02_Extra/http-request-response/README.md:3:It was originally designed for use in https://github.com/sharkdp/bat, so it is not using any Sublime Text 4 features, as https://github.com/trishume/syntect does not support them yet. So this package should work in Sublime Text 3 also.
1159+assets/syntaxes/02_Extra/http-request-response/docs/CONTRIBUTING.md:9:If you are not a Sublime Text user, and are contributing to improve a tool that uses the `syntect` Rust library, such as `bat`,
1160+assets/syntaxes/02_Extra/Crystal/Crystal.tmLanguage:353: <string>\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|context|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn|annotation|verbatim)\b[!?]?</string>
1161+assets/syntaxes/02_Extra/Lean/README.md:22:* Batch file execution
1162+assets/syntaxes/02_Extra/Lean/README.md:178:* `lean.batchExecute` (Lean: Batch Execute File): execute the current file using Lean (bound to <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>r</kbd> by default)
1163+assets/syntaxes/02_Extra/Lean/README.md:287:* Properly set working directory when executing in batch mode.
1164+assets/syntaxes/02_Extra/Lean/src/batch.ts:6:let batchOutputChannel: OutputChannel;
1165+assets/syntaxes/02_Extra/Lean/src/batch.ts:8:export function batchExecuteFile(
1166+assets/syntaxes/02_Extra/Lean/src/batch.ts:13: batchOutputChannel = batchOutputChannel ||
1167+assets/syntaxes/02_Extra/Lean/src/batch.ts:14: window.createOutputChannel('Lean: Batch File Output');
1168+assets/syntaxes/02_Extra/Lean/src/batch.ts:23: batchOutputChannel.clear();
1169+assets/syntaxes/02_Extra/Lean/src/batch.ts:26: batchOutputChannel.appendLine(line);
1170+assets/syntaxes/02_Extra/Lean/src/batch.ts:30: batchOutputChannel.appendLine(line);
1171+assets/syntaxes/02_Extra/Lean/src/batch.ts:37: batchOutputChannel.show(true);
1172+assets/syntaxes/02_Extra/Lean/src/extension.ts:3:import { batchExecuteFile } from './batch';
1173+assets/syntaxes/02_Extra/Lean/src/extension.ts:67: commands.registerTextEditorCommand('lean.batchExecute',
1174+assets/syntaxes/02_Extra/Lean/src/extension.ts:68: (editor, edit, args) => { batchExecuteFile(server, editor, edit, args); }),
1175+assets/syntaxes/02_Extra/Lean/package.json:281: "command": "lean.batchExecute",
1176+assets/syntaxes/02_Extra/Lean/package.json:283: "title": "Batch Execute File",
1177+assets/syntaxes/02_Extra/Lean/package.json:350: "command": "lean.batchExecute",
1178+assets/syntaxes/02_Extra/Lean/package.json:373: "command": "lean.batchExecute",
1179+assets/syntaxes/02_Extra/Lean/syntaxes/lean-markdown.json:571: "fenced_code_block_dosbatch": {
1180+assets/syntaxes/02_Extra/Lean/syntaxes/lean-markdown.json:572: "begin": "(^)(\\s*)(`{3,}|~{3,})\\s*(?i:(bat|batch)((\\s+|:|\\{)[^`~]*)?$)",
1181+assets/syntaxes/02_Extra/Lean/syntaxes/lean-markdown.json:595: "contentName": "meta.embedded.block.dosbatch",
1182+assets/syntaxes/02_Extra/Lean/syntaxes/lean-markdown.json:598: "include": "source.batchfile"
1183+assets/syntaxes/02_Extra/Lean/syntaxes/lean-markdown.json:1774: "include": "#fenced_code_block_dosbatch"
1184+assets/syntaxes/02_Extra/Lean/syntaxes/lean.json:21: { "match": "\\battribute\\b\\s*\\[[^\\]]*\\]", "name": "storage.modifier.lean" },
1185+assets/syntaxes/02_Extra/Lean/package-lock.json:1946: "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
1186+assets/syntaxes/02_Extra/Lean/package-lock.json:4288: "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
1187+assets/syntaxes/02_Extra/Lean/package-lock.json:7099: "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
1188+assets/syntaxes/02_Extra/Lean/package-lock.json:9705: "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
1189+assets/syntaxes/02_Extra/Lean/package-lock.json:11662: "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
1190+assets/syntaxes/02_Extra/Lean/package-lock.json:14054: "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
1191+assets/syntaxes/02_Extra/CMake/CMakeCommands.yml:4:add_custom_command: [OUTPUT, COMMAND, ARGS, MAIN_DEPENDENCY, DEPENDS, BYPRODUCTS, IMPLICIT_DEPENDS, WORKING_DIRECTORY, COMMENT, DEPFILE, VERBATIM, APPEND, USES_TERMINAL COMMAND_EXPAND_LISTS, TARGET, PRE_BUILD, PRE_LINK, POST_BUILD]
1192+assets/syntaxes/02_Extra/CMake/CMakeCommands.yml:5:add_custom_target: [ALL, COMMAND, DEPENDS, BYPRODUCTS, WORKING_DIRECTORY, COMMENT, VERBATIM, USES_TERMINAL, COMMAND_EXPAND_LISTS, SOURCES]
1193+assets/syntaxes/02_Extra/CMake/CMakeVariables.sublime-completions:1:{"completions":[{"contents":"ANDROID","trigger":"ANDROID\tbuiltin variable"},{"contents":"APPLE","trigger":"APPLE\tbuiltin variable"},{"contents":"BORLAND","trigger":"BORLAND\tbuiltin variable"},{"contents":"BUILD_SHARED_LIBS","trigger":"BUILD_SHARED_LIBS\tbuiltin variable"},{"contents":"CACHE","trigger":"CACHE\tbuiltin variable"},{"contents":"CMAKE_ABSOLUTE_DESTINATION_FILES","trigger":"CMAKE_ABSOLUTE_DESTINATION_FILES\tbuiltin variable"},{"contents":"CMAKE_AIX_EXPORT_ALL_SYMBOLS","trigger":"CMAKE_AIX_EXPORT_ALL_SYMBOLS\tbuiltin variable"},{"contents":"CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS","trigger":"CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS\tbuiltin variable"},{"contents":"CMAKE_ANDROID_API","trigger":"CMAKE_ANDROID_API\tbuiltin variable"},{"contents":"CMAKE_ANDROID_API_MIN","trigger":"CMAKE_ANDROID_API_MIN\tbuiltin variable"},{"contents":"CMAKE_ANDROID_ARCH","trigger":"CMAKE_ANDROID_ARCH\tbuiltin variable"},{"contents":"CMAKE_ANDROID_ARCH_ABI","trigger":"CMAKE_ANDROID_ARCH_ABI\tbuiltin variable"},{"contents":"CMAKE_ANDROID_ARM_MODE","trigger":"CMAKE_ANDROID_ARM_MODE\tbuiltin variable"},{"contents":"CMAKE_ANDROID_ARM_NEON","trigger":"CMAKE_ANDROID_ARM_NEON\tbuiltin variable"},{"contents":"CMAKE_ANDROID_ASSETS_DIRECTORIES","trigger":"CMAKE_ANDROID_ASSETS_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_ANDROID_GUI","trigger":"CMAKE_ANDROID_GUI\tbuiltin variable"},{"contents":"CMAKE_ANDROID_JAR_DEPENDENCIES","trigger":"CMAKE_ANDROID_JAR_DEPENDENCIES\tbuiltin variable"},{"contents":"CMAKE_ANDROID_JAR_DIRECTORIES","trigger":"CMAKE_ANDROID_JAR_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_ANDROID_JAVA_SOURCE_DIR","trigger":"CMAKE_ANDROID_JAVA_SOURCE_DIR\tbuiltin variable"},{"contents":"CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES","trigger":"CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES\tbuiltin variable"},{"contents":"CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES","trigger":"CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_ANDROID_NDK","trigger":"CMAKE_ANDROID_NDK\tbuiltin variable"},{"contents":"CMAKE_ANDROID_NDK_DEPRECATED_HEADERS","trigger":"CMAKE_ANDROID_NDK_DEPRECATED_HEADERS\tbuiltin variable"},{"contents":"CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG","trigger":"CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG\tbuiltin variable"},{"contents":"CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION","trigger":"CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION\tbuiltin variable"},{"contents":"CMAKE_ANDROID_PROCESS_MAX","trigger":"CMAKE_ANDROID_PROCESS_MAX\tbuiltin variable"},{"contents":"CMAKE_ANDROID_PROGUARD","trigger":"CMAKE_ANDROID_PROGUARD\tbuiltin variable"},{"contents":"CMAKE_ANDROID_PROGUARD_CONFIG_PATH","trigger":"CMAKE_ANDROID_PROGUARD_CONFIG_PATH\tbuiltin variable"},{"contents":"CMAKE_ANDROID_SECURE_PROPS_PATH","trigger":"CMAKE_ANDROID_SECURE_PROPS_PATH\tbuiltin variable"},{"contents":"CMAKE_ANDROID_SKIP_ANT_STEP","trigger":"CMAKE_ANDROID_SKIP_ANT_STEP\tbuiltin variable"},{"contents":"CMAKE_ANDROID_STANDALONE_TOOLCHAIN","trigger":"CMAKE_ANDROID_STANDALONE_TOOLCHAIN\tbuiltin variable"},{"contents":"CMAKE_ANDROID_STL_TYPE","trigger":"CMAKE_ANDROID_STL_TYPE\tbuiltin variable"},{"contents":"CMAKE_APPBUNDLE_PATH","trigger":"CMAKE_APPBUNDLE_PATH\tbuiltin variable"},{"contents":"CMAKE_APPLE_SILICON_PROCESSOR","trigger":"CMAKE_APPLE_SILICON_PROCESSOR\tbuiltin variable"},{"contents":"CMAKE_AR","trigger":"CMAKE_AR\tbuiltin variable"},{"contents":"CMAKE_ARCHIVE_OUTPUT_DIRECTORY","trigger":"CMAKE_ARCHIVE_OUTPUT_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_ARGC","trigger":"CMAKE_ARGC\tbuiltin variable"},{"contents":"CMAKE_ARGV0","trigger":"CMAKE_ARGV0\tbuiltin variable"},{"contents":"CMAKE_AUTOGEN_ORIGIN_DEPENDS","trigger":"CMAKE_AUTOGEN_ORIGIN_DEPENDS\tbuiltin variable"},{"contents":"CMAKE_AUTOGEN_PARALLEL","trigger":"CMAKE_AUTOGEN_PARALLEL\tbuiltin variable"},{"contents":"CMAKE_AUTOGEN_VERBOSE","trigger":"CMAKE_AUTOGEN_VERBOSE\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC","trigger":"CMAKE_AUTOMOC\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC_COMPILER_PREDEFINES","trigger":"CMAKE_AUTOMOC_COMPILER_PREDEFINES\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC_DEPEND_FILTERS","trigger":"CMAKE_AUTOMOC_DEPEND_FILTERS\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC_MACRO_NAMES","trigger":"CMAKE_AUTOMOC_MACRO_NAMES\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC_MOC_OPTIONS","trigger":"CMAKE_AUTOMOC_MOC_OPTIONS\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC_PATH_PREFIX","trigger":"CMAKE_AUTOMOC_PATH_PREFIX\tbuiltin variable"},{"contents":"CMAKE_AUTOMOC_RELAXED_MODE","trigger":"CMAKE_AUTOMOC_RELAXED_MODE\tbuiltin variable"},{"contents":"CMAKE_AUTORCC","trigger":"CMAKE_AUTORCC\tbuiltin variable"},{"contents":"CMAKE_AUTORCC_OPTIONS","trigger":"CMAKE_AUTORCC_OPTIONS\tbuiltin variable"},{"contents":"CMAKE_AUTOUIC","trigger":"CMAKE_AUTOUIC\tbuiltin variable"},{"contents":"CMAKE_AUTOUIC_OPTIONS","trigger":"CMAKE_AUTOUIC_OPTIONS\tbuiltin variable"},{"contents":"CMAKE_AUTOUIC_SEARCH_PATHS","trigger":"CMAKE_AUTOUIC_SEARCH_PATHS\tbuiltin variable"},{"contents":"CMAKE_BACKWARDS_COMPATIBILITY","trigger":"CMAKE_BACKWARDS_COMPATIBILITY\tbuiltin variable"},{"contents":"CMAKE_BINARY_DIR","trigger":"CMAKE_BINARY_DIR\tbuiltin variable"},{"contents":"CMAKE_BUILD_RPATH","trigger":"CMAKE_BUILD_RPATH\tbuiltin variable"},{"contents":"CMAKE_BUILD_RPATH_USE_ORIGIN","trigger":"CMAKE_BUILD_RPATH_USE_ORIGIN\tbuiltin variable"},{"contents":"CMAKE_BUILD_TOOL","trigger":"CMAKE_BUILD_TOOL\tbuiltin variable"},{"contents":"CMAKE_BUILD_TYPE","trigger":"CMAKE_BUILD_TYPE\tbuiltin variable"},{"contents":"CMAKE_BUILD_WITH_INSTALL_NAME_DIR","trigger":"CMAKE_BUILD_WITH_INSTALL_NAME_DIR\tbuiltin variable"},{"contents":"CMAKE_BUILD_WITH_INSTALL_RPATH","trigger":"CMAKE_BUILD_WITH_INSTALL_RPATH\tbuiltin variable"},{"contents":"CMAKE_CACHEFILE_DIR","trigger":"CMAKE_CACHEFILE_DIR\tbuiltin variable"},{"contents":"CMAKE_CACHE_MAJOR_VERSION","trigger":"CMAKE_CACHE_MAJOR_VERSION\tbuiltin variable"},{"contents":"CMAKE_CACHE_MINOR_VERSION","trigger":"CMAKE_CACHE_MINOR_VERSION\tbuiltin variable"},{"contents":"CMAKE_CACHE_PATCH_VERSION","trigger":"CMAKE_CACHE_PATCH_VERSION\tbuiltin variable"},{"contents":"CMAKE_CFG_INTDIR","trigger":"CMAKE_CFG_INTDIR\tbuiltin variable"},{"contents":"CMAKE_CLANG_VFS_OVERLAY","trigger":"CMAKE_CLANG_VFS_OVERLAY\tbuiltin variable"},{"contents":"CMAKE_CL_64","trigger":"CMAKE_CL_64\tbuiltin variable"},{"contents":"CMAKE_CODEBLOCKS_COMPILER_ID","trigger":"CMAKE_CODEBLOCKS_COMPILER_ID\tbuiltin variable"},{"contents":"CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES","trigger":"CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES\tbuiltin variable"},{"contents":"CMAKE_CODELITE_USE_TARGETS","trigger":"CMAKE_CODELITE_USE_TARGETS\tbuiltin variable"},{"contents":"CMAKE_COLOR_MAKEFILE","trigger":"CMAKE_COLOR_MAKEFILE\tbuiltin variable"},{"contents":"CMAKE_COMMAND","trigger":"CMAKE_COMMAND\tbuiltin variable"},{"contents":"CMAKE_COMPILER_2005","trigger":"CMAKE_COMPILER_2005\tbuiltin variable"},{"contents":"CMAKE_COMPILER_IS_GNUCC","trigger":"CMAKE_COMPILER_IS_GNUCC\tbuiltin variable"},{"contents":"CMAKE_COMPILER_IS_GNUCXX","trigger":"CMAKE_COMPILER_IS_GNUCXX\tbuiltin variable"},{"contents":"CMAKE_COMPILER_IS_GNUG77","trigger":"CMAKE_COMPILER_IS_GNUG77\tbuiltin variable"},{"contents":"CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY","trigger":"CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_CONFIGURATION_TYPES","trigger":"CMAKE_CONFIGURATION_TYPES\tbuiltin variable"},{"contents":"CMAKE_CPACK_COMMAND","trigger":"CMAKE_CPACK_COMMAND\tbuiltin variable"},{"contents":"CMAKE_CROSSCOMPILING","trigger":"CMAKE_CROSSCOMPILING\tbuiltin variable"},{"contents":"CMAKE_CROSSCOMPILING_EMULATOR","trigger":"CMAKE_CROSSCOMPILING_EMULATOR\tbuiltin variable"},{"contents":"CMAKE_CROSS_CONFIGS","trigger":"CMAKE_CROSS_CONFIGS\tbuiltin variable"},{"contents":"CMAKE_CTEST_ARGUMENTS","trigger":"CMAKE_CTEST_ARGUMENTS\tbuiltin variable"},{"contents":"CMAKE_CTEST_COMMAND","trigger":"CMAKE_CTEST_COMMAND\tbuiltin variable"},{"contents":"CMAKE_CUDA_ARCHITECTURES","trigger":"CMAKE_CUDA_ARCHITECTURES\tbuiltin variable"},{"contents":"CMAKE_CUDA_COMPILE_FEATURES","trigger":"CMAKE_CUDA_COMPILE_FEATURES\tbuiltin variable"},{"contents":"CMAKE_CUDA_EXTENSIONS","trigger":"CMAKE_CUDA_EXTENSIONS\tbuiltin variable"},{"contents":"CMAKE_CUDA_HOST_COMPILER","trigger":"CMAKE_CUDA_HOST_COMPILER\tbuiltin variable"},{"contents":"CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS","trigger":"CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS\tbuiltin variable"},{"contents":"CMAKE_CUDA_RUNTIME_LIBRARY","trigger":"CMAKE_CUDA_RUNTIME_LIBRARY\tbuiltin variable"},{"contents":"CMAKE_CUDA_SEPARABLE_COMPILATION","trigger":"CMAKE_CUDA_SEPARABLE_COMPILATION\tbuiltin variable"},{"contents":"CMAKE_CUDA_STANDARD","trigger":"CMAKE_CUDA_STANDARD\tbuiltin variable"},{"contents":"CMAKE_CUDA_STANDARD_REQUIRED","trigger":"CMAKE_CUDA_STANDARD_REQUIRED\tbuiltin variable"},{"contents":"CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES","trigger":"CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_CURRENT_BINARY_DIR","trigger":"CMAKE_CURRENT_BINARY_DIR\tbuiltin variable"},{"contents":"CMAKE_CURRENT_FUNCTION","trigger":"CMAKE_CURRENT_FUNCTION\tbuiltin variable"},{"contents":"CMAKE_CURRENT_FUNCTION_LIST_DIR","trigger":"CMAKE_CURRENT_FUNCTION_LIST_DIR\tbuiltin variable"},{"contents":"CMAKE_CURRENT_FUNCTION_LIST_FILE","trigger":"CMAKE_CURRENT_FUNCTION_LIST_FILE\tbuiltin variable"},{"contents":"CMAKE_CURRENT_FUNCTION_LIST_LINE","trigger":"CMAKE_CURRENT_FUNCTION_LIST_LINE\tbuiltin variable"},{"contents":"CMAKE_CURRENT_LIST_DIR","trigger":"CMAKE_CURRENT_LIST_DIR\tbuiltin variable"},{"contents":"CMAKE_CURRENT_LIST_FILE","trigger":"CMAKE_CURRENT_LIST_FILE\tbuiltin variable"},{"contents":"CMAKE_CURRENT_LIST_LINE","trigger":"CMAKE_CURRENT_LIST_LINE\tbuiltin variable"},{"contents":"CMAKE_CURRENT_SOURCE_DIR","trigger":"CMAKE_CURRENT_SOURCE_DIR\tbuiltin variable"},{"contents":"CMAKE_CXX_COMPILE_FEATURES","trigger":"CMAKE_CXX_COMPILE_FEATURES\tbuiltin variable"},{"contents":"CMAKE_CXX_EXTENSIONS","trigger":"CMAKE_CXX_EXTENSIONS\tbuiltin variable"},{"contents":"CMAKE_CXX_STANDARD","trigger":"CMAKE_CXX_STANDARD\tbuiltin variable"},{"contents":"CMAKE_CXX_STANDARD_REQUIRED","trigger":"CMAKE_CXX_STANDARD_REQUIRED\tbuiltin variable"},{"contents":"CMAKE_C_COMPILE_FEATURES","trigger":"CMAKE_C_COMPILE_FEATURES\tbuiltin variable"},{"contents":"CMAKE_C_EXTENSIONS","trigger":"CMAKE_C_EXTENSIONS\tbuiltin variable"},{"contents":"CMAKE_C_STANDARD","trigger":"CMAKE_C_STANDARD\tbuiltin variable"},{"contents":"CMAKE_C_STANDARD_REQUIRED","trigger":"CMAKE_C_STANDARD_REQUIRED\tbuiltin variable"},{"contents":"CMAKE_DEBUG_POSTFIX","trigger":"CMAKE_DEBUG_POSTFIX\tbuiltin variable"},{"contents":"CMAKE_DEBUG_TARGET_PROPERTIES","trigger":"CMAKE_DEBUG_TARGET_PROPERTIES\tbuiltin variable"},{"contents":"CMAKE_DEFAULT_BUILD_TYPE","trigger":"CMAKE_DEFAULT_BUILD_TYPE\tbuiltin variable"},{"contents":"CMAKE_DEFAULT_CONFIGS","trigger":"CMAKE_DEFAULT_CONFIGS\tbuiltin variable"},{"contents":"CMAKE_DEPENDS_IN_PROJECT_ONLY","trigger":"CMAKE_DEPENDS_IN_PROJECT_ONLY\tbuiltin variable"},{"contents":"CMAKE_DIRECTORY_LABELS","trigger":"CMAKE_DIRECTORY_LABELS\tbuiltin variable"},{"contents":"CMAKE_DISABLE_PRECOMPILE_HEADERS","trigger":"CMAKE_DISABLE_PRECOMPILE_HEADERS\tbuiltin variable"},{"contents":"CMAKE_DL_LIBS","trigger":"CMAKE_DL_LIBS\tbuiltin variable"},{"contents":"CMAKE_DOTNET_TARGET_FRAMEWORK","trigger":"CMAKE_DOTNET_TARGET_FRAMEWORK\tbuiltin variable"},{"contents":"CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION","trigger":"CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION\tbuiltin variable"},{"contents":"CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES","trigger":"CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES\tbuiltin variable"},{"contents":"CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT","trigger":"CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT\tbuiltin variable"},{"contents":"CMAKE_ECLIPSE_MAKE_ARGUMENTS","trigger":"CMAKE_ECLIPSE_MAKE_ARGUMENTS\tbuiltin variable"},{"contents":"CMAKE_ECLIPSE_RESOURCE_ENCODING","trigger":"CMAKE_ECLIPSE_RESOURCE_ENCODING\tbuiltin variable"},{"contents":"CMAKE_ECLIPSE_VERSION","trigger":"CMAKE_ECLIPSE_VERSION\tbuiltin variable"},{"contents":"CMAKE_EDIT_COMMAND","trigger":"CMAKE_EDIT_COMMAND\tbuiltin variable"},{"contents":"CMAKE_ENABLE_EXPORTS","trigger":"CMAKE_ENABLE_EXPORTS\tbuiltin variable"},{"contents":"CMAKE_ERROR_DEPRECATED","trigger":"CMAKE_ERROR_DEPRECATED\tbuiltin variable"},{"contents":"CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION","trigger":"CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION\tbuiltin variable"},{"contents":"CMAKE_EXECUTABLE_SUFFIX","trigger":"CMAKE_EXECUTABLE_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_EXECUTE_PROCESS_COMMAND_ECHO","trigger":"CMAKE_EXECUTE_PROCESS_COMMAND_ECHO\tbuiltin variable"},{"contents":"CMAKE_EXE_LINKER_FLAGS","trigger":"CMAKE_EXE_LINKER_FLAGS\tbuiltin variable"},{"contents":"CMAKE_EXE_LINKER_FLAGS_INIT","trigger":"CMAKE_EXE_LINKER_FLAGS_INIT\tbuiltin variable"},{"contents":"CMAKE_EXPORT_COMPILE_COMMANDS","trigger":"CMAKE_EXPORT_COMPILE_COMMANDS\tbuiltin variable"},{"contents":"CMAKE_EXPORT_NO_PACKAGE_REGISTRY","trigger":"CMAKE_EXPORT_NO_PACKAGE_REGISTRY\tbuiltin variable"},{"contents":"CMAKE_EXPORT_PACKAGE_REGISTRY","trigger":"CMAKE_EXPORT_PACKAGE_REGISTRY\tbuiltin variable"},{"contents":"CMAKE_EXTRA_GENERATOR","trigger":"CMAKE_EXTRA_GENERATOR\tbuiltin variable"},{"contents":"CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES","trigger":"CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES\tbuiltin variable"},{"contents":"CMAKE_FIND_APPBUNDLE","trigger":"CMAKE_FIND_APPBUNDLE\tbuiltin variable"},{"contents":"CMAKE_FIND_DEBUG_MODE","trigger":"CMAKE_FIND_DEBUG_MODE\tbuiltin variable"},{"contents":"CMAKE_FIND_FRAMEWORK","trigger":"CMAKE_FIND_FRAMEWORK\tbuiltin variable"},{"contents":"CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX","trigger":"CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_FIND_LIBRARY_PREFIXES","trigger":"CMAKE_FIND_LIBRARY_PREFIXES\tbuiltin variable"},{"contents":"CMAKE_FIND_LIBRARY_SUFFIXES","trigger":"CMAKE_FIND_LIBRARY_SUFFIXES\tbuiltin variable"},{"contents":"CMAKE_FIND_NO_INSTALL_PREFIX","trigger":"CMAKE_FIND_NO_INSTALL_PREFIX\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_NAME","trigger":"CMAKE_FIND_PACKAGE_NAME\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY","trigger":"CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY","trigger":"CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_PREFER_CONFIG","trigger":"CMAKE_FIND_PACKAGE_PREFER_CONFIG\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS","trigger":"CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_SORT_DIRECTION","trigger":"CMAKE_FIND_PACKAGE_SORT_DIRECTION\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_SORT_ORDER","trigger":"CMAKE_FIND_PACKAGE_SORT_ORDER\tbuiltin variable"},{"contents":"CMAKE_FIND_PACKAGE_WARN_NO_MODULE","trigger":"CMAKE_FIND_PACKAGE_WARN_NO_MODULE\tbuiltin variable"},{"contents":"CMAKE_FIND_ROOT_PATH","trigger":"CMAKE_FIND_ROOT_PATH\tbuiltin variable"},{"contents":"CMAKE_FIND_ROOT_PATH_MODE_INCLUDE","trigger":"CMAKE_FIND_ROOT_PATH_MODE_INCLUDE\tbuiltin variable"},{"contents":"CMAKE_FIND_ROOT_PATH_MODE_LIBRARY","trigger":"CMAKE_FIND_ROOT_PATH_MODE_LIBRARY\tbuiltin variable"},{"contents":"CMAKE_FIND_ROOT_PATH_MODE_PACKAGE","trigger":"CMAKE_FIND_ROOT_PATH_MODE_PACKAGE\tbuiltin variable"},{"contents":"CMAKE_FIND_ROOT_PATH_MODE_PROGRAM","trigger":"CMAKE_FIND_ROOT_PATH_MODE_PROGRAM\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH","trigger":"CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_CMAKE_PATH","trigger":"CMAKE_FIND_USE_CMAKE_PATH\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_CMAKE_SYSTEM_PATH","trigger":"CMAKE_FIND_USE_CMAKE_SYSTEM_PATH\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_PACKAGE_REGISTRY","trigger":"CMAKE_FIND_USE_PACKAGE_REGISTRY\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_PACKAGE_ROOT_PATH","trigger":"CMAKE_FIND_USE_PACKAGE_ROOT_PATH\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH","trigger":"CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH\tbuiltin variable"},{"contents":"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY","trigger":"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY\tbuiltin variable"},{"contents":"CMAKE_FOLDER","trigger":"CMAKE_FOLDER\tbuiltin variable"},{"contents":"CMAKE_FRAMEWORK","trigger":"CMAKE_FRAMEWORK\tbuiltin variable"},{"contents":"CMAKE_FRAMEWORK_PATH","trigger":"CMAKE_FRAMEWORK_PATH\tbuiltin variable"},{"contents":"CMAKE_Fortran_FORMAT","trigger":"CMAKE_Fortran_FORMAT\tbuiltin variable"},{"contents":"CMAKE_Fortran_MODDIR_DEFAULT","trigger":"CMAKE_Fortran_MODDIR_DEFAULT\tbuiltin variable"},{"contents":"CMAKE_Fortran_MODDIR_FLAG","trigger":"CMAKE_Fortran_MODDIR_FLAG\tbuiltin variable"},{"contents":"CMAKE_Fortran_MODOUT_FLAG","trigger":"CMAKE_Fortran_MODOUT_FLAG\tbuiltin variable"},{"contents":"CMAKE_Fortran_MODULE_DIRECTORY","trigger":"CMAKE_Fortran_MODULE_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_Fortran_PREPROCESS","trigger":"CMAKE_Fortran_PREPROCESS\tbuiltin variable"},{"contents":"CMAKE_GENERATOR","trigger":"CMAKE_GENERATOR\tbuiltin variable"},{"contents":"CMAKE_GENERATOR_INSTANCE","trigger":"CMAKE_GENERATOR_INSTANCE\tbuiltin variable"},{"contents":"CMAKE_GENERATOR_PLATFORM","trigger":"CMAKE_GENERATOR_PLATFORM\tbuiltin variable"},{"contents":"CMAKE_GENERATOR_TOOLSET","trigger":"CMAKE_GENERATOR_TOOLSET\tbuiltin variable"},{"contents":"CMAKE_GHS_NO_SOURCE_GROUP_FILE","trigger":"CMAKE_GHS_NO_SOURCE_GROUP_FILE\tbuiltin variable"},{"contents":"CMAKE_GLOBAL_AUTOGEN_TARGET","trigger":"CMAKE_GLOBAL_AUTOGEN_TARGET\tbuiltin variable"},{"contents":"CMAKE_GLOBAL_AUTOGEN_TARGET_NAME","trigger":"CMAKE_GLOBAL_AUTOGEN_TARGET_NAME\tbuiltin variable"},{"contents":"CMAKE_GLOBAL_AUTORCC_TARGET","trigger":"CMAKE_GLOBAL_AUTORCC_TARGET\tbuiltin variable"},{"contents":"CMAKE_GLOBAL_AUTORCC_TARGET_NAME","trigger":"CMAKE_GLOBAL_AUTORCC_TARGET_NAME\tbuiltin variable"},{"contents":"CMAKE_GNUtoMS","trigger":"CMAKE_GNUtoMS\tbuiltin variable"},{"contents":"CMAKE_HOME_DIRECTORY","trigger":"CMAKE_HOME_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_HOST_APPLE","trigger":"CMAKE_HOST_APPLE\tbuiltin variable"},{"contents":"CMAKE_HOST_SOLARIS","trigger":"CMAKE_HOST_SOLARIS\tbuiltin variable"},{"contents":"CMAKE_HOST_SYSTEM","trigger":"CMAKE_HOST_SYSTEM\tbuiltin variable"},{"contents":"CMAKE_HOST_SYSTEM_NAME","trigger":"CMAKE_HOST_SYSTEM_NAME\tbuiltin variable"},{"contents":"CMAKE_HOST_SYSTEM_PROCESSOR","trigger":"CMAKE_HOST_SYSTEM_PROCESSOR\tbuiltin variable"},{"contents":"CMAKE_HOST_SYSTEM_VERSION","trigger":"CMAKE_HOST_SYSTEM_VERSION\tbuiltin variable"},{"contents":"CMAKE_HOST_UNIX","trigger":"CMAKE_HOST_UNIX\tbuiltin variable"},{"contents":"CMAKE_HOST_WIN32","trigger":"CMAKE_HOST_WIN32\tbuiltin variable"},{"contents":"CMAKE_IGNORE_PATH","trigger":"CMAKE_IGNORE_PATH\tbuiltin variable"},{"contents":"CMAKE_IMPORT_LIBRARY_PREFIX","trigger":"CMAKE_IMPORT_LIBRARY_PREFIX\tbuiltin variable"},{"contents":"CMAKE_IMPORT_LIBRARY_SUFFIX","trigger":"CMAKE_IMPORT_LIBRARY_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_INCLUDE_CURRENT_DIR","trigger":"CMAKE_INCLUDE_CURRENT_DIR\tbuiltin variable"},{"contents":"CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE","trigger":"CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE\tbuiltin variable"},{"contents":"CMAKE_INCLUDE_DIRECTORIES_BEFORE","trigger":"CMAKE_INCLUDE_DIRECTORIES_BEFORE\tbuiltin variable"},{"contents":"CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE","trigger":"CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE\tbuiltin variable"},{"contents":"CMAKE_INCLUDE_PATH","trigger":"CMAKE_INCLUDE_PATH\tbuiltin variable"},{"contents":"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME","trigger":"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME\tbuiltin variable"},{"contents":"CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS","trigger":"CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS\tbuiltin variable"},{"contents":"CMAKE_INSTALL_MESSAGE","trigger":"CMAKE_INSTALL_MESSAGE\tbuiltin variable"},{"contents":"CMAKE_INSTALL_NAME_DIR","trigger":"CMAKE_INSTALL_NAME_DIR\tbuiltin variable"},{"contents":"CMAKE_INSTALL_PREFIX","trigger":"CMAKE_INSTALL_PREFIX\tbuiltin variable"},{"contents":"CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT","trigger":"CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT\tbuiltin variable"},{"contents":"CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH","trigger":"CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH\tbuiltin variable"},{"contents":"CMAKE_INSTALL_RPATH","trigger":"CMAKE_INSTALL_RPATH\tbuiltin variable"},{"contents":"CMAKE_INSTALL_RPATH_USE_LINK_PATH","trigger":"CMAKE_INSTALL_RPATH_USE_LINK_PATH\tbuiltin variable"},{"contents":"CMAKE_INTERNAL_PLATFORM_ABI","trigger":"CMAKE_INTERNAL_PLATFORM_ABI\tbuiltin variable"},{"contents":"CMAKE_INTERPROCEDURAL_OPTIMIZATION","trigger":"CMAKE_INTERPROCEDURAL_OPTIMIZATION\tbuiltin variable"},{"contents":"CMAKE_IOS_INSTALL_COMBINED","trigger":"CMAKE_IOS_INSTALL_COMBINED\tbuiltin variable"},{"contents":"CMAKE_ISPC_HEADER_DIRECTORY","trigger":"CMAKE_ISPC_HEADER_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_ISPC_HEADER_SUFFIX","trigger":"CMAKE_ISPC_HEADER_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_ISPC_INSTRUCTION_SETS","trigger":"CMAKE_ISPC_INSTRUCTION_SETS\tbuiltin variable"},{"contents":"CMAKE_JOB_POOLS","trigger":"CMAKE_JOB_POOLS\tbuiltin variable"},{"contents":"CMAKE_JOB_POOL_COMPILE","trigger":"CMAKE_JOB_POOL_COMPILE\tbuiltin variable"},{"contents":"CMAKE_JOB_POOL_LINK","trigger":"CMAKE_JOB_POOL_LINK\tbuiltin variable"},{"contents":"CMAKE_JOB_POOL_PRECOMPILE_HEADER","trigger":"CMAKE_JOB_POOL_PRECOMPILE_HEADER\tbuiltin variable"},{"contents":"CMAKE_LIBRARY_ARCHITECTURE","trigger":"CMAKE_LIBRARY_ARCHITECTURE\tbuiltin variable"},{"contents":"CMAKE_LIBRARY_ARCHITECTURE_REGEX","trigger":"CMAKE_LIBRARY_ARCHITECTURE_REGEX\tbuiltin variable"},{"contents":"CMAKE_LIBRARY_OUTPUT_DIRECTORY","trigger":"CMAKE_LIBRARY_OUTPUT_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_LIBRARY_PATH","trigger":"CMAKE_LIBRARY_PATH\tbuiltin variable"},{"contents":"CMAKE_LIBRARY_PATH_FLAG","trigger":"CMAKE_LIBRARY_PATH_FLAG\tbuiltin variable"},{"contents":"CMAKE_LINK_DEF_FILE_FLAG","trigger":"CMAKE_LINK_DEF_FILE_FLAG\tbuiltin variable"},{"contents":"CMAKE_LINK_DEPENDS_NO_SHARED","trigger":"CMAKE_LINK_DEPENDS_NO_SHARED\tbuiltin variable"},{"contents":"CMAKE_LINK_DIRECTORIES_BEFORE","trigger":"CMAKE_LINK_DIRECTORIES_BEFORE\tbuiltin variable"},{"contents":"CMAKE_LINK_INTERFACE_LIBRARIES","trigger":"CMAKE_LINK_INTERFACE_LIBRARIES\tbuiltin variable"},{"contents":"CMAKE_LINK_LIBRARY_FILE_FLAG","trigger":"CMAKE_LINK_LIBRARY_FILE_FLAG\tbuiltin variable"},{"contents":"CMAKE_LINK_LIBRARY_FLAG","trigger":"CMAKE_LINK_LIBRARY_FLAG\tbuiltin variable"},{"contents":"CMAKE_LINK_LIBRARY_SUFFIX","trigger":"CMAKE_LINK_LIBRARY_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_LINK_SEARCH_END_STATIC","trigger":"CMAKE_LINK_SEARCH_END_STATIC\tbuiltin variable"},{"contents":"CMAKE_LINK_SEARCH_START_STATIC","trigger":"CMAKE_LINK_SEARCH_START_STATIC\tbuiltin variable"},{"contents":"CMAKE_LINK_WHAT_YOU_USE","trigger":"CMAKE_LINK_WHAT_YOU_USE\tbuiltin variable"},{"contents":"CMAKE_MACOSX_BUNDLE","trigger":"CMAKE_MACOSX_BUNDLE\tbuiltin variable"},{"contents":"CMAKE_MACOSX_RPATH","trigger":"CMAKE_MACOSX_RPATH\tbuiltin variable"},{"contents":"CMAKE_MAJOR_VERSION","trigger":"CMAKE_MAJOR_VERSION\tbuiltin variable"},{"contents":"CMAKE_MAKE_PROGRAM","trigger":"CMAKE_MAKE_PROGRAM\tbuiltin variable"},{"contents":"CMAKE_MATCH_COUNT","trigger":"CMAKE_MATCH_COUNT\tbuiltin variable"},{"contents":"CMAKE_MAXIMUM_RECURSION_DEPTH","trigger":"CMAKE_MAXIMUM_RECURSION_DEPTH\tbuiltin variable"},{"contents":"CMAKE_MESSAGE_CONTEXT","trigger":"CMAKE_MESSAGE_CONTEXT\tbuiltin variable"},{"contents":"CMAKE_MESSAGE_CONTEXT_SHOW","trigger":"CMAKE_MESSAGE_CONTEXT_SHOW\tbuiltin variable"},{"contents":"CMAKE_MESSAGE_INDENT","trigger":"CMAKE_MESSAGE_INDENT\tbuiltin variable"},{"contents":"CMAKE_MESSAGE_LOG_LEVEL","trigger":"CMAKE_MESSAGE_LOG_LEVEL\tbuiltin variable"},{"contents":"CMAKE_MFC_FLAG","trigger":"CMAKE_MFC_FLAG\tbuiltin variable"},{"contents":"CMAKE_MINIMUM_REQUIRED_VERSION","trigger":"CMAKE_MINIMUM_REQUIRED_VERSION\tbuiltin variable"},{"contents":"CMAKE_MINOR_VERSION","trigger":"CMAKE_MINOR_VERSION\tbuiltin variable"},{"contents":"CMAKE_MODULE_LINKER_FLAGS","trigger":"CMAKE_MODULE_LINKER_FLAGS\tbuiltin variable"},{"contents":"CMAKE_MODULE_LINKER_FLAGS_INIT","trigger":"CMAKE_MODULE_LINKER_FLAGS_INIT\tbuiltin variable"},{"contents":"CMAKE_MODULE_PATH","trigger":"CMAKE_MODULE_PATH\tbuiltin variable"},{"contents":"CMAKE_MSVCIDE_RUN_PATH","trigger":"CMAKE_MSVCIDE_RUN_PATH\tbuiltin variable"},{"contents":"CMAKE_MSVC_RUNTIME_LIBRARY","trigger":"CMAKE_MSVC_RUNTIME_LIBRARY\tbuiltin variable"},{"contents":"CMAKE_NETRC","trigger":"CMAKE_NETRC\tbuiltin variable"},{"contents":"CMAKE_NETRC_FILE","trigger":"CMAKE_NETRC_FILE\tbuiltin variable"},{"contents":"CMAKE_NINJA_OUTPUT_PATH_PREFIX","trigger":"CMAKE_NINJA_OUTPUT_PATH_PREFIX\tbuiltin variable"},{"contents":"CMAKE_NOT_USING_CONFIG_FLAGS","trigger":"CMAKE_NOT_USING_CONFIG_FLAGS\tbuiltin variable"},{"contents":"CMAKE_NO_BUILTIN_CHRPATH","trigger":"CMAKE_NO_BUILTIN_CHRPATH\tbuiltin variable"},{"contents":"CMAKE_NO_SYSTEM_FROM_IMPORTED","trigger":"CMAKE_NO_SYSTEM_FROM_IMPORTED\tbuiltin variable"},{"contents":"CMAKE_OBJCXX_EXTENSIONS","trigger":"CMAKE_OBJCXX_EXTENSIONS\tbuiltin variable"},{"contents":"CMAKE_OBJCXX_STANDARD","trigger":"CMAKE_OBJCXX_STANDARD\tbuiltin variable"},{"contents":"CMAKE_OBJCXX_STANDARD_REQUIRED","trigger":"CMAKE_OBJCXX_STANDARD_REQUIRED\tbuiltin variable"},{"contents":"CMAKE_OBJC_EXTENSIONS","trigger":"CMAKE_OBJC_EXTENSIONS\tbuiltin variable"},{"contents":"CMAKE_OBJC_STANDARD","trigger":"CMAKE_OBJC_STANDARD\tbuiltin variable"},{"contents":"CMAKE_OBJC_STANDARD_REQUIRED","trigger":"CMAKE_OBJC_STANDARD_REQUIRED\tbuiltin variable"},{"contents":"CMAKE_OBJECT_PATH_MAX","trigger":"CMAKE_OBJECT_PATH_MAX\tbuiltin variable"},{"contents":"CMAKE_OPTIMIZE_DEPENDENCIES","trigger":"CMAKE_OPTIMIZE_DEPENDENCIES\tbuiltin variable"},{"contents":"CMAKE_OSX_ARCHITECTURES","trigger":"CMAKE_OSX_ARCHITECTURES\tbuiltin variable"},{"contents":"CMAKE_OSX_DEPLOYMENT_TARGET","trigger":"CMAKE_OSX_DEPLOYMENT_TARGET\tbuiltin variable"},{"contents":"CMAKE_OSX_SYSROOT","trigger":"CMAKE_OSX_SYSROOT\tbuiltin variable"},{"contents":"CMAKE_PARENT_LIST_FILE","trigger":"CMAKE_PARENT_LIST_FILE\tbuiltin variable"},{"contents":"CMAKE_PATCH_VERSION","trigger":"CMAKE_PATCH_VERSION\tbuiltin variable"},{"contents":"CMAKE_PCH_INSTANTIATE_TEMPLATES","trigger":"CMAKE_PCH_INSTANTIATE_TEMPLATES\tbuiltin variable"},{"contents":"CMAKE_PCH_WARN_INVALID","trigger":"CMAKE_PCH_WARN_INVALID\tbuiltin variable"},{"contents":"CMAKE_PDB_OUTPUT_DIRECTORY","trigger":"CMAKE_PDB_OUTPUT_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_POSITION_INDEPENDENT_CODE","trigger":"CMAKE_POSITION_INDEPENDENT_CODE\tbuiltin variable"},{"contents":"CMAKE_PREFIX_PATH","trigger":"CMAKE_PREFIX_PATH\tbuiltin variable"},{"contents":"CMAKE_PROGRAM_PATH","trigger":"CMAKE_PROGRAM_PATH\tbuiltin variable"},{"contents":"CMAKE_PROJECT_DESCRIPTION","trigger":"CMAKE_PROJECT_DESCRIPTION\tbuiltin variable"},{"contents":"CMAKE_PROJECT_HOMEPAGE_URL","trigger":"CMAKE_PROJECT_HOMEPAGE_URL\tbuiltin variable"},{"contents":"CMAKE_PROJECT_INCLUDE","trigger":"CMAKE_PROJECT_INCLUDE\tbuiltin variable"},{"contents":"CMAKE_PROJECT_INCLUDE_BEFORE","trigger":"CMAKE_PROJECT_INCLUDE_BEFORE\tbuiltin variable"},{"contents":"CMAKE_PROJECT_NAME","trigger":"CMAKE_PROJECT_NAME\tbuiltin variable"},{"contents":"CMAKE_PROJECT_VERSION","trigger":"CMAKE_PROJECT_VERSION\tbuiltin variable"},{"contents":"CMAKE_PROJECT_VERSION_MAJOR","trigger":"CMAKE_PROJECT_VERSION_MAJOR\tbuiltin variable"},{"contents":"CMAKE_PROJECT_VERSION_MINOR","trigger":"CMAKE_PROJECT_VERSION_MINOR\tbuiltin variable"},{"contents":"CMAKE_PROJECT_VERSION_PATCH","trigger":"CMAKE_PROJECT_VERSION_PATCH\tbuiltin variable"},{"contents":"CMAKE_PROJECT_VERSION_TWEAK","trigger":"CMAKE_PROJECT_VERSION_TWEAK\tbuiltin variable"},{"contents":"CMAKE_RANLIB","trigger":"CMAKE_RANLIB\tbuiltin variable"},{"contents":"CMAKE_ROOT","trigger":"CMAKE_ROOT\tbuiltin variable"},{"contents":"CMAKE_RULE_MESSAGES","trigger":"CMAKE_RULE_MESSAGES\tbuiltin variable"},{"contents":"CMAKE_RUNTIME_OUTPUT_DIRECTORY","trigger":"CMAKE_RUNTIME_OUTPUT_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_SCRIPT_MODE_FILE","trigger":"CMAKE_SCRIPT_MODE_FILE\tbuiltin variable"},{"contents":"CMAKE_SHARED_LIBRARY_PREFIX","trigger":"CMAKE_SHARED_LIBRARY_PREFIX\tbuiltin variable"},{"contents":"CMAKE_SHARED_LIBRARY_SUFFIX","trigger":"CMAKE_SHARED_LIBRARY_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_SHARED_LINKER_FLAGS","trigger":"CMAKE_SHARED_LINKER_FLAGS\tbuiltin variable"},{"contents":"CMAKE_SHARED_LINKER_FLAGS_INIT","trigger":"CMAKE_SHARED_LINKER_FLAGS_INIT\tbuiltin variable"},{"contents":"CMAKE_SHARED_MODULE_PREFIX","trigger":"CMAKE_SHARED_MODULE_PREFIX\tbuiltin variable"},{"contents":"CMAKE_SHARED_MODULE_SUFFIX","trigger":"CMAKE_SHARED_MODULE_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_SIZEOF_VOID_P","trigger":"CMAKE_SIZEOF_VOID_P\tbuiltin variable"},{"contents":"CMAKE_SKIP_BUILD_RPATH","trigger":"CMAKE_SKIP_BUILD_RPATH\tbuiltin variable"},{"contents":"CMAKE_SKIP_INSTALL_ALL_DEPENDENCY","trigger":"CMAKE_SKIP_INSTALL_ALL_DEPENDENCY\tbuiltin variable"},{"contents":"CMAKE_SKIP_INSTALL_RPATH","trigger":"CMAKE_SKIP_INSTALL_RPATH\tbuiltin variable"},{"contents":"CMAKE_SKIP_INSTALL_RULES","trigger":"CMAKE_SKIP_INSTALL_RULES\tbuiltin variable"},{"contents":"CMAKE_SKIP_RPATH","trigger":"CMAKE_SKIP_RPATH\tbuiltin variable"},{"contents":"CMAKE_SOURCE_DIR","trigger":"CMAKE_SOURCE_DIR\tbuiltin variable"},{"contents":"CMAKE_STAGING_PREFIX","trigger":"CMAKE_STAGING_PREFIX\tbuiltin variable"},{"contents":"CMAKE_STATIC_LIBRARY_PREFIX","trigger":"CMAKE_STATIC_LIBRARY_PREFIX\tbuiltin variable"},{"contents":"CMAKE_STATIC_LIBRARY_SUFFIX","trigger":"CMAKE_STATIC_LIBRARY_SUFFIX\tbuiltin variable"},{"contents":"CMAKE_STATIC_LINKER_FLAGS","trigger":"CMAKE_STATIC_LINKER_FLAGS\tbuiltin variable"},{"contents":"CMAKE_STATIC_LINKER_FLAGS_INIT","trigger":"CMAKE_STATIC_LINKER_FLAGS_INIT\tbuiltin variable"},{"contents":"CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS","trigger":"CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS\tbuiltin variable"},{"contents":"CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE","trigger":"CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE\tbuiltin variable"},{"contents":"CMAKE_SUPPRESS_REGENERATION","trigger":"CMAKE_SUPPRESS_REGENERATION\tbuiltin variable"},{"contents":"CMAKE_SYSROOT","trigger":"CMAKE_SYSROOT\tbuiltin variable"},{"contents":"CMAKE_SYSROOT_COMPILE","trigger":"CMAKE_SYSROOT_COMPILE\tbuiltin variable"},{"contents":"CMAKE_SYSROOT_LINK","trigger":"CMAKE_SYSROOT_LINK\tbuiltin variable"},{"contents":"CMAKE_SYSTEM","trigger":"CMAKE_SYSTEM\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_APPBUNDLE_PATH","trigger":"CMAKE_SYSTEM_APPBUNDLE_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_FRAMEWORK_PATH","trigger":"CMAKE_SYSTEM_FRAMEWORK_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_IGNORE_PATH","trigger":"CMAKE_SYSTEM_IGNORE_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_INCLUDE_PATH","trigger":"CMAKE_SYSTEM_INCLUDE_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_LIBRARY_PATH","trigger":"CMAKE_SYSTEM_LIBRARY_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_NAME","trigger":"CMAKE_SYSTEM_NAME\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_PREFIX_PATH","trigger":"CMAKE_SYSTEM_PREFIX_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_PROCESSOR","trigger":"CMAKE_SYSTEM_PROCESSOR\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_PROGRAM_PATH","trigger":"CMAKE_SYSTEM_PROGRAM_PATH\tbuiltin variable"},{"contents":"CMAKE_SYSTEM_VERSION","trigger":"CMAKE_SYSTEM_VERSION\tbuiltin variable"},{"contents":"CMAKE_Swift_LANGUAGE_VERSION","trigger":"CMAKE_Swift_LANGUAGE_VERSION\tbuiltin variable"},{"contents":"CMAKE_Swift_MODULE_DIRECTORY","trigger":"CMAKE_Swift_MODULE_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_Swift_NUM_THREADS","trigger":"CMAKE_Swift_NUM_THREADS\tbuiltin variable"},{"contents":"CMAKE_TOOLCHAIN_FILE","trigger":"CMAKE_TOOLCHAIN_FILE\tbuiltin variable"},{"contents":"CMAKE_TRY_COMPILE_CONFIGURATION","trigger":"CMAKE_TRY_COMPILE_CONFIGURATION\tbuiltin variable"},{"contents":"CMAKE_TRY_COMPILE_PLATFORM_VARIABLES","trigger":"CMAKE_TRY_COMPILE_PLATFORM_VARIABLES\tbuiltin variable"},{"contents":"CMAKE_TRY_COMPILE_TARGET_TYPE","trigger":"CMAKE_TRY_COMPILE_TARGET_TYPE\tbuiltin variable"},{"contents":"CMAKE_TWEAK_VERSION","trigger":"CMAKE_TWEAK_VERSION\tbuiltin variable"},{"contents":"CMAKE_UNITY_BUILD","trigger":"CMAKE_UNITY_BUILD\tbuiltin variable"},{"contents":"CMAKE_UNITY_BUILD_BATCH_SIZE","trigger":"CMAKE_UNITY_BUILD_BATCH_SIZE\tbuiltin variable"},{"contents":"CMAKE_USER_MAKE_RULES_OVERRIDE","trigger":"CMAKE_USER_MAKE_RULES_OVERRIDE\tbuiltin variable"},{"contents":"CMAKE_USE_RELATIVE_PATHS","trigger":"CMAKE_USE_RELATIVE_PATHS\tbuiltin variable"},{"contents":"CMAKE_VERBOSE_MAKEFILE","trigger":"CMAKE_VERBOSE_MAKEFILE\tbuiltin variable"},{"contents":"CMAKE_VERSION","trigger":"CMAKE_VERSION\tbuiltin variable"},{"contents":"CMAKE_VISIBILITY_INLINES_HIDDEN","trigger":"CMAKE_VISIBILITY_INLINES_HIDDEN\tbuiltin variable"},{"contents":"CMAKE_VS_DEVENV_COMMAND","trigger":"CMAKE_VS_DEVENV_COMMAND\tbuiltin variable"},{"contents":"CMAKE_VS_GLOBALS","trigger":"CMAKE_VS_GLOBALS\tbuiltin variable"},{"contents":"CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD","trigger":"CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD\tbuiltin variable"},{"contents":"CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD","trigger":"CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD\tbuiltin variable"},{"contents":"CMAKE_VS_INTEL_Fortran_PROJECT_VERSION","trigger":"CMAKE_VS_INTEL_Fortran_PROJECT_VERSION\tbuiltin variable"},{"contents":"CMAKE_VS_JUST_MY_CODE_DEBUGGING","trigger":"CMAKE_VS_JUST_MY_CODE_DEBUGGING\tbuiltin variable"},{"contents":"CMAKE_VS_MSBUILD_COMMAND","trigger":"CMAKE_VS_MSBUILD_COMMAND\tbuiltin variable"},{"contents":"CMAKE_VS_NsightTegra_VERSION","trigger":"CMAKE_VS_NsightTegra_VERSION\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_NAME","trigger":"CMAKE_VS_PLATFORM_NAME\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_NAME_DEFAULT","trigger":"CMAKE_VS_PLATFORM_NAME_DEFAULT\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_TOOLSET","trigger":"CMAKE_VS_PLATFORM_TOOLSET\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_TOOLSET_CUDA","trigger":"CMAKE_VS_PLATFORM_TOOLSET_CUDA\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR","trigger":"CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE","trigger":"CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE\tbuiltin variable"},{"contents":"CMAKE_VS_PLATFORM_TOOLSET_VERSION","trigger":"CMAKE_VS_PLATFORM_TOOLSET_VERSION\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_EXCLUDE_DIRECTORIES","trigger":"CMAKE_VS_SDK_EXCLUDE_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES","trigger":"CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_INCLUDE_DIRECTORIES","trigger":"CMAKE_VS_SDK_INCLUDE_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_LIBRARY_DIRECTORIES","trigger":"CMAKE_VS_SDK_LIBRARY_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES","trigger":"CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_REFERENCE_DIRECTORIES","trigger":"CMAKE_VS_SDK_REFERENCE_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_SDK_SOURCE_DIRECTORIES","trigger":"CMAKE_VS_SDK_SOURCE_DIRECTORIES\tbuiltin variable"},{"contents":"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION","trigger":"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION\tbuiltin variable"},{"contents":"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM","trigger":"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM\tbuiltin variable"},{"contents":"CMAKE_VS_WINRT_BY_DEFAULT","trigger":"CMAKE_VS_WINRT_BY_DEFAULT\tbuiltin variable"},{"contents":"CMAKE_WARN_DEPRECATED","trigger":"CMAKE_WARN_DEPRECATED\tbuiltin variable"},{"contents":"CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION","trigger":"CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION\tbuiltin variable"},{"contents":"CMAKE_WIN32_EXECUTABLE","trigger":"CMAKE_WIN32_EXECUTABLE\tbuiltin variable"},{"contents":"CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS","trigger":"CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS\tbuiltin variable"},{"contents":"CMAKE_XCODE_BUILD_SYSTEM","trigger":"CMAKE_XCODE_BUILD_SYSTEM\tbuiltin variable"},{"contents":"CMAKE_XCODE_GENERATE_SCHEME","trigger":"CMAKE_XCODE_GENERATE_SCHEME\tbuiltin variable"},{"contents":"CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY","trigger":"CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY\tbuiltin variable"},{"contents":"CMAKE_XCODE_LINK_BUILD_PHASE_MODE","trigger":"CMAKE_XCODE_LINK_BUILD_PHASE_MODE\tbuiltin variable"},{"contents":"CMAKE_XCODE_PLATFORM_TOOLSET","trigger":"CMAKE_XCODE_PLATFORM_TOOLSET\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER","trigger":"CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN","trigger":"CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING","trigger":"CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER","trigger":"CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS","trigger":"CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE","trigger":"CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_ENVIRONMENT","trigger":"CMAKE_XCODE_SCHEME_ENVIRONMENT\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_GUARD_MALLOC","trigger":"CMAKE_XCODE_SCHEME_GUARD_MALLOC\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP","trigger":"CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES","trigger":"CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE","trigger":"CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_MALLOC_STACK","trigger":"CMAKE_XCODE_SCHEME_MALLOC_STACK\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_THREAD_SANITIZER","trigger":"CMAKE_XCODE_SCHEME_THREAD_SANITIZER\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP","trigger":"CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER","trigger":"CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP","trigger":"CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_WORKING_DIRECTORY","trigger":"CMAKE_XCODE_SCHEME_WORKING_DIRECTORY\tbuiltin variable"},{"contents":"CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS","trigger":"CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS\tbuiltin variable"},{"contents":"CPACK_ABSOLUTE_DESTINATION_FILES","trigger":"CPACK_ABSOLUTE_DESTINATION_FILES\tbuiltin variable"},{"contents":"CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY","trigger":"CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY\tbuiltin variable"},{"contents":"CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION","trigger":"CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION\tbuiltin variable"},{"contents":"CPACK_INCLUDE_TOPLEVEL_DIRECTORY","trigger":"CPACK_INCLUDE_TOPLEVEL_DIRECTORY\tbuiltin variable"},{"contents":"CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS","trigger":"CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS\tbuiltin variable"},{"contents":"CPACK_PACKAGING_INSTALL_PREFIX","trigger":"CPACK_PACKAGING_INSTALL_PREFIX\tbuiltin variable"},{"contents":"CPACK_SET_DESTDIR","trigger":"CPACK_SET_DESTDIR\tbuiltin variable"},{"contents":"CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION","trigger":"CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION\tbuiltin variable"},{"contents":"CTEST_BINARY_DIRECTORY","trigger":"CTEST_BINARY_DIRECTORY\tbuiltin variable"},{"contents":"CTEST_BUILD_COMMAND","trigger":"CTEST_BUILD_COMMAND\tbuiltin variable"},{"contents":"CTEST_BUILD_NAME","trigger":"CTEST_BUILD_NAME\tbuiltin variable"},{"contents":"CTEST_BZR_COMMAND","trigger":"CTEST_BZR_COMMAND\tbuiltin variable"},{"contents":"CTEST_BZR_UPDATE_OPTIONS","trigger":"CTEST_BZR_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_CHANGE_ID","trigger":"CTEST_CHANGE_ID\tbuiltin variable"},{"contents":"CTEST_CHECKOUT_COMMAND","trigger":"CTEST_CHECKOUT_COMMAND\tbuiltin variable"},{"contents":"CTEST_CONFIGURATION_TYPE","trigger":"CTEST_CONFIGURATION_TYPE\tbuiltin variable"},{"contents":"CTEST_CONFIGURE_COMMAND","trigger":"CTEST_CONFIGURE_COMMAND\tbuiltin variable"},{"contents":"CTEST_COVERAGE_COMMAND","trigger":"CTEST_COVERAGE_COMMAND\tbuiltin variable"},{"contents":"CTEST_COVERAGE_EXTRA_FLAGS","trigger":"CTEST_COVERAGE_EXTRA_FLAGS\tbuiltin variable"},{"contents":"CTEST_CURL_OPTIONS","trigger":"CTEST_CURL_OPTIONS\tbuiltin variable"},{"contents":"CTEST_CUSTOM_COVERAGE_EXCLUDE","trigger":"CTEST_CUSTOM_COVERAGE_EXCLUDE\tbuiltin variable"},{"contents":"CTEST_CUSTOM_ERROR_EXCEPTION","trigger":"CTEST_CUSTOM_ERROR_EXCEPTION\tbuiltin variable"},{"contents":"CTEST_CUSTOM_ERROR_MATCH","trigger":"CTEST_CUSTOM_ERROR_MATCH\tbuiltin variable"},{"contents":"CTEST_CUSTOM_ERROR_POST_CONTEXT","trigger":"CTEST_CUSTOM_ERROR_POST_CONTEXT\tbuiltin variable"},{"contents":"CTEST_CUSTOM_ERROR_PRE_CONTEXT","trigger":"CTEST_CUSTOM_ERROR_PRE_CONTEXT\tbuiltin variable"},{"contents":"CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE","trigger":"CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE\tbuiltin variable"},{"contents":"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS","trigger":"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS\tbuiltin variable"},{"contents":"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS","trigger":"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS\tbuiltin variable"},{"contents":"CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE","trigger":"CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE\tbuiltin variable"},{"contents":"CTEST_CUSTOM_MEMCHECK_IGNORE","trigger":"CTEST_CUSTOM_MEMCHECK_IGNORE\tbuiltin variable"},{"contents":"CTEST_CUSTOM_POST_MEMCHECK","trigger":"CTEST_CUSTOM_POST_MEMCHECK\tbuiltin variable"},{"contents":"CTEST_CUSTOM_POST_TEST","trigger":"CTEST_CUSTOM_POST_TEST\tbuiltin variable"},{"contents":"CTEST_CUSTOM_PRE_MEMCHECK","trigger":"CTEST_CUSTOM_PRE_MEMCHECK\tbuiltin variable"},{"contents":"CTEST_CUSTOM_PRE_TEST","trigger":"CTEST_CUSTOM_PRE_TEST\tbuiltin variable"},{"contents":"CTEST_CUSTOM_TESTS_IGNORE","trigger":"CTEST_CUSTOM_TESTS_IGNORE\tbuiltin variable"},{"contents":"CTEST_CUSTOM_WARNING_EXCEPTION","trigger":"CTEST_CUSTOM_WARNING_EXCEPTION\tbuiltin variable"},{"contents":"CTEST_CUSTOM_WARNING_MATCH","trigger":"CTEST_CUSTOM_WARNING_MATCH\tbuiltin variable"},{"contents":"CTEST_CVS_CHECKOUT","trigger":"CTEST_CVS_CHECKOUT\tbuiltin variable"},{"contents":"CTEST_CVS_COMMAND","trigger":"CTEST_CVS_COMMAND\tbuiltin variable"},{"contents":"CTEST_CVS_UPDATE_OPTIONS","trigger":"CTEST_CVS_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_DROP_LOCATION","trigger":"CTEST_DROP_LOCATION\tbuiltin variable"},{"contents":"CTEST_DROP_METHOD","trigger":"CTEST_DROP_METHOD\tbuiltin variable"},{"contents":"CTEST_DROP_SITE","trigger":"CTEST_DROP_SITE\tbuiltin variable"},{"contents":"CTEST_DROP_SITE_CDASH","trigger":"CTEST_DROP_SITE_CDASH\tbuiltin variable"},{"contents":"CTEST_DROP_SITE_PASSWORD","trigger":"CTEST_DROP_SITE_PASSWORD\tbuiltin variable"},{"contents":"CTEST_DROP_SITE_USER","trigger":"CTEST_DROP_SITE_USER\tbuiltin variable"},{"contents":"CTEST_EXTRA_COVERAGE_GLOB","trigger":"CTEST_EXTRA_COVERAGE_GLOB\tbuiltin variable"},{"contents":"CTEST_GIT_COMMAND","trigger":"CTEST_GIT_COMMAND\tbuiltin variable"},{"contents":"CTEST_GIT_INIT_SUBMODULES","trigger":"CTEST_GIT_INIT_SUBMODULES\tbuiltin variable"},{"contents":"CTEST_GIT_UPDATE_CUSTOM","trigger":"CTEST_GIT_UPDATE_CUSTOM\tbuiltin variable"},{"contents":"CTEST_GIT_UPDATE_OPTIONS","trigger":"CTEST_GIT_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_HG_COMMAND","trigger":"CTEST_HG_COMMAND\tbuiltin variable"},{"contents":"CTEST_HG_UPDATE_OPTIONS","trigger":"CTEST_HG_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_LABELS_FOR_SUBPROJECTS","trigger":"CTEST_LABELS_FOR_SUBPROJECTS\tbuiltin variable"},{"contents":"CTEST_MEMORYCHECK_COMMAND","trigger":"CTEST_MEMORYCHECK_COMMAND\tbuiltin variable"},{"contents":"CTEST_MEMORYCHECK_COMMAND_OPTIONS","trigger":"CTEST_MEMORYCHECK_COMMAND_OPTIONS\tbuiltin variable"},{"contents":"CTEST_MEMORYCHECK_SANITIZER_OPTIONS","trigger":"CTEST_MEMORYCHECK_SANITIZER_OPTIONS\tbuiltin variable"},{"contents":"CTEST_MEMORYCHECK_SUPPRESSIONS_FILE","trigger":"CTEST_MEMORYCHECK_SUPPRESSIONS_FILE\tbuiltin variable"},{"contents":"CTEST_MEMORYCHECK_TYPE","trigger":"CTEST_MEMORYCHECK_TYPE\tbuiltin variable"},{"contents":"CTEST_NIGHTLY_START_TIME","trigger":"CTEST_NIGHTLY_START_TIME\tbuiltin variable"},{"contents":"CTEST_P4_CLIENT","trigger":"CTEST_P4_CLIENT\tbuiltin variable"},{"contents":"CTEST_P4_COMMAND","trigger":"CTEST_P4_COMMAND\tbuiltin variable"},{"contents":"CTEST_P4_OPTIONS","trigger":"CTEST_P4_OPTIONS\tbuiltin variable"},{"contents":"CTEST_P4_UPDATE_OPTIONS","trigger":"CTEST_P4_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_RESOURCE_SPEC_FILE","trigger":"CTEST_RESOURCE_SPEC_FILE\tbuiltin variable"},{"contents":"CTEST_RUN_CURRENT_SCRIPT","trigger":"CTEST_RUN_CURRENT_SCRIPT\tbuiltin variable"},{"contents":"CTEST_SCP_COMMAND","trigger":"CTEST_SCP_COMMAND\tbuiltin variable"},{"contents":"CTEST_SITE","trigger":"CTEST_SITE\tbuiltin variable"},{"contents":"CTEST_SOURCE_DIRECTORY","trigger":"CTEST_SOURCE_DIRECTORY\tbuiltin variable"},{"contents":"CTEST_SUBMIT_URL","trigger":"CTEST_SUBMIT_URL\tbuiltin variable"},{"contents":"CTEST_SVN_COMMAND","trigger":"CTEST_SVN_COMMAND\tbuiltin variable"},{"contents":"CTEST_SVN_OPTIONS","trigger":"CTEST_SVN_OPTIONS\tbuiltin variable"},{"contents":"CTEST_SVN_UPDATE_OPTIONS","trigger":"CTEST_SVN_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_TEST_LOAD","trigger":"CTEST_TEST_LOAD\tbuiltin variable"},{"contents":"CTEST_TEST_TIMEOUT","trigger":"CTEST_TEST_TIMEOUT\tbuiltin variable"},{"contents":"CTEST_TRIGGER_SITE","trigger":"CTEST_TRIGGER_SITE\tbuiltin variable"},{"contents":"CTEST_UPDATE_COMMAND","trigger":"CTEST_UPDATE_COMMAND\tbuiltin variable"},{"contents":"CTEST_UPDATE_OPTIONS","trigger":"CTEST_UPDATE_OPTIONS\tbuiltin variable"},{"contents":"CTEST_UPDATE_VERSION_ONLY","trigger":"CTEST_UPDATE_VERSION_ONLY\tbuiltin variable"},{"contents":"CTEST_UPDATE_VERSION_OVERRIDE","trigger":"CTEST_UPDATE_VERSION_OVERRIDE\tbuiltin variable"},{"contents":"CTEST_USE_LAUNCHERS","trigger":"CTEST_USE_LAUNCHERS\tbuiltin variable"},{"contents":"CYGWIN","trigger":"CYGWIN\tbuiltin variable"},{"contents":"ENV","trigger":"ENV\tbuiltin variable"},{"contents":"EXECUTABLE_OUTPUT_PATH","trigger":"EXECUTABLE_OUTPUT_PATH\tbuiltin variable"},{"contents":"GHS-MULTI","trigger":"GHS-MULTI\tbuiltin variable"},{"contents":"IOS","trigger":"IOS\tbuiltin variable"},{"contents":"LIBRARY_OUTPUT_PATH","trigger":"LIBRARY_OUTPUT_PATH\tbuiltin variable"},{"contents":"MINGW","trigger":"MINGW\tbuiltin variable"},{"contents":"MSVC","trigger":"MSVC\tbuiltin variable"},{"contents":"MSVC10","trigger":"MSVC10\tbuiltin variable"},{"contents":"MSVC11","trigger":"MSVC11\tbuiltin variable"},{"contents":"MSVC12","trigger":"MSVC12\tbuiltin variable"},{"contents":"MSVC14","trigger":"MSVC14\tbuiltin variable"},{"contents":"MSVC60","trigger":"MSVC60\tbuiltin variable"},{"contents":"MSVC70","trigger":"MSVC70\tbuiltin variable"},{"contents":"MSVC71","trigger":"MSVC71\tbuiltin variable"},{"contents":"MSVC80","trigger":"MSVC80\tbuiltin variable"},{"contents":"MSVC90","trigger":"MSVC90\tbuiltin variable"},{"contents":"MSVC_IDE","trigger":"MSVC_IDE\tbuiltin variable"},{"contents":"MSVC_TOOLSET_VERSION","trigger":"MSVC_TOOLSET_VERSION\tbuiltin variable"},{"contents":"MSVC_VERSION","trigger":"MSVC_VERSION\tbuiltin variable"},{"contents":"MSYS","trigger":"MSYS\tbuiltin variable"},{"contents":"PROJECT_BINARY_DIR","trigger":"PROJECT_BINARY_DIR\tbuiltin variable"},{"contents":"PROJECT_DESCRIPTION","trigger":"PROJECT_DESCRIPTION\tbuiltin variable"},{"contents":"PROJECT_HOMEPAGE_URL","trigger":"PROJECT_HOMEPAGE_URL\tbuiltin variable"},{"contents":"PROJECT_NAME","trigger":"PROJECT_NAME\tbuiltin variable"},{"contents":"PROJECT_SOURCE_DIR","trigger":"PROJECT_SOURCE_DIR\tbuiltin variable"},{"contents":"PROJECT_VERSION","trigger":"PROJECT_VERSION\tbuiltin variable"},{"contents":"PROJECT_VERSION_MAJOR","trigger":"PROJECT_VERSION_MAJOR\tbuiltin variable"},{"contents":"PROJECT_VERSION_MINOR","trigger":"PROJECT_VERSION_MINOR\tbuiltin variable"},{"contents":"PROJECT_VERSION_PATCH","trigger":"PROJECT_VERSION_PATCH\tbuiltin variable"},{"contents":"PROJECT_VERSION_TWEAK","trigger":"PROJECT_VERSION_TWEAK\tbuiltin variable"},{"contents":"UNIX","trigger":"UNIX\tbuiltin variable"},{"contents":"WIN32","trigger":"WIN32\tbuiltin variable"},{"contents":"WINCE","trigger":"WINCE\tbuiltin variable"},{"contents":"WINDOWS_PHONE","trigger":"WINDOWS_PHONE\tbuiltin variable"},{"contents":"WINDOWS_STORE","trigger":"WINDOWS_STORE\tbuiltin variable"},{"contents":"XCODE","trigger":"XCODE\tbuiltin variable"},{"contents":"XCODE_VERSION","trigger":"XCODE_VERSION\tbuiltin variable"}],"scope":"variable.other.readwrite.cmake"}
1194+assets/syntaxes/02_Extra/CMake/CMakeCommands.sublime-syntax:30: - match: \bVERBATIM\b
1195+assets/syntaxes/02_Extra/CMake/CMakeCommands.sublime-syntax:31: scope: variable.parameter.VERBATIM.cmake
1196+assets/syntaxes/02_Extra/CMake/CMakeCommands.sublime-syntax:59: - match: \bVERBATIM\b
1197+assets/syntaxes/02_Extra/CMake/CMakeCommands.sublime-syntax:60: scope: variable.parameter.VERBATIM.cmake
1198+assets/syntaxes/02_Extra/SCSS_Sass/Syntaxes/Sass.sublime-syntax:1830: - match: '\bat\b'
1199+assets/syntaxes/02_Extra/Elixir/builds/Elixir - mix format $file.sublime-build:6: "cmd": ["mix.bat", "format", "$file", "--dot-formatter", "$folder/.formatter.exs"],
1200+assets/syntaxes/02_Extra/Elixir/builds/Elixir - elixir $file.sublime-build:6: "cmd": ["elixir.bat", "$file_name"]
1201+assets/syntaxes/02_Extra/Lean.sublime-syntax:23: - match: '\battribute\b\s*\[[^\]]*\]'
1202+assets/syntaxes/02_Extra/PowerShell.sublime-syntax:86: - match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
1203+assets/syntaxes/02_Extra/PowerShell.sublime-syntax:174: - match: '(?:(\p{L}|\d|_|-|\\|\:)*\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b'
1204+assets/syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax:129: - meta_content_scope: meta.environment.embedded.dosbatch.mediawiki source.dosbatch.embedded
1205+assets/syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax:132: - include: scope:source.dosbatch
1206+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.lin.x64/Crypto/Util/RFC1751.py:125: "BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", "BEN", "BET",
1207+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.lin.x64/Crypto/Util/RFC1751.py:189: "BARN", "BARR", "BASE", "BASH", "BASK", "BASS", "BATE", "BATH",
1208+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.lin.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_test.json:12177: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMGowFAYHKoZIzj0CAQYJKyQDAwIIAQEJA1IABHJlM+Jnc6xyChFbAt6JrBWWZnfi\nObfFd6HBW4ECex/rc+ZzYB4hGqkqzLWFvAbMJ0thyeYUdG7dJI0czPjYsatLwVzF\njN8RYGXOl2fyoyI9\n-----END PUBLIC KEY-----",
1209+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.lin.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_test.json:13141: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMHowFAYHKoZIzj0CAQYJKyQDAwIIAQELA2IABATZ1KYtbrAgc+c4seQ5zs1UQAMZ\nEfRRkOtgYqM1NfxSabz8JdSvwdrg662UjXcy2AKa836Jo86n3ziwIPYkkG/KbZRO\nFIaFP+jlupz7otdKhS7Fh9Rv5JkXw2RBjvfspQ==\n-----END PUBLIC KEY-----",
1210+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.lin.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_secp256r1_sha256_test.json:2410: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3q0Rx6WzloYvIZdNxHUvre/5lO/p\nu9BatBN2XqgLbh8d4/BkDorG7c+Jz/U8QOJlu5QHijQ3Nt8HqgMY/H/h/w==\n-----END PUBLIC KEY-----",
1211+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.lin.x64/Crypto/SelfTest/PublicKey/test_import_RSA.py:444:MIIEcjCCAlqgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJVUzEL
1212+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.win.x64/Crypto/Util/RFC1751.py:125: "BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", "BEN", "BET",
1213+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.win.x64/Crypto/Util/RFC1751.py:189: "BARN", "BARR", "BASE", "BASH", "BASK", "BASS", "BATE", "BATH",
1214+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.win.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_test.json:12177: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMGowFAYHKoZIzj0CAQYJKyQDAwIIAQEJA1IABHJlM+Jnc6xyChFbAt6JrBWWZnfi\nObfFd6HBW4ECex/rc+ZzYB4hGqkqzLWFvAbMJ0thyeYUdG7dJI0czPjYsatLwVzF\njN8RYGXOl2fyoyI9\n-----END PUBLIC KEY-----",
1215+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.win.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_test.json:13141: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMHowFAYHKoZIzj0CAQYJKyQDAwIIAQELA2IABATZ1KYtbrAgc+c4seQ5zs1UQAMZ\nEfRRkOtgYqM1NfxSabz8JdSvwdrg662UjXcy2AKa836Jo86n3ziwIPYkkG/KbZRO\nFIaFP+jlupz7otdKhS7Fh9Rv5JkXw2RBjvfspQ==\n-----END PUBLIC KEY-----",
1216+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.win.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_secp256r1_sha256_test.json:2410: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3q0Rx6WzloYvIZdNxHUvre/5lO/p\nu9BatBN2XqgLbh8d4/BkDorG7c+Jz/U8QOJlu5QHijQ3Nt8HqgMY/H/h/w==\n-----END PUBLIC KEY-----",
1217+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.win.x64/Crypto/SelfTest/PublicKey/test_import_RSA.py:444:MIIEcjCCAlqgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJVUzEL
1218+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.osx.x64/Crypto/Util/RFC1751.py:125: "BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", "BEN", "BET",
1219+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.osx.x64/Crypto/Util/RFC1751.py:189: "BARN", "BARR", "BASE", "BASH", "BASK", "BASS", "BATE", "BATH",
1220+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.osx.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_test.json:12177: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMGowFAYHKoZIzj0CAQYJKyQDAwIIAQEJA1IABHJlM+Jnc6xyChFbAt6JrBWWZnfi\nObfFd6HBW4ECex/rc+ZzYB4hGqkqzLWFvAbMJ0thyeYUdG7dJI0czPjYsatLwVzF\njN8RYGXOl2fyoyI9\n-----END PUBLIC KEY-----",
1221+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.osx.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_test.json:13141: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMHowFAYHKoZIzj0CAQYJKyQDAwIIAQELA2IABATZ1KYtbrAgc+c4seQ5zs1UQAMZ\nEfRRkOtgYqM1NfxSabz8JdSvwdrg662UjXcy2AKa836Jo86n3ziwIPYkkG/KbZRO\nFIaFP+jlupz7otdKhS7Fh9Rv5JkXw2RBjvfspQ==\n-----END PUBLIC KEY-----",
1222+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.osx.x64/Crypto/SelfTest/Signature/test_vectors/wycheproof/ecdsa_secp256r1_sha256_test.json:2410: "keyPem" : "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3q0Rx6WzloYvIZdNxHUvre/5lO/p\nu9BatBN2XqgLbh8d4/BkDorG7c+Jz/U8QOJlu5QHijQ3Nt8HqgMY/H/h/w==\n-----END PUBLIC KEY-----",
1223+assets/syntaxes/02_Extra/MediaWiki/lib/Crypto.osx.x64/Crypto/SelfTest/PublicKey/test_import_RSA.py:444:MIIEcjCCAlqgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJVUzEL
1224+assets/syntaxes/02_Extra/Julia/julia_unicode/emoji_symbols.py:69: ("\\:battery:", u"🔋"),
1225+assets/syntaxes/02_Extra/Julia/julia_unicode/emoji_symbols.py:576: ("\\:tanabata_tree:", u"🎋"),
1226+assets/syntaxes/02_Extra/Julia/julia_unicode/emoji_symbols.py:729: ("\\:bath:", u"🛀"),
1227+assets/syntaxes/02_Extra/Julia/julia_unicode/emoji_symbols.py:804: ("\\:bathtub:", u"🛁"),
1228+assets/syntaxes/02_Extra/Crystal.sublime-syntax:136: - match: '\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|context|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn|annotation|verbatim)\b[!?]?'
1229+assets/syntaxes/02_Extra/Dart/docgen.py:30: cmd = ["docgen.bat", "--no-include-sdk", path]
1230+assets/syntaxes/02_Extra/Dart/docgen.py:58: cmd = ["docgen.bat", "--no-include-sdk", "--serve", path]
1231+assets/syntaxes/02_Extra/Dart/lib/sdk.py:177: return self.get_bin_tool('pub', '.bat')
1232+assets/syntaxes/02_Extra/Dart/lib/sdk.py:183: return self.get_bin_tool('dart2js', '.bat')
1233+assets/syntaxes/02_Extra/Dart/lib/sdk.py:189: return self.get_bin_tool('dartanalyzer', '.bat')
1234+assets/syntaxes/02_Extra/Dart/lib/sdk.py:195: return self.get_bin_tool('docgen', '.bat')
1235+assets/syntaxes/02_Extra/Dart/lib/sdk.py:247: self.path = SDK().get_bin_tool('dartfmt', '.bat')
1236+assets/syntaxes/02_Extra/Dart/sublime_plugin_lib/path.py:142: Useful to add .exe to @original, .bat, etc if ST is running on Windows.
1237+assets/syntaxes/02_Extra/Dart/sublime_plugin_lib/path.py:186: """ Useful to add .exe, .bat, etc. to @original if ST is running on
1238+assets/syntaxes/02_Extra/Dart/Support/Dart.sublime-build:19: "cmd": ["dart2js.bat", "--minify", "-o$file.js", "$file"]
1239+assets/syntaxes/02_Extra/Dart/Support/Dart - Pubspec.sublime-build:21: "cmd": ["pub.bat", "upgrade"]
1240+assets/syntaxes/02_Extra/Dart/Support/Dart - Pubspec.sublime-build:36: "cmd": ["pub.bat", "version"]
1241+assets/syntaxes/02_Extra/LESS/Syntaxes/LESS.sublime-syntax:1709: - match: '\bat\b'
1242+assets/syntaxes/02_Extra/Email/README.md:15::mouse: Using [bat](https://github.com/sharkdp/bat) *(bat is a cat clone with syntax highlighting and Git integration)*
1243+assets/syntaxes/02_Extra/Email/README.md:16:![bat](https://raw.githubusercontent.com/mariozaizar/email.sublime-syntax/master/demo/bat.png)
1244+assets/syntaxes/02_Extra/Email/link_bat.sh:3:# We use bat to verify the sintax. bat is a cat clone with syntax highlighting
1245+assets/syntaxes/02_Extra/Email/link_bat.sh:4:# and Git integration. bat uses syntect library for syntax highlighting which
1246+assets/syntaxes/02_Extra/Email/link_bat.sh:7:# https://github.com/sharkdp/bat
1247+assets/syntaxes/02_Extra/Email/link_bat.sh:9:bat --version || brew install bat # Mac OS only
1248+assets/syntaxes/02_Extra/Email/link_bat.sh:11:BAT_PATH=$(bat --config-dir)
1249+assets/syntaxes/02_Extra/Email/link_bat.sh:13:mkdir -p "$BAT_PATH/syntaxes"
1250+assets/syntaxes/02_Extra/Email/link_bat.sh:14:mkdir -p "$BAT_PATH/themes"
1251+assets/syntaxes/02_Extra/Email/link_bat.sh:16:INSTALL_PATH=${BAT_PATH}/syntaxes
1252+assets/syntaxes/02_Extra/Email/link_bat.sh:19:bat cache --build
1253+assets/syntaxes/02_Extra/Email/link_bat.sh:20:bat --list-languages | grep "Email"
1254+assets/syntaxes/02_Extra/Email/link_bat.sh:22:bat demo/email.eml
1255+assets/syntaxes/02_Extra/TypeScript.sublime-syntax:2446: |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
1256+assets/syntaxes/02_Extra/HTML (Twig)/Preferences/Indentation.tmPreferences:22: ^\s*\{%-?\s(end(?:autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless|trans|verbatim)|(else))(?:(?!%\}).)*\s-?%\}
1257+assets/syntaxes/02_Extra/HTML (Twig)/Preferences/Indentation.tmPreferences:36: ^\s*\{%-?\s(autoescape|block|embed|filter|for|if|else|macro|raw|sandbox|set|spaceless|trans|verbatim)(?:(?!%\}).)*\s-?%\}(?!.*\{%-?\send\1)
1258+assets/syntaxes/02_Extra/HTML (Twig)/Preferences/Folding.tmPreferences:16: |\{%\s+(autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless|trans|verbatim)
1259+assets/syntaxes/02_Extra/HTML (Twig)/Preferences/Folding.tmPreferences:23: |\{%\s+end(autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless|trans|verbatim)
1260+assets/syntaxes/02_Extra/HTML (Twig)/Snippets/verbatim.tmSnippet:6: <string>{% verbatim %}
1261+assets/syntaxes/02_Extra/HTML (Twig)/Snippets/verbatim.tmSnippet:8:{% endverbatim %}</string>
1262+assets/syntaxes/02_Extra/HTML (Twig)/Snippets/verbatim.tmSnippet:10: <string>verbatim</string>
1263+assets/syntaxes/02_Extra/HTML (Twig)/Snippets/verbatim.tmSnippet:14: <string>verbatim</string>
1264+assets/syntaxes/02_Extra/HTML (Twig)/Syntaxes/HTML (Twig).tmLanguage:1374: <string>(?&lt;=\s)((?:end)?(?:autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless|trans|verbatim)|as|do|else|elseif|extends|flush|from|ignore missing|import|include|only|use|with)(?=\s)</string>
1265+assets/syntaxes/02_Extra/HTML (Twig)/Syntaxes/HTML (Twig).tmLanguage:1590: <string>(?&lt;=(?:[a-zA-Z0-9_\x{7f}-\x{ff}\]\)\'\"]\|)|\{%\sfilter\s)(batch|convert_encoding|date|date_modify|default|e(?:scape)?|format|join|merge|number_format|replace|round|slice|split|trim)(\()</string>
1266+assets/syntaxes/02_Extra/requirementstxt/LICENSE:5: Everyone is permitted to copy and distribute verbatim copies
1267+assets/syntaxes/02_Extra/requirementstxt/LICENSE:195: 4. Conveying Verbatim Copies.
1268+assets/syntaxes/02_Extra/requirementstxt/LICENSE:197: You may convey verbatim copies of the Program's source code as you
1269+assets/syntaxes/01_Packages/Batch File/Symbol List.tmPreferences:7: <string>source.dosbatch entity.name.label - meta.function-call</string>
1270+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:4:name: Batch File
1271+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:6: - bat
1272+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:8:scope: source.dosbatch
1273+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:31: scope: keyword.control.statement.dosbatch
1274+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:34: 1: keyword.control.statement.dosbatch
1275+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:35: 2: punctuation.separator.dosbatch
1276+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:36: 3: keyword.control.flow.return.dosbatch
1277+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:37: 4: meta.function-call.dosbatch variable.function.dosbatch
1278+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:40: 1: keyword.control.conditional.dosbatch
1279+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:41: 2: keyword.operator.logical.dosbatch
1280+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:42: 3: keyword.other.dosbatch
1281+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:44: scope: keyword.control.conditional.dosbatch
1282+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:46: scope: keyword.control.repeat.dosbatch
1283+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:50: scope: keyword.command.dosbatch
1284+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:60: scope: keyword.command.dosbatch
1285+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:64: scope: keyword.command.dosbatch
1286+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:74: 1: punctuation.definition.string.begin.dosbatch
1287+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:75: 2: variable.other.readwrite.dosbatch
1288+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:76: 3: keyword.operator.assignment.dosbatch
1289+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:78: - meta_scope: string.quoted.double.dosbatch
1290+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:80: scope: punctuation.definition.string.end.dosbatch
1291+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:88: 1: variable.other.readwrite.dosbatch
1292+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:89: 2: keyword.operator.assignment.dosbatch
1293+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:91: - meta_content_scope: string.unquoted.dosbatch
1294+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:96: scope: punctuation.definition.string.begin.dosbatch
1295+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:98: - meta_scope: string.quoted.double.dosbatch
1296+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:101: scope: punctuation.definition.string.end.dosbatch
1297+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:108: scope: variable.other.readwrite.dosbatch
1298+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:112: - meta_content_scope: meta.expression.set.dosbatch
1299+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:120: 1: variable.other.readwrite.dosbatch
1300+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:121: 2: keyword.operator.assignment.dosbatch
1301+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:123: - meta_scope: meta.prompt.set.dosbatch
1302+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:132: scope: comment.line.ignored.dosbatch
1303+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:135: - meta_content_scope: string.unquoted.dosbatch
1304+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:145: scope: punctuation.section.group.begin.dosbatch
1305+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:148: scope: punctuation.definition.string.begin.dosbatch
1306+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:153: - meta_scope: meta.group.dosbatch
1307+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:155: scope: punctuation.section.group.end.dosbatch
1308+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:158: scope: punctuation.definition.string.begin.dosbatch
1309+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:164: scope: keyword.operator.assignment.augmented.dosbatch
1310+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:167: 1: constant.character.escape.dosbatch
1311+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:168: 2: keyword.operator.assignment.augmented.dosbatch
1312+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:170: scope: keyword.operator.arithmetic.dosbatch
1313+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:173: 1: constant.character.escape.dosbatch
1314+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:174: 2: keyword.operator.arithmetic.dosbatch
1315+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:176: scope: keyword.operator.assignment.dosbatch
1316+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:180: scope: keyword.operator.assignment.augmented.dosbatch
1317+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:182: scope: keyword.operator.arithmetic.dosbatch
1318+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:186: - meta_scope: string.quoted.double.dosbatch
1319+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:190: scope: punctuation.definition.string.end.dosbatch
1320+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:193: scope: punctuation.section.group.begin.dosbatch
1321+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:195: - meta_scope: meta.group.dosbatch
1322+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:202: - meta_scope: meta.group.dosbatch
1323+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:204: scope: punctuation.section.group.end.dosbatch
1324+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:207: scope: punctuation.definition.string.end.dosbatch
1325+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:214: - meta_scope: string.quoted.double.dosbatch meta.group.dosbatch
1326+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:216: scope: punctuation.section.group.begin.dosbatch
1327+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:219: scope: punctuation.section.group.end.dosbatch
1328+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:227: scope: keyword.operator.logical.dosbatch
1329+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:233: scope: variable.other.readwrite.dosbatch
1330+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:238: scope: variable.parameter.dosbatch
1331+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:240: 1: punctuation.definition.variable.dosbatch
1332+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:242: scope: variable.language.dosbatch
1333+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:244: 1: punctuation.definition.variable.begin.dosbatch
1334+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:245: 2: punctuation.definition.variable.end.dosbatch
1335+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:252: scope: punctuation.definition.variable.begin.dosbatch
1336+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:254: - meta_scope: variable.other.readwrite.dosbatch
1337+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:257: 1: punctuation.definition.variable.end.dosbatch
1338+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:261: scope: punctuation.separator.dosbatch
1339+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:263: - meta_content_scope: meta.variable.substring.dosbatch
1340+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:269: scope: punctuation.separator.dosbatch
1341+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:271: - meta_content_scope: meta.variable.substitution.dosbatch
1342+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:276: scope: punctuation.separator.dosbatch
1343+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:282: scope: string.unquoted.dosbatch
1344+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:287: scope: punctuation.definition.variable.begin.dosbatch
1345+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:289: - meta_scope: variable.other.readwrite.dosbatch
1346+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:292: 1: punctuation.definition.variable.end.dosbatch
1347+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:296: scope: punctuation.separator.dosbatch
1348+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:298: - meta_content_scope: meta.variable.substring.dosbatch
1349+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:304: scope: punctuation.separator.dosbatch
1350+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:306: - meta_content_scope: meta.variable.substitution.dosbatch
1351+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:312: scope: punctuation.separator.dosbatch
1352+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:318: scope: string.unquoted.dosbatch
1353+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:322: scope: string.unquoted.dosbatch
1354+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:326: scope: constant.numeric.dosbatch
1355+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:331: scope: punctuation.separator.dosbatch
1356+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:335: scope: constant.numeric.integer.hexadecimal.dosbatch
1357+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:337: 1: punctuation.definition.numeric.hexadecimal.dosbatch
1358+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:339: scope: constant.numeric.integer.octal.dosbatch
1359+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:341: 1: punctuation.definition.numeric.octal.dosbatch
1360+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:343: scope: constant.numeric.integer.decimal.dosbatch
1361+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:347: scope: constant.language.dosbatch
1362+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:351: scope: keyword.operator.at.dosbatch
1363+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:353: scope: keyword.operator.comparison.dosbatch
1364+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:355: scope: keyword.operator.logical.dosbatch
1365+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:357: scope: keyword.operator.conditional.dosbatch
1366+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:359: scope: keyword.operator.pipe.dosbatch
1367+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:361: scope: keyword.operator.redirection.dosbatch
1368+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:366: 1: punctuation.separator.dosbatch
1369+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:367: 2: entity.name.label.dosbatch
1370+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:372: 1: keyword.operator.conditional.dosbatch
1371+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:375: scope: comment.line.rem.dosbatch
1372+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:378: scope: punctuation.definition.comment.dosbatch
1373+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:380: - meta_scope: comment.line.colon.dosbatch
1374+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:386: scope: keyword.command.rem.dosbatch
1375+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:390: - meta_content_scope: comment.line.rem.dosbatch
1376+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:392: scope: comment.line.rem.dosbatch
1377+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:395: scope: invalid.illegal.unexpected-character.dosbatch
1378+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:399: scope: punctuation.definition.string.begin.dosbatch
1379+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:401: - meta_scope: string.quoted.double.dosbatch
1380+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:404: 1: punctuation.definition.string.end.dosbatch
1381+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:405: 2: invalid.illegal.newline.dosbatch
1382+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:412: scope: punctuation.section.group.begin.dosbatch
1383+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:414: - meta_scope: meta.group.dosbatch
1384+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:416: scope: punctuation.section.group.end.dosbatch
1385+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:419: scope: punctuation.separator.dosbatch
1386+assets/syntaxes/01_Packages/Batch File/Batch File.sublime-syntax:424: scope: constant.character.escape.dosbatch
1387+assets/syntaxes/01_Packages/Batch File/Comments.tmPreferences:7: <string>source.dosbatch</string>
1388+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:1::: SYNTAX TEST "Packages/Batch File/Batch File.sublime-syntax"
1389+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:4::: ^^^ keyword.command.rem.dosbatch
1390+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:5::: ^^^^^^^^^^^^^^^^ comment.line.rem.dosbatch
1391+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:6::: ^ invalid.illegal.unexpected-character.dosbatch
1392+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:7::: ^ invalid.illegal.unexpected-character.dosbatch
1393+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:8::: ^ invalid.illegal.unexpected-character.dosbatch
1394+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:12::: ^^^^^^^^^^^^^ - comment.line.rem.dosbatch
1395+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:19::: ^^ punctuation.definition.comment.dosbatch
1396+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:20::: ^^^^^^^^^^ comment.line.colon.dosbatch
1397+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:23::: ^^ punctuation.definition.comment.dosbatch
1398+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:26::: ^^ punctuation.definition.comment.dosbatch
1399+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:29::: ^^ punctuation.definition.comment.dosbatch
1400+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:32::: ^^ punctuation.definition.comment.dosbatch
1401+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:35::: ^^ punctuation.definition.comment.dosbatch
1402+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:46::: ^ keyword.operator.conditional.dosbatch
1403+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:47::: ^^ punctuation.definition.comment.dosbatch
1404+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:48::: ^^^^^^^^^^^^ comment.line.colon.dosbatch
1405+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:51:::^^ punctuation.definition.comment.dosbatch
1406+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:52:::^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
1407+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:55::: ^ punctuation.definition.string.begin.dosbatch
1408+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:56::: ^^^^^ string.quoted.double.dosbatch
1409+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:57::: ^ punctuation.definition.string.end.dosbatch
1410+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:60::: ^ invalid.illegal.newline.dosbatch
1411+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:63::: ^ keyword.operator.at.dosbatch
1412+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:66::: ^ - keyword.operator.at.dosbatch
1413+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:69::: ^^^^ keyword.control.statement.dosbatch
1414+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:70::: ^ punctuation.separator.dosbatch
1415+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:71::: ^^^ keyword.control.flow.return.dosbatch
1416+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:74::: ^^^^ keyword.control.statement.dosbatch
1417+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:75::: ^ punctuation.separator.dosbatch
1418+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:76::: ^^^ meta.function-call.dosbatch variable.function.dosbatch
1419+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:79::: ^^^^ keyword.control.statement.dosbatch
1420+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:80::: ^ punctuation.separator.dosbatch
1421+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:81::: ^^^ meta.function-call.dosbatch variable.function.dosbatch
1422+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:85::: ^^^^ keyword.command.dosbatch
1423+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:86::: ^ keyword.operator.redirection.dosbatch
1424+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:89::: ^^ keyword.operator.redirection.dosbatch
1425+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:93::: ^ keyword.operator.redirection.dosbatch
1426+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:94::: ^^ keyword.operator.redirection.dosbatch
1427+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:97::: ^^ keyword.operator.conditional.dosbatch
1428+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:98::: ^^ keyword.operator.conditional.dosbatch
1429+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:99::: ^ keyword.operator.conditional.dosbatch
1430+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:103::: ^^ keyword.control.conditional.dosbatch
1431+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:104::: ^^^ keyword.operator.comparison.dosbatch
1432+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:107::: ^^ keyword.control.conditional.dosbatch
1433+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:108::: ^^^ keyword.operator.logical.dosbatch
1434+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:109::: ^^^ keyword.operator.comparison.dosbatch
1435+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:113::: ^^ keyword.control.conditional.dosbatch
1436+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:114::: ^^^^^^^^^^^^ variable.language.dosbatch
1437+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:115::: ^ punctuation.definition.variable.begin.dosbatch
1438+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:116::: ^ variable.language.dosbatch punctuation.definition.variable.end.dosbatch
1439+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:119::: ^^ keyword.control.conditional.dosbatch
1440+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:120::: ^^ keyword.operator.comparison.dosbatch
1441+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:123::: ^^^ keyword.control.repeat.dosbatch
1442+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:124::: ^ constant.numeric.integer.decimal.dosbatch
1443+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:127::: ^ keyword.operator.pipe.dosbatch
1444+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:130:::^ punctuation.separator.dosbatch
1445+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:131::: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.label.dosbatch
1446+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:134:::^ punctuation.separator.dosbatch
1447+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:135::: ^^^ entity.name.label.dosbatch
1448+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:138::: ^ punctuation.definition.variable.dosbatch
1449+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:139::: ^^ variable.parameter.dosbatch
1450+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:140::: ^ punctuation.definition.variable.dosbatch
1451+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:141::: ^^ variable.parameter.dosbatch
1452+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:142::: ^ punctuation.definition.variable.dosbatch
1453+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:143::: ^^^^^^^^^^^ variable.parameter.dosbatch
1454+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:144::: ^ punctuation.definition.variable.dosbatch
1455+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:145::: ^^^ variable.parameter.dosbatch
1456+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:148::: ^ punctuation.definition.variable.begin.dosbatch
1457+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:149::: ^^^^^^^^^^ variable.other.readwrite.dosbatch
1458+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:150::: ^ punctuation.definition.variable.end.dosbatch
1459+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:151::: ^ punctuation.definition.variable.begin.dosbatch
1460+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:152::: ^^^^^^^^^^ variable.other.readwrite.dosbatch
1461+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:153::: ^ punctuation.definition.variable.end.dosbatch
1462+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:156::: ^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch
1463+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:157::: ^ punctuation.definition.variable.begin.dosbatch
1464+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:158::: ^ punctuation.separator.dosbatch
1465+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:159::: ^^^^^^^^^ meta.variable.substitution.dosbatch
1466+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:160::: ^^^^ string.unquoted.dosbatch
1467+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:161::: ^ punctuation.separator.dosbatch
1468+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:162::: ^^^^ string.unquoted.dosbatch
1469+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:163::: ^ punctuation.definition.variable.end.dosbatch
1470+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:164::: ^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch
1471+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:165::: ^ punctuation.definition.variable.begin.dosbatch
1472+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:166::: ^ punctuation.separator.dosbatch
1473+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:167::: ^^^^^^^^^ meta.variable.substitution.dosbatch
1474+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:168::: ^^^^ string.unquoted.dosbatch
1475+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:169::: ^ punctuation.separator.dosbatch
1476+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:170::: ^^^^ string.unquoted.dosbatch
1477+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:171::: ^ punctuation.definition.variable.end.dosbatch
1478+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:175::: ^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch
1479+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:176::: ^ punctuation.definition.variable.begin.dosbatch
1480+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:177::: ^^ punctuation.separator.dosbatch
1481+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:178::: ^^^^ meta.variable.substring.dosbatch
1482+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:179::: ^ constant.numeric.dosbatch
1483+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:180::: ^ punctuation.separator.dosbatch
1484+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:181::: ^^ constant.numeric.dosbatch
1485+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:182::: ^ punctuation.definition.variable.end.dosbatch
1486+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:183::: ^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch
1487+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:184::: ^ punctuation.definition.variable.begin.dosbatch
1488+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:185::: ^^ punctuation.separator.dosbatch
1489+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:186::: ^^^^ meta.variable.substring.dosbatch
1490+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:187::: ^ constant.numeric.dosbatch
1491+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:188::: ^ punctuation.separator.dosbatch
1492+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:189::: ^^ constant.numeric.dosbatch
1493+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:190::: ^ punctuation.definition.variable.end.dosbatch
1494+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:193::: ^^^^^^^ variable.other.readwrite.dosbatch
1495+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:194::: ^ punctuation.definition.variable.begin.dosbatch
1496+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:195::: ^^ punctuation.separator.dosbatch
1497+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:196::: ^^ meta.variable.substring.dosbatch
1498+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:197::: ^^ constant.numeric.dosbatch
1499+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:198::: ^ punctuation.definition.variable.end.dosbatch
1500+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:199::: ^^^^^^^ variable.other.readwrite.dosbatch
1501+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:200::: ^ punctuation.definition.variable.begin.dosbatch
1502+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:201::: ^^ punctuation.separator.dosbatch
1503+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:202::: ^^ meta.variable.substring.dosbatch
1504+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:203::: ^^ constant.numeric.dosbatch
1505+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:204::: ^ punctuation.definition.variable.end.dosbatch
1506+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:207::: ^^^^^^^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch
1507+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:208::: ^ punctuation.definition.variable.begin.dosbatch
1508+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:209::: ^^^^^ meta.variable.substitution.dosbatch variable.other.readwrite.dosbatch
1509+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:210::: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.begin.dosbatch
1510+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:211::: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.end.dosbatch
1511+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:212::: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.begin.dosbatch
1512+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:213::: ^^^^^^^^^^^ meta.variable.substitution.dosbatch variable.other.readwrite.dosbatch
1513+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:214::: ^^^^ meta.variable.substitution.dosbatch meta.variable.substring.dosbatch
1514+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:215::: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.end.dosbatch
1515+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:216::: ^^ meta.variable.substitution.dosbatch constant.numeric.dosbatch
1516+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:217::: ^ punctuation.definition.variable.end.dosbatch
1517+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:220::: ^^^^^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch
1518+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:221::: ^ punctuation.definition.variable.begin.dosbatch
1519+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:222::: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.begin.dosbatch
1520+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:223::: ^^^^^^^^^^^ meta.variable.substitution.dosbatch variable.other.readwrite.dosbatch
1521+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:224::: ^^^^ meta.variable.substitution.dosbatch meta.variable.substring.dosbatch
1522+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:225::: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.end.dosbatch
1523+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:226::: ^^ meta.variable.substitution.dosbatch constant.numeric.dosbatch
1524+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:227::: ^ punctuation.definition.variable.end.dosbatch
1525+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:230::: ^^^^^^^^^^^^ - variable.other.readwrite.dosbatch
1526+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:231::: ^^^ - keyword.operator.logical.dosbatch
1527+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:234::: ^^^^^^^^^^^^ - variable.other.readwrite.dosbatch
1528+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:235::: ^^^ - keyword.operator.logical.dosbatch
1529+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:239::: ^^^ constant.numeric.integer.octal.dosbatch
1530+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:240::: ^ punctuation.definition.numeric.octal.dosbatch
1531+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:241::: ^^^^ constant.numeric.integer.hexadecimal.dosbatch
1532+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:242::: ^^ punctuation.definition.numeric.hexadecimal.dosbatch
1533+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:243::: ^^ constant.numeric.integer.decimal.dosbatch
1534+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:247::: ^^ constant.character.escape.dosbatch
1535+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:248::: ^^^ constant.character.escape.dosbatch
1536+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:249::: ^^ constant.character.escape.dosbatch
1537+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:253::: ^^^^^^^^^ meta.expression.set.dosbatch
1538+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:254::: ^^^ keyword.operator.assignment.augmented.dosbatch
1539+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:257::: ^^ keyword.operator.assignment.augmented.dosbatch
1540+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:260::: ^^ keyword.operator.assignment.augmented.dosbatch
1541+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:263::: ^^ keyword.operator.assignment.augmented.dosbatch
1542+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:266::: ^^ keyword.operator.assignment.augmented.dosbatch
1543+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:269::: ^^ keyword.operator.assignment.augmented.dosbatch
1544+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:272::: ^^^ keyword.operator.assignment.augmented.dosbatch
1545+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:275::: ^ keyword.operator.assignment.dosbatch
1546+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:276::: ^ keyword.operator.logical.dosbatch
1547+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:279::: ^^^^^ meta.group.dosbatch
1548+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:280::: ^ punctuation.section.group.begin.dosbatch
1549+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:281::: ^ punctuation.section.group.end.dosbatch
1550+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:282::: ^ keyword.operator.assignment.dosbatch
1551+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:283::: ^ keyword.operator.arithmetic.dosbatch
1552+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:284::: ^ keyword.operator.arithmetic.dosbatch
1553+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:287::: ^ keyword.operator.assignment.dosbatch
1554+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:288::: ^ punctuation.separator.dosbatch
1555+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:289::: ^ keyword.operator.assignment.dosbatch
1556+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:290::: ^ keyword.operator.arithmetic.dosbatch
1557+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:293::: ^ keyword.operator.assignment.dosbatch
1558+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:294::: ^^ keyword.operator.arithmetic.dosbatch
1559+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:297::: ^ keyword.operator.assignment.dosbatch
1560+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:298::: ^^ keyword.operator.arithmetic.dosbatch
1561+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:301::: ^ keyword.operator.assignment.dosbatch
1562+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:302::: ^^ keyword.operator.arithmetic.dosbatch
1563+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:305::: ^ keyword.operator.assignment.dosbatch
1564+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:306::: ^ keyword.operator.arithmetic.dosbatch
1565+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:309::: ^ keyword.operator.assignment.dosbatch
1566+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:310::: ^ keyword.operator.arithmetic.dosbatch
1567+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:313::: ^ keyword.operator.assignment.dosbatch
1568+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:314::: ^ keyword.operator.arithmetic.dosbatch
1569+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:317::: ^^ keyword.operator.assignment.augmented.dosbatch
1570+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:320::: ^ keyword.operator.assignment.dosbatch
1571+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:321::: ^ keyword.operator.arithmetic.dosbatch
1572+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:324::: ^ keyword.operator.assignment.dosbatch
1573+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:325::: ^ keyword.operator.arithmetic.dosbatch
1574+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:328::: ^ keyword.operator.assignment.dosbatch
1575+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:329::: ^ keyword.operator.arithmetic.dosbatch
1576+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:332::: ^ keyword.operator.assignment.dosbatch
1577+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:333::: ^ keyword.operator.arithmetic.dosbatch
1578+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:336::: ^ keyword.operator.assignment.dosbatch
1579+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:337::: ^ keyword.operator.arithmetic.dosbatch
1580+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:340::: ^^^ keyword.operator.assignment.augmented.dosbatch
1581+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:343::: ^^ keyword.operator.assignment.augmented.dosbatch
1582+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:346::: ^ keyword.operator.assignment.dosbatch
1583+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:347::: ^ keyword.operator.arithmetic.dosbatch
1584+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:348::: ^ punctuation.separator.dosbatch
1585+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:349::: ^ keyword.operator.assignment.dosbatch
1586+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:350::: ^ keyword.operator.arithmetic.dosbatch
1587+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:436::: ^^^^^^^^^^^ variable.other.readwrite.dosbatch
1588+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:444::: ^^^^^^^^^^^ string.quoted.double.dosbatch
1589+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:445::: ^^ constant.character.escape.dosbatch
1590+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:446::: ^ - constant.character.escape.dosbatch
1591+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:447::: ^^ constant.character.escape.dosbatch
1592+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:448::: ^ - constant.character.escape.dosbatch
1593+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:449::: ^^ constant.character.escape.dosbatch
1594+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:450::: ^ - constant.character.escape.dosbatch
1595+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:454::: ^^^^ - variable.other.readwrite.dosbatch
1596+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:455::: ^^^^^ variable.other.readwrite.dosbatch
1597+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:456::: ^ keyword.operator.assignment.dosbatch
1598+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:457::: ^ keyword.operator.redirection.dosbatch
1599+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:459::: ^ punctuation.definition.variable.begin.dosbatch
1600+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:460::: ^^^^^^^ variable.other.readwrite.dosbatch
1601+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:461::: ^ punctuation.definition.variable.end.dosbatch
1602+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:464::: ^^^^ - variable.other.readwrite.dosbatch
1603+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:465::: ^^^^^ variable.other.readwrite.dosbatch
1604+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:466::: ^ keyword.operator.assignment.dosbatch
1605+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:467::: ^^^^^^^^^^^^^ meta.prompt.set.dosbatch string.unquoted - variable.other.readwrite.dosbatch
1606+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:468::: ^ - meta.prompt.set.dosbatch
1607+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:470::: ^^^^ - variable.other.readwrite.dosbatch
1608+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:471::: ^^^^^ variable.other.readwrite.dosbatch
1609+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:472::: ^ keyword.operator.assignment.dosbatch
1610+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:473::: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.prompt.set.dosbatch string.unquoted - variable.other.readwrite.dosbatch - comment
1611+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:474::: ^ - meta.prompt.set.dosbatch
1612+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:476::: ^^^^ - variable.other.readwrite.dosbatch
1613+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:477::: ^^^^^ variable.other.readwrite.dosbatch
1614+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:478::: ^ keyword.operator.assignment.dosbatch
1615+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:479::: ^ - meta.prompt.set.dosbatch
1616+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:493::: ^^^^^^ variable.other.readwrite.dosbatch
1617+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:494::: ^^^^^^ variable.other.readwrite.dosbatch
1618+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:498::: ^^^^ variable.other.readwrite.dosbatch
1619+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:499::: ^ keyword.operator.assignment.dosbatch
1620+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:500::: ^ punctuation.definition.string.begin.dosbatch
1621+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:501::: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.dosbatch
1622+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:502::: ^^^^^^^^^ variable.other.readwrite.dosbatch
1623+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:503::: ^^ constant.character.escape.dosbatch
1624+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:504::: ^ punctuation.definition.string.end.dosbatch
1625+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:505::: ^^^ string.unquoted.dosbatch
1626+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:508:::^^^^^^ keyword.command.dosbatch
1627+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:510::: ^^^^ - variable.other.readwrite.dosbatch
1628+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:511::: ^^^^^^^ variable.other.readwrite.dosbatch
1629+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:512::: ^ keyword.operator.assignment.dosbatch
1630+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:513::: ^ punctuation.definition.string.begin.dosbatch
1631+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:514::: ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.prompt.set.dosbatch string.quoted
1632+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:515::: ^ punctuation.definition.string.end.dosbatch
1633+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:516::: ^ keyword.operator.conditional.dosbatch - meta.prompt.set.dosbatch - string
1634+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:517::: ^^^^ keyword.command.dosbatch
1635+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:518::: ^^^^^^^^^ variable.other.readwrite.dosbatch
1636+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:520:::^^^^^^ keyword.command.dosbatch
1637+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:542::: ^^^^ - variable.other.readwrite.dosbatch
1638+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:543::: ^^^^^ variable.other.readwrite.dosbatch
1639+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:544::: ^ keyword.operator.assignment.dosbatch - variable.other.readwrite.dosbatch
1640+assets/syntaxes/01_Packages/Batch File/syntax_test_batch_file.bat:545::: ^^^^^^^^^^^^^^^^ meta.prompt.set.dosbatch string.quoted - variable.other.readwrite.dosbatch - comment
1641+assets/syntaxes/01_Packages/CSS/CSS.sublime-syntax:1257: - match: '\bat\b'
1642+assets/syntaxes/01_Packages/C#/tests/syntax_test_Strings.cs:35:var verbatim_singleline = @"foo";
1643+assets/syntaxes/01_Packages/C#/tests/syntax_test_Strings.cs:37:var verbatim_singleline_interpolated_none = $@"foo bar";
1644+assets/syntaxes/01_Packages/C#/tests/syntax_test_Strings.cs:39:var verbatim_singleline_interpolated_yes = $@"foo {bar} foo";
1645+assets/syntaxes/01_Packages/C#/tests/syntax_test_Strings.cs:42:var verbatim_multiline = @"foo bar
1646+assets/syntaxes/01_Packages/C#/tests/syntax_test_Strings.cs:45:var verbatim_multiline_interpolated_none = $@"foo bar
1647+assets/syntaxes/01_Packages/C#/tests/syntax_test_Strings.cs:48:var verbatim_multiline_interpolated_yes = $@"foo {bar}
1648+assets/syntaxes/01_Packages/C#/tests/syntax_test_GeneralStructure.cs:344: case BLBodyBattleLibrary.ContextType.TapUp:
1649+assets/syntaxes/01_Packages/C#/tests/syntax_test_Generics.cs:57:string verbatim = @"This is a test "" of a verbatim string literal - C:\User";
1650+assets/syntaxes/01_Packages/C#/tests/syntax_test_c#.cs:35:string verbatim = @"This is a test "" of a verbatim string literal - C:\User";
1651+assets/syntaxes/01_Packages/PHP/PHP.sublime-completions:2082: { "trigger": "mssql_fetch_batch", "contents": "mssql_fetch_batch(${1:result})" },
1652+assets/syntaxes/01_Packages/PHP/PHP Source.sublime-syntax:407: # verbatim and the indexer should find the name in the original source
1653+assets/syntaxes/01_Packages/PHP/PHP Source.sublime-syntax:447: # verbatim and the indexer should find the name in the original source
1654+assets/syntaxes/01_Packages/PHP/PHP Source.sublime-syntax:2082: mssql_bind | mssql_close | mssql_connect | mssql_data_seek | mssql_execute | mssql_fetch_array | mssql_fetch_assoc | mssql_fetch_batch |
1655+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:29: - include: verbatim
1656+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:311: verbatim:
1657+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:312: - match: '((\\)begin)(\{)\s*((?:[vV]erbatim|alltt)\*?)\s*(\})'
1658+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:321: - meta_scope: meta.environment.verbatim.verbatim.latex
1659+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:322: - meta_content_scope: markup.raw.verbatim.latex
1660+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:541: - meta_scope: meta.environment.verbatim.verb.latex
1661+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:777: - meta_scope: meta.environment.verbatim.lstinline.latex
1662+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:784: - meta_content_scope: meta.environment.verbatim.lstinline.latex markup.raw.verb.latex
1663+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:786: scope: meta.environment.verbatim.lstinline.latex punctuation.definition.group.brace.end.latex
1664+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:792: - meta_content_scope: meta.environment.verbatim.lstinline.latex markup.raw.verb.latex
1665+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:794: scope: meta.environment.verbatim.lstinline.latex punctuation.definition.verb.latex
1666+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:806: - meta_scope: meta.environment.verbatim.lstlisting.latex
1667+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:938: - meta_scope: meta.environment.verbatim.minted.latex
1668+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1146: - meta_scope: meta.environment.verbatim.minted.latex
1669+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1149: scope: meta.environment.verbatim.minted.latex
1670+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1157: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.c.latex source.c.embedded
1671+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1163: scope: meta.environment.verbatim.minted.latex
1672+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1171: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.c++.latex source.c++.embedded
1673+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1177: scope: meta.environment.verbatim.minted.latex
1674+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1185: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.diff.latex source.diff.embedded
1675+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1191: scope: meta.environment.verbatim.minted.latex
1676+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1199: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.go.latex source.go.embedded
1677+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1205: scope: meta.environment.verbatim.minted.latex
1678+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1213: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.haskell.latex source.haskell.embedded
1679+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1219: scope: meta.environment.verbatim.minted.latex
1680+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1227: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.html.latex text.html.embedded
1681+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1233: scope: meta.environment.verbatim.minted.latex
1682+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1241: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.java.latex source.java.embedded
1683+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1247: scope: meta.environment.verbatim.minted.latex
1684+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1255: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.js.latex source.js.embedded
1685+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1261: scope: meta.environment.verbatim.minted.latex
1686+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1269: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.json.latex source.json.embedded
1687+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1275: scope: meta.environment.verbatim.minted.latex
1688+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1283: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.latex.latex text.tex.latex.embedded
1689+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1289: scope: meta.environment.verbatim.minted.latex
1690+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1297: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.lisp.latex source.lisp.embedded
1691+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1303: scope: meta.environment.verbatim.minted.latex
1692+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1311: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.lua.latex source.lua.embedded
1693+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1317: scope: meta.environment.verbatim.minted.latex
1694+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1325: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.objc.latex source.objc.embedded
1695+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1331: scope: meta.environment.verbatim.minted.latex
1696+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1339: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.objc++.latex source.objc++.embedded
1697+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1345: scope: meta.environment.verbatim.minted.latex
1698+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1353: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.perl.latex source.perl.embedded
1699+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1359: scope: meta.environment.verbatim.minted.latex
1700+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1367: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.php.latex source.php.embedded
1701+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1373: scope: meta.environment.verbatim.minted.latex
1702+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1381: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.python.latex source.python.embedded
1703+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1387: scope: meta.environment.verbatim.minted.latex
1704+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1395: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.r.latex source.r.embedded
1705+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1401: scope: meta.environment.verbatim.minted.latex
1706+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1409: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.ruby.latex source.ruby.embedded
1707+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1415: scope: meta.environment.verbatim.minted.latex
1708+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1423: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.shell.latex source.shell.embedded
1709+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1429: scope: meta.environment.verbatim.minted.latex
1710+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1437: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.sql.latex source.sql.embedded
1711+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1443: scope: meta.environment.verbatim.minted.latex
1712+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1451: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.xml.latex text.xml.embedded
1713+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1457: scope: meta.environment.verbatim.minted.latex
1714+assets/syntaxes/01_Packages/LaTeX/LaTeX.sublime-syntax:1465: embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.yaml.latex source.yaml.embedded
1715+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:261:% VERBATIM
1716+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:267:% ^ meta.environment.verbatim.verb.latex
1717+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:271:% ^ meta.environment.verbatim.verb.latex
1718+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:274:% ^^^^^^^^^^^^^^ meta.environment.verbatim.verb.latex
1719+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:277:% <- - meta.environment.verbatim.verb.latex
1720+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:279:\begin{verbatim}
1721+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:282:The \emph{verbatim} environment sets everything in verbatim.
1722+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:283:% <- meta.environment.verbatim.verbatim.latex
1723+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:284:% ^ markup.raw.verbatim.latex
1724+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:290:\end{verbatim}
1725+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:397:% <- meta.environment.verbatim.lstlisting.latex
1726+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:407:% <- meta.environment.verbatim.lstlisting.latex
1727+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:415:% <- meta.environment.verbatim.lstlisting.latex
1728+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:423:% ^^^^^^^^^^^^^^^^^^^^^ meta.environment.verbatim.lstinline.latex
1729+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:428:% ^ - meta.environment.verbatim.lstinline.latex
1730+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:431:% ^^^^^^^^^^^^^^^^^^^^^ meta.environment.verbatim.lstinline.latex
1731+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:433:% ^ - meta.environment.verbatim.lstinline.latex
1732+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:443:% <- meta.environment.verbatim.minted.latex
1733+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:451:% ^ meta.environment.verbatim.minted.latex
1734+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:459:% ^ meta.environment.verbatim.minted.latex
1735+assets/syntaxes/01_Packages/LaTeX/syntax_test_latex.tex:464:% ^ meta.environment.verbatim.minted.latex
1736+assets/syntaxes/01_Packages/Java/Ant.sublime-build:10: "cmd": ["ant.bat"]
1737+assets/syntaxes/01_Packages/Matlab/Matlab.sublime-syntax:325: - match: \b(zerom|zero22pi|zdatam-ui|zdatam|wrapToPi|wrapTo360|wrapTo2Pi|wrapTo180|worldmap|worldfilewrite|worldfileread|westof|vmap0ui|vmap0rhead|vmap0read|vmap0data|vinvtran|viewshed|vfwdtran|vec2mtx|utmzoneui|utmzone|utmgeoid|usgsdems|usgsdem|usgs24kdem|usamap|updategeostruct|unwrapMultipart|unitstr|unitsratio|undotrim|undoclip|uimaptbx|trimdata|trimcart|trackui|trackg|track2|track1|track|toRadians|toDegrees|tissot|timezone|timedim|time2str|tightmap|tigerp|tigermif|tgrline|textm|tbase|tagm-ui|tagm|symbolm|surfm|surflsrm|surflm|surfdist|surfacem|str2angle|stem3m|stdm|stdist|spzerom|spcread|smoothlong|sm2rad|sm2nm|sm2km|sm2deg|sizem|showm-ui|showm|showaxes|shapewrite|shaperead|shapeinfo|shaderel|setpostn|setm|setltln|seedm|sectorg|sec2hr|sec2hms|sec2hm|sdtsinfo|sdtsdemread|scxsc|scirclui|scircleg|scircle2|scircle1|scatterm|scaleruler|satbath|rsphere|roundn|rotatetext|rotatem|rootlayr|rhxrh|restack|resizem|removeExtraNanSeparators|refvec2mat|refmat2vec|reducem|reckon|readmtx|readfk5|readfields|rcurve|rad2sm|rad2nm|rad2km|rad2dms|rad2dm|rad2deg|quiverm|quiver3m|qrydata|putpole|projlist|projinv|projfwd|project|previewmap|polyxpoly|polysplit|polymerge|polyjoin|polycut|polybool|poly2fv|poly2cw|poly2ccw|polcmap|plotm|plot3m|plabel|pixcenters|pix2map|pix2latlon|pcolorm|patchm|patchesm|parallelui|paperscale|panzoom|originui|org2pol|onem|npi2pi|northarrow|nm2sm|nm2rad|nm2km|nm2deg|newpole|neworig|navfix|nanm|nanclip|namem|n2ecc|mobjects|mlayers|mlabelzero22pi|mlabel|minvtran|minaxis|mfwdtran|meshm|meshlsrm|meshgrat|meridianfwd|meridianarc|meanm|mdistort|mat2hms|mat2dms|mapview|maptrims|maptrimp|maptriml|maptrim|maptool|mapshow|maps|mapprofile|mapoutline|maplist|mapbbox|map2pix|makesymbolspec|makerefmat|makemapped|makedbfspec|makeattribspec|majaxis|lv2ecef|ltln2val|los2|linem|linecirc|limitm|lightmui|lightm|legs|lcolorbar|latlon2pix|kmlwrite|km2sm|km2rad|km2nm|km2deg|ispolycw|ismapped|ismap|isShapeMultipart|intrplon|intrplat|interpm|inputm|ind2rgb8|imbedm|hr2sec|hr2hms|hr2hm|hms2sec|hms2mat|hms2hr|hms2hm|histr|hista|hidem-ui|hidem|handlem-ui|handlem|gtopo30s|gtopo30|gtextm|gshhs|grn2eqa|gridm|grid2image|grepfields|gradientm|globedems|globedem|getworldfilename|getseeds|getm|geotiffread|geotiffinfo|geotiff2mstruct|geoshow|geoloc2grid|geodetic2geocentricLat|geodetic2ecef|geocentric2geodeticLat|gcxsc|gcxgc|gcwaypts|gcpmap|gcm|gc2sc|fromRadians|fromDegrees|framem|flatearthpoly|flat2ecc|fipsname|findm|filterm|fillm|fill3m|extractm|extractfield|etopo5|etopo|eqa2grn|epsm|encodem|ellipse1|elevation|egm96geoid|ecef2lv|ecef2geodetic|ecc2n|ecc2flat|eastof|dteds|dted|driftvel|driftcorr|dreckon|dms2rad|dms2mat|dms2dm|dms2degrees|dms2deg|dm2degrees|distortcalc|distdim|distance|dist2str|displaym|departure|demdataui|demcmap|degrees2dms|degrees2dm|deg2sm|deg2rad|deg2nm|deg2km|deg2dms|deg2dm|defaultm|dcwrhead|dcwread|dcwgaz|dcwdata|daspectm|crossfix|convertlat|contourm|contourfm|contourcmap|contour3m|cometm|comet3m|combntns|colorui|colorm|cmapui|clrmenu|closePolygonParts|clmo-ui|clmo|clma|clipdata|clegendm|clabelm|circcirc|changem|cart2grn|camupm|camtargm|camposm|bufferm|azimuth|axesscale|axesmui|axesm|axes2ecc|avhrrlambert|avhrrgoode|areaquad|areamat|areaint|arcgridread|antipode|angledim|angl2str|almanac)\b
1738+assets/syntaxes/01_Packages/RestructuredText/reStructuredText.sublime-syntax:41: comment: verbatim blocks
1739+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:95:Verbatim tests
1740+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:100: Verbatim
1741+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:105: Verbatim
1742+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:112: Verbatim
1743+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:114: Also Verbatim
1744+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:119: Verbatim
1745+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:121: Also Verbatim
1746+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:127: Verbatim
1747+assets/syntaxes/01_Packages/RestructuredText/syntax_test_restructuredtext.rst:129:Not verbatim
1748+assets/syntaxes/01_Packages/Go/Indents/GoIndent.tmPreferences:4:batch-reindent real-world code without wrecking it. As such, these rules are
1749+assets/syntaxes/01_Packages/Go/Indents/GoIndent.tmPreferences:5:optimized for convenience while typing, not for batch reindentation.
1750+assets/syntaxes/01_Packages/YAML/YAML.sublime-syntax:64: c_ns_tag_property: |- # c-verbatim-tag | c-ns-shorthand-tag | c-non-specific-tag
1751+assets/manual/bat.1.in:113:\fB-P\fR. To disable the pager permanently, set BAT_PAGER to an empty string. To control
1752+assets/manual/bat.1.in:118:Determine which pager is used. This option will override the PAGER and BAT_PAGER
1753+assets/manual/bat.1.in:134:export the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
1754+assets/manual/bat.1.in:146:export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
1755+assets/manual/bat.1.in:194:Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
1756+assets/manual/bat.1.in:235:\fBhttps://github.com/sharkdp/bat\fR
1757+assets/completions/bat.bash.in:5:_bat() {
1758+assets/completions/bat.bash.in:88:} && complete -F _bat {{PROJECT_EXECUTABLE}}
1759+assets/completions/_bat.ps1.in:64: [CompletionResult]::new('--config-dir', 'config-dir', [CompletionResultType]::ParameterName, 'Show bat''s configuration directory.')
1760+assets/completions/_bat.ps1.in:65: [CompletionResult]::new('--cache-dir', 'cache-dir', [CompletionResultType]::ParameterName, 'Show bat''s cache directory.')
1761+assets/completions/bat.zsh.in:49: '(: --config-dir)'--config-dir'[Show bat'"'"'s configuration directory]'
1762+assets/completions/bat.zsh.in:52: '(: --cache-dir)'--cache-dir'[Show bat'"'"'s cache directory]'
1763+assets/create.sh:43:bat cache --clear
1764+assets/create.sh:56:bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
1765+assets/metadata.yaml:2:bat_version: 0.18.3
1766+tests/integration_tests.rs:34:fn bat_raw_command_with_config() -> Command {
1767+tests/integration_tests.rs:35: let mut cmd = Command::cargo_bin("bat").unwrap();
1768+tests/integration_tests.rs:37: cmd.env_remove("BAT_CACHE_PATH");
1769+tests/integration_tests.rs:38: cmd.env_remove("BAT_CONFIG_DIR");
1770+tests/integration_tests.rs:39: cmd.env_remove("BAT_CONFIG_PATH");
1771+tests/integration_tests.rs:40: cmd.env_remove("BAT_OPTS");
1772+tests/integration_tests.rs:41: cmd.env_remove("BAT_PAGER");
1773+tests/integration_tests.rs:42: cmd.env_remove("BAT_STYLE");
1774+tests/integration_tests.rs:43: cmd.env_remove("BAT_TABS");
1775+tests/integration_tests.rs:44: cmd.env_remove("BAT_THEME");
1776+tests/integration_tests.rs:51:fn bat_raw_command() -> Command {
1777+tests/integration_tests.rs:52: let mut cmd = bat_raw_command_with_config();
1778+tests/integration_tests.rs:57:fn bat_with_config() -> assert_cmd::Command {
1779+tests/integration_tests.rs:58: assert_cmd::Command::from_std(bat_raw_command_with_config())
1780+tests/integration_tests.rs:61:fn bat() -> assert_cmd::Command {
1781+tests/integration_tests.rs:62: assert_cmd::Command::from_std(bat_raw_command())
1782+tests/integration_tests.rs:67: bat()
1783+tests/integration_tests.rs:77: bat()
1784+tests/integration_tests.rs:86: bat()
1785+tests/integration_tests.rs:96: bat()
1786+tests/integration_tests.rs:108: bat()
1787+tests/integration_tests.rs:118: bat()
1788+tests/integration_tests.rs:128: bat()
1789+tests/integration_tests.rs:138: bat()
1790+tests/integration_tests.rs:149: bat()
1791+tests/integration_tests.rs:160: bat()
1792+tests/integration_tests.rs:170: bat()
1793+tests/integration_tests.rs:181: bat()
1794+tests/integration_tests.rs:192: bat()
1795+tests/integration_tests.rs:202: bat()
1796+tests/integration_tests.rs:212: bat()
1797+tests/integration_tests.rs:222: bat()
1798+tests/integration_tests.rs:245: let res = bat_raw_command()
1799+tests/integration_tests.rs:261: let res = bat_raw_command()
1800+tests/integration_tests.rs:277: let res = bat_raw_command()
1801+tests/integration_tests.rs:293: let res = bat_raw_command()
1802+tests/integration_tests.rs:307: // To simulate bat getting started from the shell, a process is created with stdin and stdout
1803+tests/integration_tests.rs:308: // as the slave end of a pseudo terminal. Although both point to the same "file", bat should
1804+tests/integration_tests.rs:316: let mut child = bat_raw_command()
1805+tests/integration_tests.rs:349: bat()
1806+tests/integration_tests.rs:372: bat()
1807+tests/integration_tests.rs:395: bat()
1808+tests/integration_tests.rs:418: bat()
1809+tests/integration_tests.rs:441: bat()
1810+tests/integration_tests.rs:464: bat()
1811+tests/integration_tests.rs:487: bat()
1812+tests/integration_tests.rs:510: bat().arg("non-existing-file").assert().failure();
1813+tests/integration_tests.rs:515: bat().arg("sub_directory").assert().failure();
1814+tests/integration_tests.rs:520: bat()
1815+tests/integration_tests.rs:530: bat()
1816+tests/integration_tests.rs:541: bat()
1817+tests/integration_tests.rs:543: .env("BAT_PAGER", "echo pager-output")
1818+tests/integration_tests.rs:553: bat()
1819+tests/integration_tests.rs:555: .env("BAT_PAGER", "")
1820+tests/integration_tests.rs:564:fn env_var_pager_value_bat() {
1821+tests/integration_tests.rs:565: bat()
1822+tests/integration_tests.rs:566: .env("PAGER", "bat")
1823+tests/integration_tests.rs:575:fn env_var_bat_pager_value_bat() {
1824+tests/integration_tests.rs:576: bat()
1825+tests/integration_tests.rs:577: .env("BAT_PAGER", "bat")
1826+tests/integration_tests.rs:582: .stderr(predicate::str::contains("bat as a pager is disallowed"));
1827+tests/integration_tests.rs:586:fn pager_value_bat() {
1828+tests/integration_tests.rs:587: bat()
1829+tests/integration_tests.rs:588: .arg("--pager=bat")
1830+tests/integration_tests.rs:593: .stderr(predicate::str::contains("bat as a pager is disallowed"));
1831+tests/integration_tests.rs:603: bat()
1832+tests/integration_tests.rs:613:/// If the bat-specific BAT_PAGER is used, obey the wish of the user
1833+tests/integration_tests.rs:617:fn pager_most_from_bat_pager_env_var() {
1834+tests/integration_tests.rs:619: bat()
1835+tests/integration_tests.rs:620: .env("BAT_PAGER", mocked_pagers::from("most"))
1836+tests/integration_tests.rs:629:/// Same reasoning with --pager as with BAT_PAGER
1837+tests/integration_tests.rs:634: bat()
1838+tests/integration_tests.rs:649: bat()
1839+tests/integration_tests.rs:664: bat()
1840+tests/integration_tests.rs:676: bat()
1841+tests/integration_tests.rs:687: bat()
1842+tests/integration_tests.rs:699: bat()
1843+tests/integration_tests.rs:700: .env("BAT_PAGER", "mismatched-quotes 'a")
1844+tests/integration_tests.rs:710: bat()
1845+tests/integration_tests.rs:714: .stdout(predicate::str::contains("BAT_PAGER="))
1846+tests/integration_tests.rs:720: bat_with_config()
1847+tests/integration_tests.rs:721: .env("BAT_CONFIG_PATH", "bat.conf")
1848+tests/integration_tests.rs:725: .stdout("bat.conf\n");
1849+tests/integration_tests.rs:727: bat_with_config()
1850+tests/integration_tests.rs:728: .env("BAT_CONFIG_PATH", "not-existing.conf")
1851+tests/integration_tests.rs:740: // Create the file with bat
1852+tests/integration_tests.rs:741: bat_with_config()
1853+tests/integration_tests.rs:742: .env("BAT_CONFIG_PATH", tmp_config_path.to_str().unwrap())
1854+tests/integration_tests.rs:756:fn config_location_from_bat_config_dir_variable() {
1855+tests/integration_tests.rs:757: bat_with_config()
1856+tests/integration_tests.rs:758: .env("BAT_CONFIG_DIR", "conf/")
1857+tests/integration_tests.rs:767: bat_with_config()
1858+tests/integration_tests.rs:768: .env("BAT_CONFIG_PATH", "bat.conf")
1859+tests/integration_tests.rs:778: bat()
1860+tests/integration_tests.rs:789: bat_with_config()
1861+tests/integration_tests.rs:799: bat_with_config()
1862+tests/integration_tests.rs:810: bat_with_config()
1863+tests/integration_tests.rs:820: bat_with_config().arg("cach").assert().failure();
1864+tests/integration_tests.rs:827: bat()
1865+tests/integration_tests.rs:836: bat_with_config()
1866+tests/integration_tests.rs:878: bat()
1867+tests/integration_tests.rs:898: bat()
1868+tests/integration_tests.rs:910: bat()
1869+tests/integration_tests.rs:922: bat()
1870+tests/integration_tests.rs:936: bat()
1871+tests/integration_tests.rs:950: bat()
1872+tests/integration_tests.rs:966: bat_with_config()
1873+tests/integration_tests.rs:979: bat()
1874+tests/integration_tests.rs:995: bat()
1875+tests/integration_tests.rs:1008: bat()
1876+tests/integration_tests.rs:1020: bat()
1877+tests/integration_tests.rs:1040: bat()
1878+tests/integration_tests.rs:1057: .stderr("\x1b[33m[bat warning]\x1b[0m: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.\n");
1879+tests/integration_tests.rs:1077: bat()
1880+tests/integration_tests.rs:1093: bat()
1881+tests/integration_tests.rs:1105: let cmd_for_file = bat()
1882+tests/integration_tests.rs:1114: let cmd_for_stdin = bat()
1883+tests/integration_tests.rs:1134: bat()
1884+tests/integration_tests.rs:1147: bat()
1885+tests/integration_tests.rs:1157: bat()
1886+tests/integration_tests.rs:1169: bat()
1887+tests/integration_tests.rs:1181: bat()
1888+tests/integration_tests.rs:1193: bat()
1889+tests/integration_tests.rs:1204:// Regression test for https://github.com/sharkdp/bat/issues/299
1890+tests/integration_tests.rs:1207: bat()
1891+tests/integration_tests.rs:1231: bat()
1892+tests/integration_tests.rs:1240: bat()
1893+tests/integration_tests.rs:1250: bat()
1894+tests/examples/regression_tests/issue_985.js:3:# bat --map-syntax '*.js:Markdown' --file-name 'issue_985.js' < issue_985.js
1895+tests/examples/regression_tests/issue_985.js:4:# bat --map-syntax '*.js:Markdown' --file-name 'issue_985.js' issue_985.js
1896+tests/utils/mocked_pagers.rs:16:/// On Windows: 'most' -> 'most.bat'
1897+tests/utils/mocked_pagers.rs:19: format!("{}.bat", base)
1898+tests/benchmarks/benchmark-results/syntax-highlighting-speed-miniz.c.md:3:| `bat … miniz.c` | 96.2 ± 1.9 | 92.6 | 99.6 | 1.00 |
1899+tests/benchmarks/benchmark-results/syntax-highlighting-speed-jquery.js.md:3:| `bat … jquery.js` | 692.4 ± 5.6 | 684.2 | 701.8 | 1.00 |
1900+tests/benchmarks/benchmark-results/syntax-highlighting-speed-test_multiarray.py.json:4: "command": "bat … test_multiarray.py",
1901+tests/benchmarks/benchmark-results/syntax-highlighting-speed-jquery.js.json:4: "command": "bat … jquery.js",
1902+tests/benchmarks/benchmark-results/plain-text-speed.json:4: "command": "bat … --language=txt test_multiarray.py",
1903+tests/benchmarks/benchmark-results/syntax-highlighting-speed-test_multiarray.ansi-sequences.txt.md:3:| `bat … test_multiarray.ansi-sequences.txt` | 125.3 ± 5.6 | 119.3 | 140.4 | 1.00 |
1904+tests/benchmarks/benchmark-results/syntax-highlighting-speed-test_multiarray.py.md:3:| `bat … test_multiarray.py` | 924.7 ± 4.4 | 917.1 | 932.3 | 1.00 |
1905+tests/benchmarks/benchmark-results/report.md:1:## `bat` benchmark results
1906+tests/benchmarks/benchmark-results/report.md:7:| `bat` | 6.9 ± 0.6 | 5.6 | 9.2 | 1.00 |
1907+tests/benchmarks/benchmark-results/report.md:13:| `bat … --language=txt test_multiarray.py` | 10.4 ± 0.6 | 9.0 | 12.1 | 1.00 |
1908+tests/benchmarks/benchmark-results/report.md:19:| `bat … jquery.js` | 692.4 ± 5.6 | 684.2 | 701.8 | 1.00 |
1909+tests/benchmarks/benchmark-results/report.md:25:| `bat … miniz.c` | 96.2 ± 1.9 | 92.6 | 99.6 | 1.00 |
1910+tests/benchmarks/benchmark-results/report.md:31:| `bat … test_multiarray.ansi-sequences.txt` | 125.3 ± 5.6 | 119.3 | 140.4 | 1.00 |
1911+tests/benchmarks/benchmark-results/report.md:37:| `bat … test_multiarray.py` | 924.7 ± 4.4 | 917.1 | 932.3 | 1.00 |
1912+tests/benchmarks/benchmark-results/startup-time.md:3:| `bat` | 6.9 ± 0.6 | 5.6 | 9.2 | 1.00 |
1913+tests/benchmarks/benchmark-results/syntax-highlighting-speed-miniz.c.json:4: "command": "bat … miniz.c",
1914+tests/benchmarks/benchmark-results/plain-text-speed.md:3:| `bat … --language=txt test_multiarray.py` | 10.4 ± 0.6 | 9.0 | 12.1 | 1.00 |
1915+tests/benchmarks/benchmark-results/syntax-highlighting-speed-jquery-3.3.1.js.json:4: "command": "/home/shark/.cargo-target/release/bat --style=full --color=always --paging=never test-src/jquery-3.3.1.js",
1916+tests/benchmarks/benchmark-results/syntax-highlighting-speed-test_multiarray.highlighted.txt.json:4: "command": "bat … test_multiarray.highlighted.txt",
1917+tests/benchmarks/benchmark-results/syntax-highlighting-speed-test_multiarray.ansi-sequences.txt.json:4: "command": "bat … test_multiarray.ansi-sequences.txt",
1918+tests/benchmarks/benchmark-results/syntax-highlighting-speed-jquery-3.3.1.min.js.json:4: "command": "/home/shark/.cargo-target/release/bat --style=full --color=always --paging=never test-src/jquery-3.3.1.min.js",
1919+tests/benchmarks/benchmark-results/ansi-sequence-forwarding.json:4: "command": "bat … test_multiarray.highlighted.txt",
1920+tests/benchmarks/benchmark-results/startup-time.json:4: "command": "bat",
1921+tests/benchmarks/run-benchmarks.sh:33:unset BAT_CACHE_PATH
1922+tests/benchmarks/run-benchmarks.sh:34:unset BAT_CONFIG_DIR
1923+tests/benchmarks/run-benchmarks.sh:35:unset BAT_CONFIG_PATH
1924+tests/benchmarks/run-benchmarks.sh:36:unset BAT_OPTS
1925+tests/benchmarks/run-benchmarks.sh:37:unset BAT_PAGER
1926+tests/benchmarks/run-benchmarks.sh:38:unset BAT_STYLE
1927+tests/benchmarks/run-benchmarks.sh:39:unset BAT_TABS
1928+tests/benchmarks/run-benchmarks.sh:40:unset BAT_THEME
1929+tests/benchmarks/run-benchmarks.sh:50:TARGET_RELEASE="${TARGET_DIR}/release/bat"
1930+tests/benchmarks/run-benchmarks.sh:55:BAT=''
1931+tests/benchmarks/run-benchmarks.sh:58: --system) BAT="bat" ;;
1932+tests/benchmarks/run-benchmarks.sh:59: --release) BAT="$TARGET_RELEASE" ;;
1933+tests/benchmarks/run-benchmarks.sh:60: --bat=*) BAT="${arg:6}" ;;
1934+tests/benchmarks/run-benchmarks.sh:64:if [[ -z "$BAT" ]]; then
1935+tests/benchmarks/run-benchmarks.sh:65: echo "A build of 'bat' must be specified for benchmarking."
1936+tests/benchmarks/run-benchmarks.sh:66: echo "You can use '--system', '--release' or '--bat=path/to/bat'."
1937+tests/benchmarks/run-benchmarks.sh:70:if ! command -v "$BAT" &>/dev/null; then
1938+tests/benchmarks/run-benchmarks.sh:71: echo "Could not find the build of bat to benchmark ($BAT)."
1939+tests/benchmarks/run-benchmarks.sh:72: case "$BAT" in
1940+tests/benchmarks/run-benchmarks.sh:73: "bat") echo "Make you sure to symlink 'batcat' as 'bat'." ;;
1941+tests/benchmarks/run-benchmarks.sh:83:echo "## \`bat\` benchmark results" >> "$REPORT"
1942+tests/benchmarks/run-benchmarks.sh:88: "$(printf "%q" "$BAT") --no-config" \
1943+tests/benchmarks/run-benchmarks.sh:89: --command-name "bat" \
1944+tests/benchmarks/run-benchmarks.sh:98: "$(printf "%q" "$BAT") --no-config --language=txt --style=plain test-src/test_multiarray.py" \
1945+tests/benchmarks/run-benchmarks.sh:99: --command-name 'bat … --language=txt test_multiarray.py' \
1946+tests/benchmarks/run-benchmarks.sh:111: "$(printf "%q" "$BAT") --no-config --style=full --color=always '$SRC'" \
1947+tests/benchmarks/run-benchmarks.sh:112: --command-name "bat … ${filename}" \
1948+tests/snapshots/generate_snapshots.py:35:def build_bat():
1949+tests/snapshots/generate_snapshots.py:36: print("building bat")
1950+tests/snapshots/generate_snapshots.py:55:build_bat()
1951+tests/syntax-tests/create_highlighted_versions.py:11:BAT_OPTIONS = [
1952+tests/syntax-tests/create_highlighted_versions.py:23: "bat_options",
1953+tests/syntax-tests/create_highlighted_versions.py:28: options = BAT_OPTIONS.copy()
1954+tests/syntax-tests/create_highlighted_versions.py:31: options_file = path.join(source_dirpath, "bat_options")
1955+tests/syntax-tests/create_highlighted_versions.py:44: env.pop("BAT_CACHE_PATH", None)
1956+tests/syntax-tests/create_highlighted_versions.py:45: env.pop("BAT_CONFIG_DIR", None)
1957+tests/syntax-tests/create_highlighted_versions.py:46: env.pop("BAT_CONFIG_PATH", None)
1958+tests/syntax-tests/create_highlighted_versions.py:47: env.pop("BAT_OPTS", None)
1959+tests/syntax-tests/create_highlighted_versions.py:48: env.pop("BAT_PAGER", None)
1960+tests/syntax-tests/create_highlighted_versions.py:49: env.pop("BAT_STYLE", None)
1961+tests/syntax-tests/create_highlighted_versions.py:50: env.pop("BAT_TABS", None)
1962+tests/syntax-tests/create_highlighted_versions.py:51: env.pop("BAT_THEME", None)
1963+tests/syntax-tests/create_highlighted_versions.py:62: bat_output = subprocess.check_output(
1964+tests/syntax-tests/create_highlighted_versions.py:63: ["bat"] + get_options(source) + [source],
1965+tests/syntax-tests/create_highlighted_versions.py:74: output_file.write(bat_output)
1966+tests/syntax-tests/create_highlighted_versions.py:98: "=== bat stdout:\n{}".format(err.stdout.decode("utf-8")),
1967+tests/syntax-tests/create_highlighted_versions.py:102: "=== bat stderr:\n{}".format(err.stderr.decode("utf-8")),
1968+tests/syntax-tests/create_highlighted_versions.py:108: "Error: Could not execute 'bat'. Please make sure that the executable "
1969+tests/syntax-tests/BatTestCustomAssets.sublime-syntax:4:name: BatTestCustomAssets
1970+tests/syntax-tests/BatTestCustomAssets.sublime-syntax:6: - battestcustomassets
1971+tests/syntax-tests/BatTestCustomAssets.sublime-syntax:7:scope: source.battestcustomassets
1972+tests/syntax-tests/BatTestCustomAssets.sublime-syntax:9:# This syntax is used to test if custom assets work with bat.
1973+tests/syntax-tests/BatTestCustomAssets.sublime-syntax:20: 1: keyword.other.battestcustomassets-key
1974+tests/syntax-tests/BatTestCustomAssets.sublime-syntax:21: 2: string.other.battestcustomassets-value
1975+tests/syntax-tests/highlighted/C/test.c:21: /* This C program was written to help bat
1976+tests/syntax-tests/highlighted/QML/BatSyntaxTest.qml:19: service: "org.bat.service"
1977+tests/syntax-tests/highlighted/QML/BatSyntaxTest.qml:41: text: qsTr("Install Bat.")
1978+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:16: ## `bat` as a library
1979+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:17:diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
1980+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:19:--- a/src/bin/bat/app.rs
1981+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:20:+++ b/src/bin/bat/app.rs
1982+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:23: use bat::{
1983+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:61:diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs
1984+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:63:--- a/src/bin/bat/clap_app.rs
1985+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:64:+++ b/src/bin/bat/clap_app.rs
1986+tests/syntax-tests/highlighted/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:66: data to bat from STDIN when bat does not otherwise know \
1987+tests/syntax-tests/highlighted/Git Attributes/example.gitattributes:10:*.bat text eol=crlf
1988+tests/syntax-tests/highlighted/SSH Config/ssh_config:8: BatchMode no
1989+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:1:BAT(1) General Commands Manual BAT(1)
1990+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:4: bat - a cat(1) clone with syntax highlighting and Git integration.
1991+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:7: bat [OPTIONS] [FILE]...
1992+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:9: bat cache [CACHE-OPTIONS] [--build|--clear]
1993+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:12: bat prints the syntax-highlighted content of a collection of FILEs to
1994+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:16: bat supports a large number of programming and markup languages. It
1995+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:18: git index. bat automatically pipes its output through a pager (by de‐
1996+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:21: Whenever the output of bat goes to a non-interactive terminal, i.e.
1997+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:22: when the output is piped into another process or into a file, bat will
1998+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:112: if the output of bat is piped to another program, but you want
1999+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:119: set BAT_PAGER to an empty string. To control which pager is
2000+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:126: PAGER and BAT_PAGER environment variables. The default pager is
2001+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:143: BAT_THEME environment variable (e.g.: export BAT_THEME="...").
2002+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:156: to the configuration file or export the BAT_STYLE environment
2003+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:157: variable (e.g.: export BAT_STYLE=".."). Possible values: *auto*,
2004+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:202: bat can also be customized with a configuration file. The location of
2005+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:206: bat --config-file
2006+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:208: Alternatively, you can use the BAT_CONFIG_PATH environment variable to
2007+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:209: point bat to a non-default location of the configuration file.
2008+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:212: bat supports Sublime Text .sublime-syntax language files, and can be
2009+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:214: do this, add the .sublime-snytax language files to `$(bat --config-
2010+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:215: dir)/syntaxes` and run `bat cache --build`.
2011+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:219: mkdir -p "$(bat --config-dir)/syntaxes"
2012+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:220: cd "$(bat --config-dir)/syntaxes"
2013+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:227: bat cache --build
2014+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:229: Once the cache is built, the new language will be visible in `bat
2015+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:232: cache with `bat cache --clear`.
2016+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:235: Similarly to custom languages, bat supports Sublime Text .tmTheme
2017+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:236: themes. These can be installed to `$(bat --config-dir)/themes`, and
2018+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:237: are added to the cache with `bat cache --build`.
2019+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:240: For more information and up-to-date documentation, visit the bat repo:
2020+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:241: https://github.com/sharkdp/bat
2021+tests/syntax-tests/highlighted/Manpage/bat-0.16.man:243: BAT(1)
2022+tests/syntax-tests/highlighted/Svelte/App.svelte:30: // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
2023+tests/syntax-tests/highlighted/VimL/source.vim:77:" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)
2024+tests/syntax-tests/highlighted/Java/test.java:3:/* This Java program was submiited to help bat
2025+tests/syntax-tests/highlighted/Sass/example.sass:46: background-image: url("https://github.com/sharkdp/bat/raw/master/doc/logo-header.svg")
2026+tests/syntax-tests/highlighted/HTML/test.html:5: <title>Bat Syntax Test</title>
2027+tests/syntax-tests/highlighted/Cpp/test.cpp:6:/* This C program was submitted to help bat
2028+tests/syntax-tests/highlighted/Crystal/test.cr:1:# An example file to test Crystal syntax highlighting in bat
2029+tests/syntax-tests/highlighted/Crystal/test.cr:58:greeter = Greeter.new("bat")
2030+tests/syntax-tests/highlighted/GLSL/test.glsl:38: // This GLSL code serves the purpose of bat syntax highlighting tests
2031+tests/syntax-tests/highlighted/CMake/CMakeLists.txt:3:project(hello-bat VERSION 0.0.1 LANGUAGES C)
2032+tests/syntax-tests/highlighted/CMake/CMakeLists.txt:8:add_executable(hello-bat SOURCES)
2033+tests/syntax-tests/highlighted/CMake/CMakeLists.txt:11:target_link_libraries(hello-bat assimp)
2034+tests/syntax-tests/highlighted/SCSS/example.scss:48: background-image: url("https://github.com/sharkdp/bat/raw/master/doc/logo-header.svg");
2035+tests/syntax-tests/highlighted/TOML/Cargo.toml:5:homepage = "https://github.com/sharkdp/bat"
2036+tests/syntax-tests/highlighted/TOML/Cargo.toml:7:name = "bat"
2037+tests/syntax-tests/highlighted/TOML/Cargo.toml:9:repository = "https://github.com/sharkdp/bat"
2038+tests/syntax-tests/highlighted/TOML/Cargo.toml:20:# Feature required for bat the application. Should be disabled when depending on
2039+tests/syntax-tests/highlighted/TOML/Cargo.toml:21:# bat as a library.
2040+tests/syntax-tests/highlighted/Erlang/bat_erlang.erl:1:-module(bat_erlang).
2041+tests/syntax-tests/highlighted/Bash/batgrep.sh:3:# bat-extras | Copyright (C) 2020 eth-p and contributors | MIT License
2042+tests/syntax-tests/highlighted/Bash/batgrep.sh:5:# Repository: https://github.com/eth-p/bat-extras
2043+tests/syntax-tests/highlighted/Bash/batgrep.sh:6:# Issues: https://github.com/eth-p/bat-extras/issues
2044+tests/syntax-tests/highlighted/Bash/batgrep.sh:37:printc "%{YELLOW}[%s warning]%{CLEAR}: $1%{CLEAR}\n" "batgrep" "${@:2}" 1>&2
2045+tests/syntax-tests/highlighted/Bash/batgrep.sh:40:printc "%{RED}[%s error]%{CLEAR}: $1%{CLEAR}\n" "batgrep" "${@:2}" 1>&2
2046+tests/syntax-tests/highlighted/Bash/batgrep.sh:116:if [[ -n ${BAT_PAGER+x} ]];then
2047+tests/syntax-tests/highlighted/Bash/batgrep.sh:117:SCRIPT_PAGER_CMD=($BAT_PAGER)
2048+tests/syntax-tests/highlighted/Bash/batgrep.sh:169:printc "%{RED}%s: '%s' requires a value%{CLEAR}\n" "batgrep" "$ARG"
2049+tests/syntax-tests/highlighted/Bash/batgrep.sh:185:*)printc "%{RED}%s: '--color' expects value of 'auto', 'always', or 'never'%{CLEAR}\n" "batgrep"
2050+tests/syntax-tests/highlighted/Bash/batgrep.sh:217:*)printc "%{RED}%s: '--paging' expects value of 'auto', 'always', or 'never'%{CLEAR}\n" "batgrep"
2051+tests/syntax-tests/highlighted/Bash/batgrep.sh:238:"batgrep" \
2052+tests/syntax-tests/highlighted/Bash/batgrep.sh:241:"https://github.com/eth-p/bat-extras"
2053+tests/syntax-tests/highlighted/Bash/batgrep.sh:269:bat_version(){
2054+tests/syntax-tests/highlighted/Bash/batgrep.sh:270:"bat" --version|cut -d ' ' -f 2
2055+tests/syntax-tests/highlighted/Bash/batgrep.sh:319:BAT_ARGS=()
2056+tests/syntax-tests/highlighted/Bash/batgrep.sh:330:BAT_STYLE="header,numbers"
2057+tests/syntax-tests/highlighted/Bash/batgrep.sh:331:if version_compare "$(bat_version)" -gt "0.12";then
2058+tests/syntax-tests/highlighted/Bash/batgrep.sh:419:printc "%{RED}%s: unknown option '%s'%{CLEAR}\n" "batgrep" "$OPT" 1>&2
2059+tests/syntax-tests/highlighted/Bash/batgrep.sh:444:BAT_ARGS+=("--color=always")
2060+tests/syntax-tests/highlighted/Bash/batgrep.sh:446:BAT_ARGS+=("--color=never")
2061+tests/syntax-tests/highlighted/Bash/batgrep.sh:462:'the pager was explicitly disabled by $BAT_PAGER or the' \
2062+tests/syntax-tests/highlighted/Bash/batgrep.sh:482:"bat" "${BAT_ARGS[@]}" \
2063+tests/syntax-tests/highlighted/Bash/batgrep.sh:485:--style="$BAT_STYLE$OPT_SNIP" \
2064+tests/syntax-tests/highlighted/Bash/simple.sh:15: | cat | bat - | cat
2065+tests/syntax-tests/highlighted/Bash/simple.sh:20:if command -v bat &> /dev/null; then
2066+tests/syntax-tests/highlighted/Rust/output.rs:39: let pager_from_env = match (env::var("BAT_PAGER"), env::var("PAGER")) {
2067+tests/syntax-tests/highlighted/Rust/output.rs:40: (Ok(bat_pager), _) => Some(bat_pager),
2068+tests/syntax-tests/highlighted/Rust/output.rs:43: // ANSI color sequences printed by bat. If someone has set PAGER="less -F", we
2069+tests/syntax-tests/highlighted/Rust/output.rs:46: // We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER
2070+tests/syntax-tests/highlighted/Rust/output.rs:47: // or bats '--pager' command line option.
2071+tests/syntax-tests/highlighted/Rust/output.rs:71: if pager_path.file_stem() == Some(&OsString::from("bat")) {
2072+tests/syntax-tests/source/C/test.c:21: /* This C program was written to help bat
2073+tests/syntax-tests/source/QML/BatSyntaxTest.qml:19: service: "org.bat.service"
2074+tests/syntax-tests/source/QML/BatSyntaxTest.qml:41: text: qsTr("Install Bat.")
2075+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:16: ## `bat` as a library
2076+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:17:diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
2077+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:19:--- a/src/bin/bat/app.rs
2078+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:20:+++ b/src/bin/bat/app.rs
2079+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:23: use bat::{
2080+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:61:diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs
2081+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:63:--- a/src/bin/bat/clap_app.rs
2082+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:64:+++ b/src/bin/bat/clap_app.rs
2083+tests/syntax-tests/source/Diff/82e7786e747b1fcfac1f963ae6415a22ec9caae1.diff:66: data to bat from STDIN when bat does not otherwise know \
2084+tests/syntax-tests/source/Git Attributes/example.gitattributes:10:*.bat text eol=crlf
2085+tests/syntax-tests/source/SSH Config/ssh_config:8: BatchMode no
2086+tests/syntax-tests/source/Manpage/bat-0.16.man:1:BAT(1) General Commands Manual BAT(1)
2087+tests/syntax-tests/source/Manpage/bat-0.16.man:4: bat - a cat(1) clone with syntax highlighting and Git integration.
2088+tests/syntax-tests/source/Manpage/bat-0.16.man:7: bat [OPTIONS] [FILE]...
2089+tests/syntax-tests/source/Manpage/bat-0.16.man:9: bat cache [CACHE-OPTIONS] [--build|--clear]
2090+tests/syntax-tests/source/Manpage/bat-0.16.man:12: bat prints the syntax-highlighted content of a collection of FILEs to
2091+tests/syntax-tests/source/Manpage/bat-0.16.man:16: bat supports a large number of programming and markup languages. It
2092+tests/syntax-tests/source/Manpage/bat-0.16.man:18: git index. bat automatically pipes its output through a pager (by de‐
2093+tests/syntax-tests/source/Manpage/bat-0.16.man:21: Whenever the output of bat goes to a non-interactive terminal, i.e.
2094+tests/syntax-tests/source/Manpage/bat-0.16.man:22: when the output is piped into another process or into a file, bat will
2095+tests/syntax-tests/source/Manpage/bat-0.16.man:112: if the output of bat is piped to another program, but you want
2096+tests/syntax-tests/source/Manpage/bat-0.16.man:119: set BAT_PAGER to an empty string. To control which pager is
2097+tests/syntax-tests/source/Manpage/bat-0.16.man:126: PAGER and BAT_PAGER environment variables. The default pager is
2098+tests/syntax-tests/source/Manpage/bat-0.16.man:143: BAT_THEME environment variable (e.g.: export BAT_THEME="...").
2099+tests/syntax-tests/source/Manpage/bat-0.16.man:156: to the configuration file or export the BAT_STYLE environment
2100+tests/syntax-tests/source/Manpage/bat-0.16.man:157: variable (e.g.: export BAT_STYLE=".."). Possible values: *auto*,
2101+tests/syntax-tests/source/Manpage/bat-0.16.man:202: bat can also be customized with a configuration file. The location of
2102+tests/syntax-tests/source/Manpage/bat-0.16.man:206: bat --config-file
2103+tests/syntax-tests/source/Manpage/bat-0.16.man:208: Alternatively, you can use the BAT_CONFIG_PATH environment variable to
2104+tests/syntax-tests/source/Manpage/bat-0.16.man:209: point bat to a non-default location of the configuration file.
2105+tests/syntax-tests/source/Manpage/bat-0.16.man:212: bat supports Sublime Text .sublime-syntax language files, and can be
2106+tests/syntax-tests/source/Manpage/bat-0.16.man:214: do this, add the .sublime-snytax language files to `$(bat --config-
2107+tests/syntax-tests/source/Manpage/bat-0.16.man:215: dir)/syntaxes` and run `bat cache --build`.
2108+tests/syntax-tests/source/Manpage/bat-0.16.man:219: mkdir -p "$(bat --config-dir)/syntaxes"
2109+tests/syntax-tests/source/Manpage/bat-0.16.man:220: cd "$(bat --config-dir)/syntaxes"
2110+tests/syntax-tests/source/Manpage/bat-0.16.man:227: bat cache --build
2111+tests/syntax-tests/source/Manpage/bat-0.16.man:229: Once the cache is built, the new language will be visible in `bat
2112+tests/syntax-tests/source/Manpage/bat-0.16.man:232: cache with `bat cache --clear`.
2113+tests/syntax-tests/source/Manpage/bat-0.16.man:235: Similarly to custom languages, bat supports Sublime Text .tmTheme
2114+tests/syntax-tests/source/Manpage/bat-0.16.man:236: themes. These can be installed to `$(bat --config-dir)/themes`, and
2115+tests/syntax-tests/source/Manpage/bat-0.16.man:237: are added to the cache with `bat cache --build`.
2116+tests/syntax-tests/source/Manpage/bat-0.16.man:240: For more information and up-to-date documentation, visit the bat repo:
2117+tests/syntax-tests/source/Manpage/bat-0.16.man:241: https://github.com/sharkdp/bat
2118+tests/syntax-tests/source/Manpage/bat-0.16.man:243: BAT(1)
2119+tests/syntax-tests/source/Svelte/App.svelte:30: // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
2120+tests/syntax-tests/source/VimL/source.vim:77:" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)
2121+tests/syntax-tests/source/Git Config/LICENSE.md:1:The `test.gitconfig` file has been added from https://github.com/sharkdp/bat/pull/1336#issuecomment-715905807. Its "free to use".
2122+tests/syntax-tests/source/Java/test.java:3:/* This Java program was submiited to help bat
2123+tests/syntax-tests/source/Sass/example.sass:46: background-image: url("https://github.com/sharkdp/bat/raw/master/doc/logo-header.svg")
2124+tests/syntax-tests/source/HTML/test.html:5: <title>Bat Syntax Test</title>
2125+tests/syntax-tests/source/Cpp/test.cpp:6:/* This C program was submitted to help bat
2126+tests/syntax-tests/source/Crystal/test.cr:1:# An example file to test Crystal syntax highlighting in bat
2127+tests/syntax-tests/source/Crystal/test.cr:58:greeter = Greeter.new("bat")
2128+tests/syntax-tests/source/GLSL/test.glsl:38: // This GLSL code serves the purpose of bat syntax highlighting tests
2129+tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md:216:For the Eclipse JDT Core Batch Compiler (ecj-x.x.x.jar) component and the
2130+tests/syntax-tests/source/Java Server Page (JSP)/NOTICE:23:JDT Core Batch Compiler component, which is open source software.
2131+tests/syntax-tests/source/CMake/CMakeLists.txt:3:project(hello-bat VERSION 0.0.1 LANGUAGES C)
2132+tests/syntax-tests/source/CMake/CMakeLists.txt:8:add_executable(hello-bat SOURCES)
2133+tests/syntax-tests/source/CMake/CMakeLists.txt:11:target_link_libraries(hello-bat assimp)
2134+tests/syntax-tests/source/SCSS/example.scss:48: background-image: url("https://github.com/sharkdp/bat/raw/master/doc/logo-header.svg");
2135+tests/syntax-tests/source/TOML/Cargo.toml:5:homepage = "https://github.com/sharkdp/bat"
2136+tests/syntax-tests/source/TOML/Cargo.toml:7:name = "bat"
2137+tests/syntax-tests/source/TOML/Cargo.toml:9:repository = "https://github.com/sharkdp/bat"
2138+tests/syntax-tests/source/TOML/Cargo.toml:20:# Feature required for bat the application. Should be disabled when depending on
2139+tests/syntax-tests/source/TOML/Cargo.toml:21:# bat as a library.
2140+tests/syntax-tests/source/Erlang/bat_erlang.erl:1:-module(bat_erlang).
2141+tests/syntax-tests/source/Batch/LICENSE.md:1:The `build.bat` file has been added from https://github.com/Leandros/ClangOnWindows/blob/master/build.bat under the following license:
2142+tests/syntax-tests/source/Bash/batgrep.sh:3:# bat-extras | Copyright (C) 2020 eth-p and contributors | MIT License
2143+tests/syntax-tests/source/Bash/batgrep.sh:5:# Repository: https://github.com/eth-p/bat-extras
2144+tests/syntax-tests/source/Bash/batgrep.sh:6:# Issues: https://github.com/eth-p/bat-extras/issues
2145+tests/syntax-tests/source/Bash/batgrep.sh:37:printc "%{YELLOW}[%s warning]%{CLEAR}: $1%{CLEAR}\n" "batgrep" "${@:2}" 1>&2
2146+tests/syntax-tests/source/Bash/batgrep.sh:40:printc "%{RED}[%s error]%{CLEAR}: $1%{CLEAR}\n" "batgrep" "${@:2}" 1>&2
2147+tests/syntax-tests/source/Bash/batgrep.sh:116:if [[ -n ${BAT_PAGER+x} ]];then
2148+tests/syntax-tests/source/Bash/batgrep.sh:117:SCRIPT_PAGER_CMD=($BAT_PAGER)
2149+tests/syntax-tests/source/Bash/batgrep.sh:169:printc "%{RED}%s: '%s' requires a value%{CLEAR}\n" "batgrep" "$ARG"
2150+tests/syntax-tests/source/Bash/batgrep.sh:185:*)printc "%{RED}%s: '--color' expects value of 'auto', 'always', or 'never'%{CLEAR}\n" "batgrep"
2151+tests/syntax-tests/source/Bash/batgrep.sh:217:*)printc "%{RED}%s: '--paging' expects value of 'auto', 'always', or 'never'%{CLEAR}\n" "batgrep"
2152+tests/syntax-tests/source/Bash/batgrep.sh:238:"batgrep" \
2153+tests/syntax-tests/source/Bash/batgrep.sh:241:"https://github.com/eth-p/bat-extras"
2154+tests/syntax-tests/source/Bash/batgrep.sh:269:bat_version(){
2155+tests/syntax-tests/source/Bash/batgrep.sh:270:"bat" --version|cut -d ' ' -f 2
2156+tests/syntax-tests/source/Bash/batgrep.sh:319:BAT_ARGS=()
2157+tests/syntax-tests/source/Bash/batgrep.sh:330:BAT_STYLE="header,numbers"
2158+tests/syntax-tests/source/Bash/batgrep.sh:331:if version_compare "$(bat_version)" -gt "0.12";then
2159+tests/syntax-tests/source/Bash/batgrep.sh:419:printc "%{RED}%s: unknown option '%s'%{CLEAR}\n" "batgrep" "$OPT" 1>&2
2160+tests/syntax-tests/source/Bash/batgrep.sh:444:BAT_ARGS+=("--color=always")
2161+tests/syntax-tests/source/Bash/batgrep.sh:446:BAT_ARGS+=("--color=never")
2162+tests/syntax-tests/source/Bash/batgrep.sh:462:'the pager was explicitly disabled by $BAT_PAGER or the' \
2163+tests/syntax-tests/source/Bash/batgrep.sh:482:"bat" "${BAT_ARGS[@]}" \
2164+tests/syntax-tests/source/Bash/batgrep.sh:485:--style="$BAT_STYLE$OPT_SNIP" \
2165+tests/syntax-tests/source/Bash/simple.sh:15: | cat | bat - | cat
2166+tests/syntax-tests/source/Bash/simple.sh:20:if command -v bat &> /dev/null; then
2167+tests/syntax-tests/source/Rust/output.rs:39: let pager_from_env = match (env::var("BAT_PAGER"), env::var("PAGER")) {
2168+tests/syntax-tests/source/Rust/output.rs:40: (Ok(bat_pager), _) => Some(bat_pager),
2169+tests/syntax-tests/source/Rust/output.rs:43: // ANSI color sequences printed by bat. If someone has set PAGER="less -F", we
2170+tests/syntax-tests/source/Rust/output.rs:46: // We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER
2171+tests/syntax-tests/source/Rust/output.rs:47: // or bats '--pager' command line option.
2172+tests/syntax-tests/source/Rust/output.rs:71: if pager_path.file_stem() == Some(&OsString::from("bat")) {
2173+tests/syntax-tests/test_custom_assets.sh:6:BAT_CONFIG_DIR=$(mktemp -d)
2174+tests/syntax-tests/test_custom_assets.sh:7:export BAT_CONFIG_DIR
2175+tests/syntax-tests/test_custom_assets.sh:9:BAT_CACHE_PATH=$(mktemp -d)
2176+tests/syntax-tests/test_custom_assets.sh:10:export BAT_CACHE_PATH
2177+tests/syntax-tests/test_custom_assets.sh:13:BAT_CONFIG_DIR = ${BAT_CONFIG_DIR}
2178+tests/syntax-tests/test_custom_assets.sh:14:BAT_CACHE_PATH = ${BAT_CACHE_PATH}
2179+tests/syntax-tests/test_custom_assets.sh:20: "--language=BatTestCustomAssets"
2180+tests/syntax-tests/test_custom_assets.sh:21: "tests/syntax-tests/source/BatTestCustomAssets/NoColorsUnlessCustomAssetsAreUsed.battestcustomassets"
2181+tests/syntax-tests/test_custom_assets.sh:42:echo_step "TEST: Make sure 'BatTestCustomAssets' is not part of integrated syntaxes"
2182+tests/syntax-tests/test_custom_assets.sh:43:bat -f "${custom_syntax_args[@]}" &&
2183+tests/syntax-tests/test_custom_assets.sh:46:echo_step "PREPARE: Install custom syntax 'BatTestCustomAssets'"
2184+tests/syntax-tests/test_custom_assets.sh:47:custom_syntaxes_dir="$(bat --config-dir)/syntaxes"
2185+tests/syntax-tests/test_custom_assets.sh:49:cp -v "tests/syntax-tests/BatTestCustomAssets.sublime-syntax" \
2186+tests/syntax-tests/test_custom_assets.sh:50: "${custom_syntaxes_dir}/BatTestCustomAssets.sublime-syntax"
2187+tests/syntax-tests/test_custom_assets.sh:52:echo_step "PREPARE: Build custom assets to enable 'BatTestCustomAssets' syntax"
2188+tests/syntax-tests/test_custom_assets.sh:53:bat cache --build
2189+tests/syntax-tests/test_custom_assets.sh:55:echo_step "TEST: 'BatTestCustomAssets' is a known syntax"
2190+tests/syntax-tests/test_custom_assets.sh:56:bat -f "${custom_syntax_args[@]}" ||
2191+tests/syntax-tests/test_custom_assets.sh:60:bat -f "${integrated_syntax_args[@]}" ||
2192+tests/syntax-tests/test_custom_assets.sh:63:echo_step "TEST: 'BatTestCustomAssets' is an unknown syntax with --no-custom-assets"
2193+tests/syntax-tests/test_custom_assets.sh:64:bat -f --no-custom-assets "${custom_syntax_args[@]}" &&
2194+tests/syntax-tests/test_custom_assets.sh:67:echo_step "TEST: 'bat cache --clear' removes all files"
2195+tests/syntax-tests/test_custom_assets.sh:68:bat cache --clear
2196+tests/syntax-tests/test_custom_assets.sh:69:remaining_files=$(ls -A "${BAT_CACHE_PATH}")
2197+tests/syntax-tests/test_custom_assets.sh:74:rm -rv "${BAT_CONFIG_DIR}" "${BAT_CACHE_PATH}"
2198+tests/assets.rs:1:use bat::assets::HighlightingAssets;
2199+tests/no_duplicate_extensions.rs:3:use bat::assets::HighlightingAssets;
2200+tests/scripts/find-slow-to-highlight-files.py:3:# This script goes through all languages that are supported by 'bat'. For each
2201+tests/scripts/find-slow-to-highlight-files.py:5:# given folder for matching files. It calls 'bat' for each of these files and
2202+tests/scripts/find-slow-to-highlight-files.py:8:# execution of 'bat'.
2203+tests/scripts/find-slow-to-highlight-files.py:11:# - bat (in the $PATH)
2204+tests/scripts/find-slow-to-highlight-files.py:24:# Maximum time we allow `bat` to run
2205+tests/scripts/find-slow-to-highlight-files.py:25:BAT_TIMEOUT_SEC = 10
2206+tests/scripts/find-slow-to-highlight-files.py:62: sp.check_output(["bat", "--color=always", path], timeout=BAT_TIMEOUT_SEC)
2207+tests/scripts/find-slow-to-highlight-files.py:77: if num_chars < THRESHOLD_SPEED * BAT_TIMEOUT_SEC:
2208+tests/scripts/find-slow-to-highlight-files.py:78: print(f" Error: bat timed out on file '{path.decode()}'.")
2209+tests/scripts/find-slow-to-highlight-files.py:81: f" Warning: bat timed out on file '{path.decode()} (but the file is large)."
2210+tests/scripts/find-slow-to-highlight-files.py:85:def measure_bat_startup_speed():
2211+tests/scripts/find-slow-to-highlight-files.py:90: ["bat", "--color=always", "--language=py"], stdin=sp.PIPE, stdout=sp.PIPE
2212+tests/scripts/find-slow-to-highlight-files.py:102: output = sp.check_output(["bat", "--list-languages"]).decode()
2213+tests/scripts/find-slow-to-highlight-files.py:113: print("Measuring 'bat' startup speed ... ", flush=True, end="")
2214+tests/scripts/find-slow-to-highlight-files.py:114: startup_time = measure_bat_startup_speed()
2215+tests/tester.rs:13:pub struct BatTester {
2216+tests/tester.rs:17: /// Path to the *bat* executable
2217+tests/tester.rs:21:impl BatTester {
2218+tests/tester.rs:35: .expect("bat failed");
2219+tests/tester.rs:52:impl Default for BatTester {
2220+tests/tester.rs:61: .expect("bat executable directory")
2221+tests/tester.rs:64: let exe_name = if cfg!(windows) { "bat.exe" } else { "bat" };
2222+tests/tester.rs:67: BatTester { temp_dir, exe }
2223+tests/tester.rs:86: let signature = Signature::now("bat test runner", "bat@test.runner")?;
2224+tests/snapshot_tests.rs:3:use crate::tester::BatTester;
2225+tests/snapshot_tests.rs:10: let bat_tester = BatTester::default();
2226+tests/snapshot_tests.rs:11: bat_tester.test_snapshot(stringify!($test_name), $style);
2227+diagnostics/info.sh:2:_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool')
2228+diagnostics/info.sh:10:BAT="bat"
2229+diagnostics/info.sh:11:if ! command -v bat &>/dev/null; then
2230+diagnostics/info.sh:12: if command -v batcat &> /dev/null; then
2231+diagnostics/info.sh:13: BAT="batcat"
2232+diagnostics/info.sh:17: "Unable to find a bat executable on your PATH." \
2233+diagnostics/info.sh:18: "Please ensure that 'bat' exists and is not named something else."
2234+diagnostics/info.sh:28:_bat_:description() {
2235+diagnostics/info.sh:29: _collects "Version information for 'bat'."
2236+diagnostics/info.sh:30: _collects "Custom syntaxes and themes for 'bat'."
2237+diagnostics/info.sh:33:_bat_config_:description() {
2238+diagnostics/info.sh:34: _collects "The environment variables used by 'bat'."
2239+diagnostics/info.sh:35: _collects "The 'bat' configuration file."
2240+diagnostics/info.sh:38:_bat_wrapper_:description() {
2241+diagnostics/info.sh:39: _collects "Any wrapper script used by 'bat'."
2242+diagnostics/info.sh:42:_bat_wrapper_function_:description() {
2243+diagnostics/info.sh:43: _collects "The wrapper function surrounding 'bat' (if applicable)."
2244+diagnostics/info.sh:57:_bat_:run() {
2245+diagnostics/info.sh:58: _out "$BAT" --version
2246+diagnostics/info.sh:59: _out env | grep '^BAT_\|^PAGER='
2247+diagnostics/info.sh:62: cache_dir="$($BAT --cache-dir)"
2248+diagnostics/info.sh:64: _print_command "$BAT" "--list-languages"
2249+diagnostics/info.sh:69: _print_command "$BAT" "--list-themes"
2250+diagnostics/info.sh:74:_bat_config_:run() {
2251+diagnostics/info.sh:75: if [[ -f "$("$BAT" --config-file)" ]]; then
2252+diagnostics/info.sh:76: _out_fence cat "$("$BAT" --config-file)"
2253+diagnostics/info.sh:80:_bat_wrapper_:run() {
2254+diagnostics/info.sh:81: _bat_wrapper_:detect_wrapper() {
2255+diagnostics/info.sh:82: local bat="$1"
2256+diagnostics/info.sh:83: if file "$(command -v "${bat}")" | grep "text executable" &> /dev/null; then
2257+diagnostics/info.sh:84: _out_fence cat "$(command -v "${bat}")"
2258+diagnostics/info.sh:88: printf "\nNo wrapper script for '%s'.\n" "${bat}"
2259+diagnostics/info.sh:91: _bat_wrapper_:detect_wrapper bat
2260+diagnostics/info.sh:92: if [[ "$BAT" != "bat" ]]; then
2261+diagnostics/info.sh:93: _bat_wrapper_:detect_wrapper "$BAT"
2262+diagnostics/info.sh:97:_bat_wrapper_function_:run() {
2263+diagnostics/info.sh:98: _bat_wrapper_function_:detect_wrapper() {
2264+diagnostics/info.sh:125: _bat_wrapper_function_:detect_wrapper bat
2265+diagnostics/info.sh:126: _bat_wrapper_function_:detect_wrapper cat
2266+diagnostics/info.sh:127: if [[ "$BAT" != "bat" ]]; then
2267+diagnostics/info.sh:128: _bat_wrapper_function_:detect_wrapper "$BAT"
2268+diagnostics/info.sh:180:system and bat configuration. It will give you a small preview of the commands
2269+diagnostics/info.sh:201: | sed "s/\"\$BAT\"/$BAT/" 1>&2
2270+diagnostics/info.sh:228:# Tell the user if their executable isn't named "bat".
2271+diagnostics/info.sh:229:if [[ "$BAT" != "bat" ]] && [[ "$1" != '-y' ]]; then
2272+diagnostics/info.sh:235: printf "The %s executable on your system is named '%s'.\n%s\n" "bat" "$BAT" \
tests/benchmarks/test-src/jquery-3.3.1.js → tests/benchmarks/highlighting-speed-src/jquery.jsrenamed

The content is the same.

tests/benchmarks/test-src/miniz.c → tests/benchmarks/highlighting-speed-src/miniz.crenamed

The content is the same.

tests/benchmarks/highlighting-speed-src/numpy_test_multiarray.pynew file+8471
@@ -0,0 +1,8471 @@
1+import collections.abc
2+import tempfile
3+import sys
4+import shutil
5+import warnings
6+import operator
7+import io
8+import itertools
9+import functools
10+import ctypes
11+import os
12+import gc
13+import weakref
14+import pytest
15+from contextlib import contextmanager
16+
17+from numpy.compat import pickle
18+
19+import pathlib
20+import builtins
21+from decimal import Decimal
22+
23+import numpy as np
24+from numpy.compat import strchar
25+import numpy.core._multiarray_tests as _multiarray_tests
26+from numpy.testing import (
27+ assert_, assert_raises, assert_warns, assert_equal, assert_almost_equal,
28+ assert_array_equal, assert_raises_regex, assert_array_almost_equal,
29+ assert_allclose, IS_PYPY, HAS_REFCOUNT, assert_array_less, runstring,
30+ temppath, suppress_warnings, break_cycles,
31+ )
32+from numpy.testing._private.utils import _no_tracing
33+from numpy.core.tests._locales import CommaDecimalPointLocale
34+
35+# Need to test an object that does not fully implement math interface
36+from datetime import timedelta, datetime
37+
38+
39+def _aligned_zeros(shape, dtype=float, order="C", align=None):
40+ """
41+ Allocate a new ndarray with aligned memory.
42+
43+ The ndarray is guaranteed *not* aligned to twice the requested alignment.
44+ Eg, if align=4, guarantees it is not aligned to 8. If align=None uses
45+ dtype.alignment."""
46+ dtype = np.dtype(dtype)
47+ if dtype == np.dtype(object):
48+ # Can't do this, fall back to standard allocation (which
49+ # should always be sufficiently aligned)
50+ if align is not None:
51+ raise ValueError("object array alignment not supported")
52+ return np.zeros(shape, dtype=dtype, order=order)
53+ if align is None:
54+ align = dtype.alignment
55+ if not hasattr(shape, '__len__'):
56+ shape = (shape,)
57+ size = functools.reduce(operator.mul, shape) * dtype.itemsize
58+ buf = np.empty(size + 2*align + 1, np.uint8)
59+
60+ ptr = buf.__array_interface__['data'][0]
61+ offset = ptr % align
62+ if offset != 0:
63+ offset = align - offset
64+ if (ptr % (2*align)) == 0:
65+ offset += align
66+
67+ # Note: slices producing 0-size arrays do not necessarily change
68+ # data pointer --- so we use and allocate size+1
69+ buf = buf[offset:offset+size+1][:-1]
70+ data = np.ndarray(shape, dtype, buf, order=order)
71+ data.fill(0)
72+ return data
73+
74+
75+class TestFlags:
76+ def setup(self):
77+ self.a = np.arange(10)
78+
79+ def test_writeable(self):
80+ mydict = locals()
81+ self.a.flags.writeable = False
82+ assert_raises(ValueError, runstring, 'self.a[0] = 3', mydict)
83+ assert_raises(ValueError, runstring, 'self.a[0:1].itemset(3)', mydict)
84+ self.a.flags.writeable = True
85+ self.a[0] = 5
86+ self.a[0] = 0
87+
88+ def test_writeable_any_base(self):
89+ # Ensure that any base being writeable is sufficient to change flag;
90+ # this is especially interesting for arrays from an array interface.
91+ arr = np.arange(10)
92+
93+ class subclass(np.ndarray):
94+ pass
95+
96+ # Create subclass so base will not be collapsed, this is OK to change
97+ view1 = arr.view(subclass)
98+ view2 = view1[...]
99+ arr.flags.writeable = False
100+ view2.flags.writeable = False
101+ view2.flags.writeable = True # Can be set to True again.
102+
103+ arr = np.arange(10)
104+
105+ class frominterface:
106+ def __init__(self, arr):
107+ self.arr = arr
108+ self.__array_interface__ = arr.__array_interface__
109+
110+ view1 = np.asarray(frominterface)
111+ view2 = view1[...]
112+ view2.flags.writeable = False
113+ view2.flags.writeable = True
114+
115+ view1.flags.writeable = False
116+ view2.flags.writeable = False
117+ with assert_raises(ValueError):
118+ # Must assume not writeable, since only base is not:
119+ view2.flags.writeable = True
120+
121+ def test_writeable_from_readonly(self):
122+ # gh-9440 - make sure fromstring, from buffer on readonly buffers
123+ # set writeable False
124+ data = b'\x00' * 100
125+ vals = np.frombuffer(data, 'B')
126+ assert_raises(ValueError, vals.setflags, write=True)
127+ types = np.dtype( [('vals', 'u1'), ('res3', 'S4')] )
128+ values = np.core.records.fromstring(data, types)
129+ vals = values['vals']
130+ assert_raises(ValueError, vals.setflags, write=True)
131+
132+ def test_writeable_from_buffer(self):
133+ data = bytearray(b'\x00' * 100)
134+ vals = np.frombuffer(data, 'B')
135+ assert_(vals.flags.writeable)
136+ vals.setflags(write=False)
137+ assert_(vals.flags.writeable is False)
138+ vals.setflags(write=True)
139+ assert_(vals.flags.writeable)
140+ types = np.dtype( [('vals', 'u1'), ('res3', 'S4')] )
141+ values = np.core.records.fromstring(data, types)
142+ vals = values['vals']
143+ assert_(vals.flags.writeable)
144+ vals.setflags(write=False)
145+ assert_(vals.flags.writeable is False)
146+ vals.setflags(write=True)
147+ assert_(vals.flags.writeable)
148+
149+ @pytest.mark.skipif(IS_PYPY, reason="PyPy always copies")
150+ def test_writeable_pickle(self):
151+ import pickle
152+ # Small arrays will be copied without setting base.
153+ # See condition for using PyArray_SetBaseObject in
154+ # array_setstate.
155+ a = np.arange(1000)
156+ for v in range(pickle.HIGHEST_PROTOCOL):
157+ vals = pickle.loads(pickle.dumps(a, v))
158+ assert_(vals.flags.writeable)
159+ assert_(isinstance(vals.base, bytes))
160+
161+ def test_writeable_from_c_data(self):
162+ # Test that the writeable flag can be changed for an array wrapping
163+ # low level C-data, but not owning its data.
164+ # Also see that this is deprecated to change from python.
165+ from numpy.core._multiarray_tests import get_c_wrapping_array
166+
167+ arr_writeable = get_c_wrapping_array(True)
168+ assert not arr_writeable.flags.owndata
169+ assert arr_writeable.flags.writeable
170+ view = arr_writeable[...]
171+
172+ # Toggling the writeable flag works on the view:
173+ view.flags.writeable = False
174+ assert not view.flags.writeable
175+ view.flags.writeable = True
176+ assert view.flags.writeable
177+ # Flag can be unset on the arr_writeable:
178+ arr_writeable.flags.writeable = False
179+
180+ arr_readonly = get_c_wrapping_array(False)
181+ assert not arr_readonly.flags.owndata
182+ assert not arr_readonly.flags.writeable
183+
184+ for arr in [arr_writeable, arr_readonly]:
185+ view = arr[...]
186+ view.flags.writeable = False # make sure it is readonly
187+ arr.flags.writeable = False
188+ assert not arr.flags.writeable
189+
190+ with assert_raises(ValueError):
191+ view.flags.writeable = True
192+
193+ with warnings.catch_warnings():
194+ warnings.simplefilter("error", DeprecationWarning)
195+ with assert_raises(DeprecationWarning):
196+ arr.flags.writeable = True
197+
198+ with assert_warns(DeprecationWarning):
199+ arr.flags.writeable = True
200+
201+ def test_warnonwrite(self):
202+ a = np.arange(10)
203+ a.flags._warn_on_write = True
204+ with warnings.catch_warnings(record=True) as w:
205+ warnings.filterwarnings('always')
206+ a[1] = 10
207+ a[2] = 10
208+ # only warn once
209+ assert_(len(w) == 1)
210+
211+ def test_otherflags(self):
212+ assert_equal(self.a.flags.carray, True)
213+ assert_equal(self.a.flags['C'], True)
214+ assert_equal(self.a.flags.farray, False)
215+ assert_equal(self.a.flags.behaved, True)
216+ assert_equal(self.a.flags.fnc, False)
217+ assert_equal(self.a.flags.forc, True)
218+ assert_equal(self.a.flags.owndata, True)
219+ assert_equal(self.a.flags.writeable, True)
220+ assert_equal(self.a.flags.aligned, True)
221+ with assert_warns(DeprecationWarning):
222+ assert_equal(self.a.flags.updateifcopy, False)
223+ with assert_warns(DeprecationWarning):
224+ assert_equal(self.a.flags['U'], False)
225+ assert_equal(self.a.flags['UPDATEIFCOPY'], False)
226+ assert_equal(self.a.flags.writebackifcopy, False)
227+ assert_equal(self.a.flags['X'], False)
228+ assert_equal(self.a.flags['WRITEBACKIFCOPY'], False)
229+
230+ def test_string_align(self):
231+ a = np.zeros(4, dtype=np.dtype('|S4'))
232+ assert_(a.flags.aligned)
233+ # not power of two are accessed byte-wise and thus considered aligned
234+ a = np.zeros(5, dtype=np.dtype('|S4'))
235+ assert_(a.flags.aligned)
236+
237+ def test_void_align(self):
238+ a = np.zeros(4, dtype=np.dtype([("a", "i4"), ("b", "i4")]))
239+ assert_(a.flags.aligned)
240+
241+
242+class TestHash:
243+ # see #3793
244+ def test_int(self):
245+ for st, ut, s in [(np.int8, np.uint8, 8),
246+ (np.int16, np.uint16, 16),
247+ (np.int32, np.uint32, 32),
248+ (np.int64, np.uint64, 64)]:
249+ for i in range(1, s):
250+ assert_equal(hash(st(-2**i)), hash(-2**i),
251+ err_msg="%r: -2**%d" % (st, i))
252+ assert_equal(hash(st(2**(i - 1))), hash(2**(i - 1)),
253+ err_msg="%r: 2**%d" % (st, i - 1))
254+ assert_equal(hash(st(2**i - 1)), hash(2**i - 1),
255+ err_msg="%r: 2**%d - 1" % (st, i))
256+
257+ i = max(i - 1, 1)
258+ assert_equal(hash(ut(2**(i - 1))), hash(2**(i - 1)),
259+ err_msg="%r: 2**%d" % (ut, i - 1))
260+ assert_equal(hash(ut(2**i - 1)), hash(2**i - 1),
261+ err_msg="%r: 2**%d - 1" % (ut, i))
262+
263+
264+class TestAttributes:
265+ def setup(self):
266+ self.one = np.arange(10)
267+ self.two = np.arange(20).reshape(4, 5)
268+ self.three = np.arange(60, dtype=np.float64).reshape(2, 5, 6)
269+
270+ def test_attributes(self):
271+ assert_equal(self.one.shape, (10,))
272+ assert_equal(self.two.shape, (4, 5))
273+ assert_equal(self.three.shape, (2, 5, 6))
274+ self.three.shape = (10, 3, 2)
275+ assert_equal(self.three.shape, (10, 3, 2))
276+ self.three.shape = (2, 5, 6)
277+ assert_equal(self.one.strides, (self.one.itemsize,))
278+ num = self.two.itemsize
279+ assert_equal(self.two.strides, (5*num, num))
280+ num = self.three.itemsize
281+ assert_equal(self.three.strides, (30*num, 6*num, num))
282+ assert_equal(self.one.ndim, 1)
283+ assert_equal(self.two.ndim, 2)
284+ assert_equal(self.three.ndim, 3)
285+ num = self.two.itemsize
286+ assert_equal(self.two.size, 20)
287+ assert_equal(self.two.nbytes, 20*num)
288+ assert_equal(self.two.itemsize, self.two.dtype.itemsize)
289+ assert_equal(self.two.base, np.arange(20))
290+
291+ def test_dtypeattr(self):
292+ assert_equal(self.one.dtype, np.dtype(np.int_))
293+ assert_equal(self.three.dtype, np.dtype(np.float_))
294+ assert_equal(self.one.dtype.char, 'l')
295+ assert_equal(self.three.dtype.char, 'd')
296+ assert_(self.three.dtype.str[0] in '<>')
297+ assert_equal(self.one.dtype.str[1], 'i')
298+ assert_equal(self.three.dtype.str[1], 'f')
299+
300+ def test_int_subclassing(self):
301+ # Regression test for https://github.com/numpy/numpy/pull/3526
302+
303+ numpy_int = np.int_(0)
304+
305+ # int_ doesn't inherit from Python int, because it's not fixed-width
306+ assert_(not isinstance(numpy_int, int))
307+
308+ def test_stridesattr(self):
309+ x = self.one
310+
311+ def make_array(size, offset, strides):
312+ return np.ndarray(size, buffer=x, dtype=int,
313+ offset=offset*x.itemsize,
314+ strides=strides*x.itemsize)
315+
316+ assert_equal(make_array(4, 4, -1), np.array([4, 3, 2, 1]))
317+ assert_raises(ValueError, make_array, 4, 4, -2)
318+ assert_raises(ValueError, make_array, 4, 2, -1)
319+ assert_raises(ValueError, make_array, 8, 3, 1)
320+ assert_equal(make_array(8, 3, 0), np.array([3]*8))
321+ # Check behavior reported in gh-2503:
322+ assert_raises(ValueError, make_array, (2, 3), 5, np.array([-2, -3]))
323+ make_array(0, 0, 10)
324+
325+ def test_set_stridesattr(self):
326+ x = self.one
327+
328+ def make_array(size, offset, strides):
329+ try:
330+ r = np.ndarray([size], dtype=int, buffer=x,
331+ offset=offset*x.itemsize)
332+ except Exception as e:
333+ raise RuntimeError(e)
334+ r.strides = strides = strides*x.itemsize
335+ return r
336+
337+ assert_equal(make_array(4, 4, -1), np.array([4, 3, 2, 1]))
338+ assert_equal(make_array(7, 3, 1), np.array([3, 4, 5, 6, 7, 8, 9]))
339+ assert_raises(ValueError, make_array, 4, 4, -2)
340+ assert_raises(ValueError, make_array, 4, 2, -1)
341+ assert_raises(RuntimeError, make_array, 8, 3, 1)
342+ # Check that the true extent of the array is used.
343+ # Test relies on as_strided base not exposing a buffer.
344+ x = np.lib.stride_tricks.as_strided(np.arange(1), (10, 10), (0, 0))
345+
346+ def set_strides(arr, strides):
347+ arr.strides = strides
348+
349+ assert_raises(ValueError, set_strides, x, (10*x.itemsize, x.itemsize))
350+
351+ # Test for offset calculations:
352+ x = np.lib.stride_tricks.as_strided(np.arange(10, dtype=np.int8)[-1],
353+ shape=(10,), strides=(-1,))
354+ assert_raises(ValueError, set_strides, x[::-1], -1)
355+ a = x[::-1]
356+ a.strides = 1
357+ a[::2].strides = 2
358+
359+ # test 0d
360+ arr_0d = np.array(0)
361+ arr_0d.strides = ()
362+ assert_raises(TypeError, set_strides, arr_0d, None)
363+
364+ def test_fill(self):
365+ for t in "?bhilqpBHILQPfdgFDGO":
366+ x = np.empty((3, 2, 1), t)
367+ y = np.empty((3, 2, 1), t)
368+ x.fill(1)
369+ y[...] = 1
370+ assert_equal(x, y)
371+
372+ def test_fill_max_uint64(self):
373+ x = np.empty((3, 2, 1), dtype=np.uint64)
374+ y = np.empty((3, 2, 1), dtype=np.uint64)
375+ value = 2**64 - 1
376+ y[...] = value
377+ x.fill(value)
378+ assert_array_equal(x, y)
379+
380+ def test_fill_struct_array(self):
381+ # Filling from a scalar
382+ x = np.array([(0, 0.0), (1, 1.0)], dtype='i4,f8')
383+ x.fill(x[0])
384+ assert_equal(x['f1'][1], x['f1'][0])
385+ # Filling from a tuple that can be converted
386+ # to a scalar
387+ x = np.zeros(2, dtype=[('a', 'f8'), ('b', 'i4')])
388+ x.fill((3.5, -2))
389+ assert_array_equal(x['a'], [3.5, 3.5])
390+ assert_array_equal(x['b'], [-2, -2])
391+
392+
393+class TestArrayConstruction:
394+ def test_array(self):
395+ d = np.ones(6)
396+ r = np.array([d, d])
397+ assert_equal(r, np.ones((2, 6)))
398+
399+ d = np.ones(6)
400+ tgt = np.ones((2, 6))
401+ r = np.array([d, d])
402+ assert_equal(r, tgt)
403+ tgt[1] = 2
404+ r = np.array([d, d + 1])
405+ assert_equal(r, tgt)
406+
407+ d = np.ones(6)
408+ r = np.array([[d, d]])
409+ assert_equal(r, np.ones((1, 2, 6)))
410+
411+ d = np.ones(6)
412+ r = np.array([[d, d], [d, d]])
413+ assert_equal(r, np.ones((2, 2, 6)))
414+
415+ d = np.ones((6, 6))
416+ r = np.array([d, d])
417+ assert_equal(r, np.ones((2, 6, 6)))
418+
419+ d = np.ones((6, ))
420+ r = np.array([[d, d + 1], d + 2], dtype=object)
421+ assert_equal(len(r), 2)
422+ assert_equal(r[0], [d, d + 1])
423+ assert_equal(r[1], d + 2)
424+
425+ tgt = np.ones((2, 3), dtype=bool)
426+ tgt[0, 2] = False
427+ tgt[1, 0:2] = False
428+ r = np.array([[True, True, False], [False, False, True]])
429+ assert_equal(r, tgt)
430+ r = np.array([[True, False], [True, False], [False, True]])
431+ assert_equal(r, tgt.T)
432+
433+ def test_array_empty(self):
434+ assert_raises(TypeError, np.array)
435+
436+ def test_array_copy_false(self):
437+ d = np.array([1, 2, 3])
438+ e = np.array(d, copy=False)
439+ d[1] = 3
440+ assert_array_equal(e, [1, 3, 3])
441+ e = np.array(d, copy=False, order='F')
442+ d[1] = 4
443+ assert_array_equal(e, [1, 4, 3])
444+ e[2] = 7
445+ assert_array_equal(d, [1, 4, 7])
446+
447+ def test_array_copy_true(self):
448+ d = np.array([[1,2,3], [1, 2, 3]])
449+ e = np.array(d, copy=True)
450+ d[0, 1] = 3
451+ e[0, 2] = -7
452+ assert_array_equal(e, [[1, 2, -7], [1, 2, 3]])
453+ assert_array_equal(d, [[1, 3, 3], [1, 2, 3]])
454+ e = np.array(d, copy=True, order='F')
455+ d[0, 1] = 5
456+ e[0, 2] = 7
457+ assert_array_equal(e, [[1, 3, 7], [1, 2, 3]])
458+ assert_array_equal(d, [[1, 5, 3], [1,2,3]])
459+
460+ def test_array_cont(self):
461+ d = np.ones(10)[::2]
462+ assert_(np.ascontiguousarray(d).flags.c_contiguous)
463+ assert_(np.ascontiguousarray(d).flags.f_contiguous)
464+ assert_(np.asfortranarray(d).flags.c_contiguous)
465+ assert_(np.asfortranarray(d).flags.f_contiguous)
466+ d = np.ones((10, 10))[::2,::2]
467+ assert_(np.ascontiguousarray(d).flags.c_contiguous)
468+ assert_(np.asfortranarray(d).flags.f_contiguous)
469+
470+
471+class TestAssignment:
472+ def test_assignment_broadcasting(self):
473+ a = np.arange(6).reshape(2, 3)
474+
475+ # Broadcasting the input to the output
476+ a[...] = np.arange(3)
477+ assert_equal(a, [[0, 1, 2], [0, 1, 2]])
478+ a[...] = np.arange(2).reshape(2, 1)
479+ assert_equal(a, [[0, 0, 0], [1, 1, 1]])
480+
481+ # For compatibility with <= 1.5, a limited version of broadcasting
482+ # the output to the input.
483+ #
484+ # This behavior is inconsistent with NumPy broadcasting
485+ # in general, because it only uses one of the two broadcasting
486+ # rules (adding a new "1" dimension to the left of the shape),
487+ # applied to the output instead of an input. In NumPy 2.0, this kind
488+ # of broadcasting assignment will likely be disallowed.
489+ a[...] = np.arange(6)[::-1].reshape(1, 2, 3)
490+ assert_equal(a, [[5, 4, 3], [2, 1, 0]])
491+ # The other type of broadcasting would require a reduction operation.
492+
493+ def assign(a, b):
494+ a[...] = b
495+
496+ assert_raises(ValueError, assign, a, np.arange(12).reshape(2, 2, 3))
497+
498+ def test_assignment_errors(self):
499+ # Address issue #2276
500+ class C:
501+ pass
502+ a = np.zeros(1)
503+
504+ def assign(v):
505+ a[0] = v
506+
507+ assert_raises((AttributeError, TypeError), assign, C())
508+ assert_raises(ValueError, assign, [1])
509+
510+ def test_unicode_assignment(self):
511+ # gh-5049
512+ from numpy.core.numeric import set_string_function
513+
514+ @contextmanager
515+ def inject_str(s):
516+ """ replace ndarray.__str__ temporarily """
517+ set_string_function(lambda x: s, repr=False)
518+ try:
519+ yield
520+ finally:
521+ set_string_function(None, repr=False)
522+
523+ a1d = np.array([u'test'])
524+ a0d = np.array(u'done')
525+ with inject_str(u'bad'):
526+ a1d[0] = a0d # previously this would invoke __str__
527+ assert_equal(a1d[0], u'done')
528+
529+ # this would crash for the same reason
530+ np.array([np.array(u'\xe5\xe4\xf6')])
531+
532+ def test_stringlike_empty_list(self):
533+ # gh-8902
534+ u = np.array([u'done'])
535+ b = np.array([b'done'])
536+
537+ class bad_sequence:
538+ def __getitem__(self): pass
539+ def __len__(self): raise RuntimeError
540+
541+ assert_raises(ValueError, operator.setitem, u, 0, [])
542+ assert_raises(ValueError, operator.setitem, b, 0, [])
543+
544+ assert_raises(ValueError, operator.setitem, u, 0, bad_sequence())
545+ assert_raises(ValueError, operator.setitem, b, 0, bad_sequence())
546+
547+ def test_longdouble_assignment(self):
548+ # only relevant if longdouble is larger than float
549+ # we're looking for loss of precision
550+
551+ for dtype in (np.longdouble, np.longcomplex):
552+ # gh-8902
553+ tinyb = np.nextafter(np.longdouble(0), 1).astype(dtype)
554+ tinya = np.nextafter(np.longdouble(0), -1).astype(dtype)
555+
556+ # construction
557+ tiny1d = np.array([tinya])
558+ assert_equal(tiny1d[0], tinya)
559+
560+ # scalar = scalar
561+ tiny1d[0] = tinyb
562+ assert_equal(tiny1d[0], tinyb)
563+
564+ # 0d = scalar
565+ tiny1d[0, ...] = tinya
566+ assert_equal(tiny1d[0], tinya)
567+
568+ # 0d = 0d
569+ tiny1d[0, ...] = tinyb[...]
570+ assert_equal(tiny1d[0], tinyb)
571+
572+ # scalar = 0d
573+ tiny1d[0] = tinyb[...]
574+ assert_equal(tiny1d[0], tinyb)
575+
576+ arr = np.array([np.array(tinya)])
577+ assert_equal(arr[0], tinya)
578+
579+ def test_cast_to_string(self):
580+ # cast to str should do "str(scalar)", not "str(scalar.item())"
581+ # Example: In python2, str(float) is truncated, so we want to avoid
582+ # str(np.float64(...).item()) as this would incorrectly truncate.
583+ a = np.zeros(1, dtype='S20')
584+ a[:] = np.array(['1.12345678901234567890'], dtype='f8')
585+ assert_equal(a[0], b"1.1234567890123457")
586+
587+
588+class TestDtypedescr:
589+ def test_construction(self):
590+ d1 = np.dtype('i4')
591+ assert_equal(d1, np.dtype(np.int32))
592+ d2 = np.dtype('f8')
593+ assert_equal(d2, np.dtype(np.float64))
594+
595+ def test_byteorders(self):
596+ assert_(np.dtype('<i4') != np.dtype('>i4'))
597+ assert_(np.dtype([('a', '<i4')]) != np.dtype([('a', '>i4')]))
598+
599+ def test_structured_non_void(self):
600+ fields = [('a', '<i2'), ('b', '<i2')]
601+ dt_int = np.dtype(('i4', fields))
602+ assert_equal(str(dt_int), "(numpy.int32, [('a', '<i2'), ('b', '<i2')])")
603+
604+ # gh-9821
605+ arr_int = np.zeros(4, dt_int)
606+ assert_equal(repr(arr_int),
607+ "array([0, 0, 0, 0], dtype=(numpy.int32, [('a', '<i2'), ('b', '<i2')]))")
608+
609+
610+class TestZeroRank:
611+ def setup(self):
612+ self.d = np.array(0), np.array('x', object)
613+
614+ def test_ellipsis_subscript(self):
615+ a, b = self.d
616+ assert_equal(a[...], 0)
617+ assert_equal(b[...], 'x')
618+ assert_(a[...].base is a) # `a[...] is a` in numpy <1.9.
619+ assert_(b[...].base is b) # `b[...] is b` in numpy <1.9.
620+
621+ def test_empty_subscript(self):
622+ a, b = self.d
623+ assert_equal(a[()], 0)
624+ assert_equal(b[()], 'x')
625+ assert_(type(a[()]) is a.dtype.type)
626+ assert_(type(b[()]) is str)
627+
628+ def test_invalid_subscript(self):
629+ a, b = self.d
630+ assert_raises(IndexError, lambda x: x[0], a)
631+ assert_raises(IndexError, lambda x: x[0], b)
632+ assert_raises(IndexError, lambda x: x[np.array([], int)], a)
633+ assert_raises(IndexError, lambda x: x[np.array([], int)], b)
634+
635+ def test_ellipsis_subscript_assignment(self):
636+ a, b = self.d
637+ a[...] = 42
638+ assert_equal(a, 42)
639+ b[...] = ''
640+ assert_equal(b.item(), '')
641+
642+ def test_empty_subscript_assignment(self):
643+ a, b = self.d
644+ a[()] = 42
645+ assert_equal(a, 42)
646+ b[()] = ''
647+ assert_equal(b.item(), '')
648+
649+ def test_invalid_subscript_assignment(self):
650+ a, b = self.d
651+
652+ def assign(x, i, v):
653+ x[i] = v
654+
655+ assert_raises(IndexError, assign, a, 0, 42)
656+ assert_raises(IndexError, assign, b, 0, '')
657+ assert_raises(ValueError, assign, a, (), '')
658+
659+ def test_newaxis(self):
660+ a, b = self.d
661+ assert_equal(a[np.newaxis].shape, (1,))
662+ assert_equal(a[..., np.newaxis].shape, (1,))
663+ assert_equal(a[np.newaxis, ...].shape, (1,))
664+ assert_equal(a[..., np.newaxis].shape, (1,))
665+ assert_equal(a[np.newaxis, ..., np.newaxis].shape, (1, 1))
666+ assert_equal(a[..., np.newaxis, np.newaxis].shape, (1, 1))
667+ assert_equal(a[np.newaxis, np.newaxis, ...].shape, (1, 1))
668+ assert_equal(a[(np.newaxis,)*10].shape, (1,)*10)
669+
670+ def test_invalid_newaxis(self):
671+ a, b = self.d
672+
673+ def subscript(x, i):
674+ x[i]
675+
676+ assert_raises(IndexError, subscript, a, (np.newaxis, 0))
677+ assert_raises(IndexError, subscript, a, (np.newaxis,)*50)
678+
679+ def test_constructor(self):
680+ x = np.ndarray(())
681+ x[()] = 5
682+ assert_equal(x[()], 5)
683+ y = np.ndarray((), buffer=x)
684+ y[()] = 6
685+ assert_equal(x[()], 6)
686+
687+ # strides and shape must be the same length
688+ with pytest.raises(ValueError):
689+ np.ndarray((2,), strides=())
690+ with pytest.raises(ValueError):
691+ np.ndarray((), strides=(2,))
692+
693+ def test_output(self):
694+ x = np.array(2)
695+ assert_raises(ValueError, np.add, x, [1], x)
696+
697+ def test_real_imag(self):
698+ # contiguity checks are for gh-11245
699+ x = np.array(1j)
700+ xr = x.real
701+ xi = x.imag
702+
703+ assert_equal(xr, np.array(0))
704+ assert_(type(xr) is np.ndarray)
705+ assert_equal(xr.flags.contiguous, True)
706+ assert_equal(xr.flags.f_contiguous, True)
707+
708+ assert_equal(xi, np.array(1))
709+ assert_(type(xi) is np.ndarray)
710+ assert_equal(xi.flags.contiguous, True)
711+ assert_equal(xi.flags.f_contiguous, True)
712+
713+
714+class TestScalarIndexing:
715+ def setup(self):
716+ self.d = np.array([0, 1])[0]
717+
718+ def test_ellipsis_subscript(self):
719+ a = self.d
720+ assert_equal(a[...], 0)
721+ assert_equal(a[...].shape, ())
722+
723+ def test_empty_subscript(self):
724+ a = self.d
725+ assert_equal(a[()], 0)
726+ assert_equal(a[()].shape, ())
727+
728+ def test_invalid_subscript(self):
729+ a = self.d
730+ assert_raises(IndexError, lambda x: x[0], a)
731+ assert_raises(IndexError, lambda x: x[np.array([], int)], a)
732+
733+ def test_invalid_subscript_assignment(self):
734+ a = self.d
735+
736+ def assign(x, i, v):
737+ x[i] = v
738+
739+ assert_raises(TypeError, assign, a, 0, 42)
740+
741+ def test_newaxis(self):
742+ a = self.d
743+ assert_equal(a[np.newaxis].shape, (1,))
744+ assert_equal(a[..., np.newaxis].shape, (1,))
745+ assert_equal(a[np.newaxis, ...].shape, (1,))
746+ assert_equal(a[..., np.newaxis].shape, (1,))
747+ assert_equal(a[np.newaxis, ..., np.newaxis].shape, (1, 1))
748+ assert_equal(a[..., np.newaxis, np.newaxis].shape, (1, 1))
749+ assert_equal(a[np.newaxis, np.newaxis, ...].shape, (1, 1))
750+ assert_equal(a[(np.newaxis,)*10].shape, (1,)*10)
751+
752+ def test_invalid_newaxis(self):
753+ a = self.d
754+
755+ def subscript(x, i):
756+ x[i]
757+
758+ assert_raises(IndexError, subscript, a, (np.newaxis, 0))
759+ assert_raises(IndexError, subscript, a, (np.newaxis,)*50)
760+
761+ def test_overlapping_assignment(self):
762+ # With positive strides
763+ a = np.arange(4)
764+ a[:-1] = a[1:]
765+ assert_equal(a, [1, 2, 3, 3])
766+
767+ a = np.arange(4)
768+ a[1:] = a[:-1]
769+ assert_equal(a, [0, 0, 1, 2])
770+
771+ # With positive and negative strides
772+ a = np.arange(4)
773+ a[:] = a[::-1]
774+ assert_equal(a, [3, 2, 1, 0])
775+
776+ a = np.arange(6).reshape(2, 3)
777+ a[::-1,:] = a[:, ::-1]
778+ assert_equal(a, [[5, 4, 3], [2, 1, 0]])
779+
780+ a = np.arange(6).reshape(2, 3)
781+ a[::-1, ::-1] = a[:, ::-1]
782+ assert_equal(a, [[3, 4, 5], [0, 1, 2]])
783+
784+ # With just one element overlapping
785+ a = np.arange(5)
786+ a[:3] = a[2:]
787+ assert_equal(a, [2, 3, 4, 3, 4])
788+
789+ a = np.arange(5)
790+ a[2:] = a[:3]
791+ assert_equal(a, [0, 1, 0, 1, 2])
792+
793+ a = np.arange(5)
794+ a[2::-1] = a[2:]
795+ assert_equal(a, [4, 3, 2, 3, 4])
796+
797+ a = np.arange(5)
798+ a[2:] = a[2::-1]
799+ assert_equal(a, [0, 1, 2, 1, 0])
800+
801+ a = np.arange(5)
802+ a[2::-1] = a[:1:-1]
803+ assert_equal(a, [2, 3, 4, 3, 4])
804+
805+ a = np.arange(5)
806+ a[:1:-1] = a[2::-1]
807+ assert_equal(a, [0, 1, 0, 1, 2])
808+
809+
810+class TestCreation:
811+ """
812+ Test the np.array constructor
813+ """
814+ def test_from_attribute(self):
815+ class x:
816+ def __array__(self, dtype=None):
817+ pass
818+
819+ assert_raises(ValueError, np.array, x())
820+
821+ def test_from_string(self):
822+ types = np.typecodes['AllInteger'] + np.typecodes['Float']
823+ nstr = ['123', '123']
824+ result = np.array([123, 123], dtype=int)
825+ for type in types:
826+ msg = 'String conversion for %s' % type
827+ assert_equal(np.array(nstr, dtype=type), result, err_msg=msg)
828+
829+ def test_void(self):
830+ arr = np.array([], dtype='V')
831+ assert_equal(arr.dtype.kind, 'V')
832+
833+ def test_too_big_error(self):
834+ # 45341 is the smallest integer greater than sqrt(2**31 - 1).
835+ # 3037000500 is the smallest integer greater than sqrt(2**63 - 1).
836+ # We want to make sure that the square byte array with those dimensions
837+ # is too big on 32 or 64 bit systems respectively.
838+ if np.iinfo('intp').max == 2**31 - 1:
839+ shape = (46341, 46341)
840+ elif np.iinfo('intp').max == 2**63 - 1:
841+ shape = (3037000500, 3037000500)
842+ else:
843+ return
844+ assert_raises(ValueError, np.empty, shape, dtype=np.int8)
845+ assert_raises(ValueError, np.zeros, shape, dtype=np.int8)
846+ assert_raises(ValueError, np.ones, shape, dtype=np.int8)
847+
848+ @pytest.mark.skipif(np.dtype(np.intp).itemsize != 8,
849+ reason="malloc may not fail on 32 bit systems")
850+ def test_malloc_fails(self):
851+ # This test is guaranteed to fail due to a too large allocation
852+ with assert_raises(np.core._exceptions._ArrayMemoryError):
853+ np.empty(np.iinfo(np.intp).max, dtype=np.uint8)
854+
855+ def test_zeros(self):
856+ types = np.typecodes['AllInteger'] + np.typecodes['AllFloat']
857+ for dt in types:
858+ d = np.zeros((13,), dtype=dt)
859+ assert_equal(np.count_nonzero(d), 0)
860+ # true for ieee floats
861+ assert_equal(d.sum(), 0)
862+ assert_(not d.any())
863+
864+ d = np.zeros(2, dtype='(2,4)i4')
865+ assert_equal(np.count_nonzero(d), 0)
866+ assert_equal(d.sum(), 0)
867+ assert_(not d.any())
868+
869+ d = np.zeros(2, dtype='4i4')
870+ assert_equal(np.count_nonzero(d), 0)
871+ assert_equal(d.sum(), 0)
872+ assert_(not d.any())
873+
874+ d = np.zeros(2, dtype='(2,4)i4, (2,4)i4')
875+ assert_equal(np.count_nonzero(d), 0)
876+
877+ @pytest.mark.slow
878+ def test_zeros_big(self):
879+ # test big array as they might be allocated different by the system
880+ types = np.typecodes['AllInteger'] + np.typecodes['AllFloat']
881+ for dt in types:
882+ d = np.zeros((30 * 1024**2,), dtype=dt)
883+ assert_(not d.any())
884+ # This test can fail on 32-bit systems due to insufficient
885+ # contiguous memory. Deallocating the previous array increases the
886+ # chance of success.
887+ del(d)
888+
889+ def test_zeros_obj(self):
890+ # test initialization from PyLong(0)
891+ d = np.zeros((13,), dtype=object)
892+ assert_array_equal(d, [0] * 13)
893+ assert_equal(np.count_nonzero(d), 0)
894+
895+ def test_zeros_obj_obj(self):
896+ d = np.zeros(10, dtype=[('k', object, 2)])
897+ assert_array_equal(d['k'], 0)
898+
899+ def test_zeros_like_like_zeros(self):
900+ # test zeros_like returns the same as zeros
901+ for c in np.typecodes['All']:
902+ if c == 'V':
903+ continue
904+ d = np.zeros((3,3), dtype=c)
905+ assert_array_equal(np.zeros_like(d), d)
906+ assert_equal(np.zeros_like(d).dtype, d.dtype)
907+ # explicitly check some special cases
908+ d = np.zeros((3,3), dtype='S5')
909+ assert_array_equal(np.zeros_like(d), d)
910+ assert_equal(np.zeros_like(d).dtype, d.dtype)
911+ d = np.zeros((3,3), dtype='U5')
912+ assert_array_equal(np.zeros_like(d), d)
913+ assert_equal(np.zeros_like(d).dtype, d.dtype)
914+
915+ d = np.zeros((3,3), dtype='<i4')
916+ assert_array_equal(np.zeros_like(d), d)
917+ assert_equal(np.zeros_like(d).dtype, d.dtype)
918+ d = np.zeros((3,3), dtype='>i4')
919+ assert_array_equal(np.zeros_like(d), d)
920+ assert_equal(np.zeros_like(d).dtype, d.dtype)
921+
922+ d = np.zeros((3,3), dtype='<M8[s]')
923+ assert_array_equal(np.zeros_like(d), d)
924+ assert_equal(np.zeros_like(d).dtype, d.dtype)
925+ d = np.zeros((3,3), dtype='>M8[s]')
926+ assert_array_equal(np.zeros_like(d), d)
927+ assert_equal(np.zeros_like(d).dtype, d.dtype)
928+
929+ d = np.zeros((3,3), dtype='f4,f4')
930+ assert_array_equal(np.zeros_like(d), d)
931+ assert_equal(np.zeros_like(d).dtype, d.dtype)
932+
933+ def test_empty_unicode(self):
934+ # don't throw decode errors on garbage memory
935+ for i in range(5, 100, 5):
936+ d = np.empty(i, dtype='U')
937+ str(d)
938+
939+ def test_sequence_non_homogenous(self):
940+ assert_equal(np.array([4, 2**80]).dtype, object)
941+ assert_equal(np.array([4, 2**80, 4]).dtype, object)
942+ assert_equal(np.array([2**80, 4]).dtype, object)
943+ assert_equal(np.array([2**80] * 3).dtype, object)
944+ assert_equal(np.array([[1, 1],[1j, 1j]]).dtype, complex)
945+ assert_equal(np.array([[1j, 1j],[1, 1]]).dtype, complex)
946+ assert_equal(np.array([[1, 1, 1],[1, 1j, 1.], [1, 1, 1]]).dtype, complex)
947+
948+ def test_non_sequence_sequence(self):
949+ """Should not segfault.
950+
951+ Class Fail breaks the sequence protocol for new style classes, i.e.,
952+ those derived from object. Class Map is a mapping type indicated by
953+ raising a ValueError. At some point we may raise a warning instead
954+ of an error in the Fail case.
955+
956+ """
957+ class Fail:
958+ def __len__(self):
959+ return 1
960+
961+ def __getitem__(self, index):
962+ raise ValueError()
963+
964+ class Map:
965+ def __len__(self):
966+ return 1
967+
968+ def __getitem__(self, index):
969+ raise KeyError()
970+
971+ a = np.array([Map()])
972+ assert_(a.shape == (1,))
973+ assert_(a.dtype == np.dtype(object))
974+ assert_raises(ValueError, np.array, [Fail()])
975+
976+ def test_no_len_object_type(self):
977+ # gh-5100, want object array from iterable object without len()
978+ class Point2:
979+ def __init__(self):
980+ pass
981+
982+ def __getitem__(self, ind):
983+ if ind in [0, 1]:
984+ return ind
985+ else:
986+ raise IndexError()
987+ d = np.array([Point2(), Point2(), Point2()])
988+ assert_equal(d.dtype, np.dtype(object))
989+
990+ def test_false_len_sequence(self):
991+ # gh-7264, segfault for this example
992+ class C:
993+ def __getitem__(self, i):
994+ raise IndexError
995+ def __len__(self):
996+ return 42
997+
998+ a = np.array(C()) # segfault?
999+ assert_equal(len(a), 0)
1000+
1001+ def test_false_len_iterable(self):
1002+ # Special case where a bad __getitem__ makes us fall back on __iter__:
1003+ class C:
1004+ def __getitem__(self, x):
1005+ raise Exception
1006+ def __iter__(self):
1007+ return iter(())
1008+ def __len__(self):
1009+ return 2
1010+
1011+ a = np.empty(2)
1012+ with assert_raises(ValueError):
1013+ a[:] = C() # Segfault!
1014+
1015+ def test_failed_len_sequence(self):
1016+ # gh-7393
1017+ class A:
1018+ def __init__(self, data):
1019+ self._data = data
1020+ def __getitem__(self, item):
1021+ return type(self)(self._data[item])
1022+ def __len__(self):
1023+ return len(self._data)
1024+
1025+ # len(d) should give 3, but len(d[0]) will fail
1026+ d = A([1,2,3])
1027+ assert_equal(len(np.array(d)), 3)
1028+
1029+ def test_array_too_big(self):
1030+ # Test that array creation succeeds for arrays addressable by intp
1031+ # on the byte level and fails for too large arrays.
1032+ buf = np.zeros(100)
1033+
1034+ max_bytes = np.iinfo(np.intp).max
1035+ for dtype in ["intp", "S20", "b"]:
1036+ dtype = np.dtype(dtype)
1037+ itemsize = dtype.itemsize
1038+
1039+ np.ndarray(buffer=buf, strides=(0,),
1040+ shape=(max_bytes//itemsize,), dtype=dtype)
1041+ assert_raises(ValueError, np.ndarray, buffer=buf, strides=(0,),
1042+ shape=(max_bytes//itemsize + 1,), dtype=dtype)
1043+
1044+ def _ragged_creation(self, seq):
1045+ # without dtype=object, the ragged object should raise
1046+ with assert_warns(np.VisibleDeprecationWarning):
1047+ a = np.array(seq)
1048+ b = np.array(seq, dtype=object)
1049+ assert_equal(a, b)
1050+ return b
1051+
1052+ def test_ragged_ndim_object(self):
1053+ # Lists of mismatching depths are treated as object arrays
1054+ a = self._ragged_creation([[1], 2, 3])
1055+ assert_equal(a.shape, (3,))
1056+ assert_equal(a.dtype, object)
1057+
1058+ a = self._ragged_creation([1, [2], 3])
1059+ assert_equal(a.shape, (3,))
1060+ assert_equal(a.dtype, object)
1061+
1062+ a = self._ragged_creation([1, 2, [3]])
1063+ assert_equal(a.shape, (3,))
1064+ assert_equal(a.dtype, object)
1065+
1066+ def test_ragged_shape_object(self):
1067+ # The ragged dimension of a list is turned into an object array
1068+ a = self._ragged_creation([[1, 1], [2], [3]])
1069+ assert_equal(a.shape, (3,))
1070+ assert_equal(a.dtype, object)
1071+
1072+ a = self._ragged_creation([[1], [2, 2], [3]])
1073+ assert_equal(a.shape, (3,))
1074+ assert_equal(a.dtype, object)
1075+
1076+ a = self._ragged_creation([[1], [2], [3, 3]])
1077+ assert a.shape == (3,)
1078+ assert a.dtype == object
1079+
1080+ def test_array_of_ragged_array(self):
1081+ outer = np.array([None, None])
1082+ outer[0] = outer[1] = np.array([1, 2, 3])
1083+ assert np.array(outer).shape == (2,)
1084+ assert np.array([outer]).shape == (1, 2)
1085+
1086+ outer_ragged = np.array([None, None])
1087+ outer_ragged[0] = np.array([1, 2, 3])
1088+ outer_ragged[1] = np.array([1, 2, 3, 4])
1089+ # should both of these emit deprecation warnings?
1090+ assert np.array(outer_ragged).shape == (2,)
1091+ assert np.array([outer_ragged]).shape == (1, 2,)
1092+
1093+ def test_deep_nonragged_object(self):
1094+ # None of these should raise, even though they are missing dtype=object
1095+ a = np.array([[[Decimal(1)]]])
1096+ a = np.array([1, Decimal(1)])
1097+ a = np.array([[1], [Decimal(1)]])
1098+
1099+class TestStructured:
1100+ def test_subarray_field_access(self):
1101+ a = np.zeros((3, 5), dtype=[('a', ('i4', (2, 2)))])
1102+ a['a'] = np.arange(60).reshape(3, 5, 2, 2)
1103+
1104+ # Since the subarray is always in C-order, a transpose
1105+ # does not swap the subarray:
1106+ assert_array_equal(a.T['a'], a['a'].transpose(1, 0, 2, 3))
1107+
1108+ # In Fortran order, the subarray gets appended
1109+ # like in all other cases, not prepended as a special case
1110+ b = a.copy(order='F')
1111+ assert_equal(a['a'].shape, b['a'].shape)
1112+ assert_equal(a.T['a'].shape, a.T.copy()['a'].shape)
1113+
1114+ def test_subarray_comparison(self):
1115+ # Check that comparisons between record arrays with
1116+ # multi-dimensional field types work properly
1117+ a = np.rec.fromrecords(
1118+ [([1, 2, 3], 'a', [[1, 2], [3, 4]]), ([3, 3, 3], 'b', [[0, 0], [0, 0]])],
1119+ dtype=[('a', ('f4', 3)), ('b', object), ('c', ('i4', (2, 2)))])
1120+ b = a.copy()
1121+ assert_equal(a == b, [True, True])
1122+ assert_equal(a != b, [False, False])
1123+ b[1].b = 'c'
1124+ assert_equal(a == b, [True, False])
1125+ assert_equal(a != b, [False, True])
1126+ for i in range(3):
1127+ b[0].a = a[0].a
1128+ b[0].a[i] = 5
1129+ assert_equal(a == b, [False, False])
1130+ assert_equal(a != b, [True, True])
1131+ for i in range(2):
1132+ for j in range(2):
1133+ b = a.copy()
1134+ b[0].c[i, j] = 10
1135+ assert_equal(a == b, [False, True])
1136+ assert_equal(a != b, [True, False])
1137+
1138+ # Check that broadcasting with a subarray works
1139+ a = np.array([[(0,)], [(1,)]], dtype=[('a', 'f8')])
1140+ b = np.array([(0,), (0,), (1,)], dtype=[('a', 'f8')])
1141+ assert_equal(a == b, [[True, True, False], [False, False, True]])
1142+ assert_equal(b == a, [[True, True, False], [False, False, True]])
1143+ a = np.array([[(0,)], [(1,)]], dtype=[('a', 'f8', (1,))])
1144+ b = np.array([(0,), (0,), (1,)], dtype=[('a', 'f8', (1,))])
1145+ assert_equal(a == b, [[True, True, False], [False, False, True]])
1146+ assert_equal(b == a, [[True, True, False], [False, False, True]])
1147+ a = np.array([[([0, 0],)], [([1, 1],)]], dtype=[('a', 'f8', (2,))])
1148+ b = np.array([([0, 0],), ([0, 1],), ([1, 1],)], dtype=[('a', 'f8', (2,))])
1149+ assert_equal(a == b, [[True, False, False], [False, False, True]])
1150+ assert_equal(b == a, [[True, False, False], [False, False, True]])
1151+
1152+ # Check that broadcasting Fortran-style arrays with a subarray work
1153+ a = np.array([[([0, 0],)], [([1, 1],)]], dtype=[('a', 'f8', (2,))], order='F')
1154+ b = np.array([([0, 0],), ([0, 1],), ([1, 1],)], dtype=[('a', 'f8', (2,))])
1155+ assert_equal(a == b, [[True, False, False], [False, False, True]])
1156+ assert_equal(b == a, [[True, False, False], [False, False, True]])
1157+
1158+ # Check that incompatible sub-array shapes don't result to broadcasting
1159+ x = np.zeros((1,), dtype=[('a', ('f4', (1, 2))), ('b', 'i1')])
1160+ y = np.zeros((1,), dtype=[('a', ('f4', (2,))), ('b', 'i1')])
1161+ # This comparison invokes deprecated behaviour, and will probably
1162+ # start raising an error eventually. What we really care about in this
1163+ # test is just that it doesn't return True.
1164+ with suppress_warnings() as sup:
1165+ sup.filter(FutureWarning, "elementwise == comparison failed")
1166+ assert_equal(x == y, False)
1167+
1168+ x = np.zeros((1,), dtype=[('a', ('f4', (2, 1))), ('b', 'i1')])
1169+ y = np.zeros((1,), dtype=[('a', ('f4', (2,))), ('b', 'i1')])
1170+ # This comparison invokes deprecated behaviour, and will probably
1171+ # start raising an error eventually. What we really care about in this
1172+ # test is just that it doesn't return True.
1173+ with suppress_warnings() as sup:
1174+ sup.filter(FutureWarning, "elementwise == comparison failed")
1175+ assert_equal(x == y, False)
1176+
1177+ # Check that structured arrays that are different only in
1178+ # byte-order work
1179+ a = np.array([(5, 42), (10, 1)], dtype=[('a', '>i8'), ('b', '<f8')])
1180+ b = np.array([(5, 43), (10, 1)], dtype=[('a', '<i8'), ('b', '>f8')])
1181+ assert_equal(a == b, [False, True])
1182+
1183+ def test_casting(self):
1184+ # Check that casting a structured array to change its byte order
1185+ # works
1186+ a = np.array([(1,)], dtype=[('a', '<i4')])
1187+ assert_(np.can_cast(a.dtype, [('a', '>i4')], casting='unsafe'))
1188+ b = a.astype([('a', '>i4')])
1189+ assert_equal(b, a.byteswap().newbyteorder())
1190+ assert_equal(a['a'][0], b['a'][0])
1191+
1192+ # Check that equality comparison works on structured arrays if
1193+ # they are 'equiv'-castable
1194+ a = np.array([(5, 42), (10, 1)], dtype=[('a', '>i4'), ('b', '<f8')])
1195+ b = np.array([(5, 42), (10, 1)], dtype=[('a', '<i4'), ('b', '>f8')])
1196+ assert_(np.can_cast(a.dtype, b.dtype, casting='equiv'))
1197+ assert_equal(a == b, [True, True])
1198+
1199+ # Check that 'equiv' casting can change byte order
1200+ assert_(np.can_cast(a.dtype, b.dtype, casting='equiv'))
1201+ c = a.astype(b.dtype, casting='equiv')
1202+ assert_equal(a == c, [True, True])
1203+
1204+ # Check that 'safe' casting can change byte order and up-cast
1205+ # fields
1206+ t = [('a', '<i8'), ('b', '>f8')]
1207+ assert_(np.can_cast(a.dtype, t, casting='safe'))
1208+ c = a.astype(t, casting='safe')
1209+ assert_equal((c == np.array([(5, 42), (10, 1)], dtype=t)),
1210+ [True, True])
1211+
1212+ # Check that 'same_kind' casting can change byte order and
1213+ # change field widths within a "kind"
1214+ t = [('a', '<i4'), ('b', '>f4')]
1215+ assert_(np.can_cast(a.dtype, t, casting='same_kind'))
1216+ c = a.astype(t, casting='same_kind')
1217+ assert_equal((c == np.array([(5, 42), (10, 1)], dtype=t)),
1218+ [True, True])
1219+
1220+ # Check that casting fails if the casting rule should fail on
1221+ # any of the fields
1222+ t = [('a', '>i8'), ('b', '<f4')]
1223+ assert_(not np.can_cast(a.dtype, t, casting='safe'))
1224+ assert_raises(TypeError, a.astype, t, casting='safe')
1225+ t = [('a', '>i2'), ('b', '<f8')]
1226+ assert_(not np.can_cast(a.dtype, t, casting='equiv'))
1227+ assert_raises(TypeError, a.astype, t, casting='equiv')
1228+ t = [('a', '>i8'), ('b', '<i2')]
1229+ assert_(not np.can_cast(a.dtype, t, casting='same_kind'))
1230+ assert_raises(TypeError, a.astype, t, casting='same_kind')
1231+ assert_(not np.can_cast(a.dtype, b.dtype, casting='no'))
1232+ assert_raises(TypeError, a.astype, b.dtype, casting='no')
1233+
1234+ # Check that non-'unsafe' casting can't change the set of field names
1235+ for casting in ['no', 'safe', 'equiv', 'same_kind']:
1236+ t = [('a', '>i4')]
1237+ assert_(not np.can_cast(a.dtype, t, casting=casting))
1238+ t = [('a', '>i4'), ('b', '<f8'), ('c', 'i4')]
1239+ assert_(not np.can_cast(a.dtype, t, casting=casting))
1240+
1241+ def test_objview(self):
1242+ # https://github.com/numpy/numpy/issues/3286
1243+ a = np.array([], dtype=[('a', 'f'), ('b', 'f'), ('c', 'O')])
1244+ a[['a', 'b']] # TypeError?
1245+
1246+ # https://github.com/numpy/numpy/issues/3253
1247+ dat2 = np.zeros(3, [('A', 'i'), ('B', '|O')])
1248+ dat2[['B', 'A']] # TypeError?
1249+
1250+ def test_setfield(self):
1251+ # https://github.com/numpy/numpy/issues/3126
1252+ struct_dt = np.dtype([('elem', 'i4', 5),])
1253+ dt = np.dtype([('field', 'i4', 10),('struct', struct_dt)])
1254+ x = np.zeros(1, dt)
1255+ x[0]['field'] = np.ones(10, dtype='i4')
1256+ x[0]['struct'] = np.ones(1, dtype=struct_dt)
1257+ assert_equal(x[0]['field'], np.ones(10, dtype='i4'))
1258+
1259+ def test_setfield_object(self):
1260+ # make sure object field assignment with ndarray value
1261+ # on void scalar mimics setitem behavior
1262+ b = np.zeros(1, dtype=[('x', 'O')])
1263+ # next line should work identically to b['x'][0] = np.arange(3)
1264+ b[0]['x'] = np.arange(3)
1265+ assert_equal(b[0]['x'], np.arange(3))
1266+
1267+ # check that broadcasting check still works
1268+ c = np.zeros(1, dtype=[('x', 'O', 5)])
1269+
1270+ def testassign():
1271+ c[0]['x'] = np.arange(3)
1272+
1273+ assert_raises(ValueError, testassign)
1274+
1275+ def test_zero_width_string(self):
1276+ # Test for PR #6430 / issues #473, #4955, #2585
1277+
1278+ dt = np.dtype([('I', int), ('S', 'S0')])
1279+
1280+ x = np.zeros(4, dtype=dt)
1281+
1282+ assert_equal(x['S'], [b'', b'', b'', b''])
1283+ assert_equal(x['S'].itemsize, 0)
1284+
1285+ x['S'] = ['a', 'b', 'c', 'd']
1286+ assert_equal(x['S'], [b'', b'', b'', b''])
1287+ assert_equal(x['I'], [0, 0, 0, 0])
1288+
1289+ # Variation on test case from #4955
1290+ x['S'][x['I'] == 0] = 'hello'
1291+ assert_equal(x['S'], [b'', b'', b'', b''])
1292+ assert_equal(x['I'], [0, 0, 0, 0])
1293+
1294+ # Variation on test case from #2585
1295+ x['S'] = 'A'
1296+ assert_equal(x['S'], [b'', b'', b'', b''])
1297+ assert_equal(x['I'], [0, 0, 0, 0])
1298+
1299+ # Allow zero-width dtypes in ndarray constructor
1300+ y = np.ndarray(4, dtype=x['S'].dtype)
1301+ assert_equal(y.itemsize, 0)
1302+ assert_equal(x['S'], y)
1303+
1304+ # More tests for indexing an array with zero-width fields
1305+ assert_equal(np.zeros(4, dtype=[('a', 'S0,S0'),
1306+ ('b', 'u1')])['a'].itemsize, 0)
1307+ assert_equal(np.empty(3, dtype='S0,S0').itemsize, 0)
1308+ assert_equal(np.zeros(4, dtype='S0,u1')['f0'].itemsize, 0)
1309+
1310+ xx = x['S'].reshape((2, 2))
1311+ assert_equal(xx.itemsize, 0)
1312+ assert_equal(xx, [[b'', b''], [b'', b'']])
1313+ # check for no uninitialized memory due to viewing S0 array
1314+ assert_equal(xx[:].dtype, xx.dtype)
1315+ assert_array_equal(eval(repr(xx), dict(array=np.array)), xx)
1316+
1317+ b = io.BytesIO()
1318+ np.save(b, xx)
1319+
1320+ b.seek(0)
1321+ yy = np.load(b)
1322+ assert_equal(yy.itemsize, 0)
1323+ assert_equal(xx, yy)
1324+
1325+ with temppath(suffix='.npy') as tmp:
1326+ np.save(tmp, xx)
1327+ yy = np.load(tmp)
1328+ assert_equal(yy.itemsize, 0)
1329+ assert_equal(xx, yy)
1330+
1331+ def test_base_attr(self):
1332+ a = np.zeros(3, dtype='i4,f4')
1333+ b = a[0]
1334+ assert_(b.base is a)
1335+
1336+ def test_assignment(self):
1337+ def testassign(arr, v):
1338+ c = arr.copy()
1339+ c[0] = v # assign using setitem
1340+ c[1:] = v # assign using "dtype_transfer" code paths
1341+ return c
1342+
1343+ dt = np.dtype([('foo', 'i8'), ('bar', 'i8')])
1344+ arr = np.ones(2, dt)
1345+ v1 = np.array([(2,3)], dtype=[('foo', 'i8'), ('bar', 'i8')])
1346+ v2 = np.array([(2,3)], dtype=[('bar', 'i8'), ('foo', 'i8')])
1347+ v3 = np.array([(2,3)], dtype=[('bar', 'i8'), ('baz', 'i8')])
1348+ v4 = np.array([(2,)], dtype=[('bar', 'i8')])
1349+ v5 = np.array([(2,3)], dtype=[('foo', 'f8'), ('bar', 'f8')])
1350+ w = arr.view({'names': ['bar'], 'formats': ['i8'], 'offsets': [8]})
1351+
1352+ ans = np.array([(2,3),(2,3)], dtype=dt)
1353+ assert_equal(testassign(arr, v1), ans)
1354+ assert_equal(testassign(arr, v2), ans)
1355+ assert_equal(testassign(arr, v3), ans)
1356+ assert_raises(ValueError, lambda: testassign(arr, v4))
1357+ assert_equal(testassign(arr, v5), ans)
1358+ w[:] = 4
1359+ assert_equal(arr, np.array([(1,4),(1,4)], dtype=dt))
1360+
1361+ # test field-reordering, assignment by position, and self-assignment
1362+ a = np.array([(1,2,3)],
1363+ dtype=[('foo', 'i8'), ('bar', 'i8'), ('baz', 'f4')])
1364+ a[['foo', 'bar']] = a[['bar', 'foo']]
1365+ assert_equal(a[0].item(), (2,1,3))
1366+
1367+ # test that this works even for 'simple_unaligned' structs
1368+ # (ie, that PyArray_EquivTypes cares about field order too)
1369+ a = np.array([(1,2)], dtype=[('a', 'i4'), ('b', 'i4')])
1370+ a[['a', 'b']] = a[['b', 'a']]
1371+ assert_equal(a[0].item(), (2,1))
1372+
1373+ def test_scalar_assignment(self):
1374+ with assert_raises(ValueError):
1375+ arr = np.arange(25).reshape(5, 5)
1376+ arr.itemset(3)
1377+
1378+ def test_structuredscalar_indexing(self):
1379+ # test gh-7262
1380+ x = np.empty(shape=1, dtype="(2)3S,(2)3U")
1381+ assert_equal(x[["f0","f1"]][0], x[0][["f0","f1"]])
1382+ assert_equal(x[0], x[0][()])
1383+
1384+ def test_multiindex_titles(self):
1385+ a = np.zeros(4, dtype=[(('a', 'b'), 'i'), ('c', 'i'), ('d', 'i')])
1386+ assert_raises(KeyError, lambda : a[['a','c']])
1387+ assert_raises(KeyError, lambda : a[['a','a']])
1388+ assert_raises(ValueError, lambda : a[['b','b']]) # field exists, but repeated
1389+ a[['b','c']] # no exception
1390+
1391+
1392+class TestBool:
1393+ def test_test_interning(self):
1394+ a0 = np.bool_(0)
1395+ b0 = np.bool_(False)
1396+ assert_(a0 is b0)
1397+ a1 = np.bool_(1)
1398+ b1 = np.bool_(True)
1399+ assert_(a1 is b1)
1400+ assert_(np.array([True])[0] is a1)
1401+ assert_(np.array(True)[()] is a1)
1402+
1403+ def test_sum(self):
1404+ d = np.ones(101, dtype=bool)
1405+ assert_equal(d.sum(), d.size)
1406+ assert_equal(d[::2].sum(), d[::2].size)
1407+ assert_equal(d[::-2].sum(), d[::-2].size)
1408+
1409+ d = np.frombuffer(b'\xff\xff' * 100, dtype=bool)
1410+ assert_equal(d.sum(), d.size)
1411+ assert_equal(d[::2].sum(), d[::2].size)
1412+ assert_equal(d[::-2].sum(), d[::-2].size)
1413+
1414+ def check_count_nonzero(self, power, length):
1415+ powers = [2 ** i for i in range(length)]
1416+ for i in range(2**power):
1417+ l = [(i & x) != 0 for x in powers]
1418+ a = np.array(l, dtype=bool)
1419+ c = builtins.sum(l)
1420+ assert_equal(np.count_nonzero(a), c)
1421+ av = a.view(np.uint8)
1422+ av *= 3
1423+ assert_equal(np.count_nonzero(a), c)
1424+ av *= 4
1425+ assert_equal(np.count_nonzero(a), c)
1426+ av[av != 0] = 0xFF
1427+ assert_equal(np.count_nonzero(a), c)
1428+
1429+ def test_count_nonzero(self):
1430+ # check all 12 bit combinations in a length 17 array
1431+ # covers most cases of the 16 byte unrolled code
1432+ self.check_count_nonzero(12, 17)
1433+
1434+ @pytest.mark.slow
1435+ def test_count_nonzero_all(self):
1436+ # check all combinations in a length 17 array
1437+ # covers all cases of the 16 byte unrolled code
1438+ self.check_count_nonzero(17, 17)
1439+
1440+ def test_count_nonzero_unaligned(self):
1441+ # prevent mistakes as e.g. gh-4060
1442+ for o in range(7):
1443+ a = np.zeros((18,), dtype=bool)[o+1:]
1444+ a[:o] = True
1445+ assert_equal(np.count_nonzero(a), builtins.sum(a.tolist()))
1446+ a = np.ones((18,), dtype=bool)[o+1:]
1447+ a[:o] = False
1448+ assert_equal(np.count_nonzero(a), builtins.sum(a.tolist()))
1449+
1450+ def _test_cast_from_flexible(self, dtype):
1451+ # empty string -> false
1452+ for n in range(3):
1453+ v = np.array(b'', (dtype, n))
1454+ assert_equal(bool(v), False)
1455+ assert_equal(bool(v[()]), False)
1456+ assert_equal(v.astype(bool), False)
1457+ assert_(isinstance(v.astype(bool), np.ndarray))
1458+ assert_(v[()].astype(bool) is np.False_)
1459+
1460+ # anything else -> true
1461+ for n in range(1, 4):
1462+ for val in [b'a', b'0', b' ']:
1463+ v = np.array(val, (dtype, n))
1464+ assert_equal(bool(v), True)
1465+ assert_equal(bool(v[()]), True)
1466+ assert_equal(v.astype(bool), True)
1467+ assert_(isinstance(v.astype(bool), np.ndarray))
1468+ assert_(v[()].astype(bool) is np.True_)
1469+
1470+ def test_cast_from_void(self):
1471+ self._test_cast_from_flexible(np.void)
1472+
1473+ @pytest.mark.xfail(reason="See gh-9847")
1474+ def test_cast_from_unicode(self):
1475+ self._test_cast_from_flexible(np.unicode_)
1476+
1477+ @pytest.mark.xfail(reason="See gh-9847")
1478+ def test_cast_from_bytes(self):
1479+ self._test_cast_from_flexible(np.bytes_)
1480+
1481+
1482+class TestZeroSizeFlexible:
1483+ @staticmethod
1484+ def _zeros(shape, dtype=str):
1485+ dtype = np.dtype(dtype)
1486+ if dtype == np.void:
1487+ return np.zeros(shape, dtype=(dtype, 0))
1488+
1489+ # not constructable directly
1490+ dtype = np.dtype([('x', dtype, 0)])
1491+ return np.zeros(shape, dtype=dtype)['x']
1492+
1493+ def test_create(self):
1494+ zs = self._zeros(10, bytes)
1495+ assert_equal(zs.itemsize, 0)
1496+ zs = self._zeros(10, np.void)
1497+ assert_equal(zs.itemsize, 0)
1498+ zs = self._zeros(10, str)
1499+ assert_equal(zs.itemsize, 0)
1500+
1501+ def _test_sort_partition(self, name, kinds, **kwargs):
1502+ # Previously, these would all hang
1503+ for dt in [bytes, np.void, str]:
1504+ zs = self._zeros(10, dt)
1505+ sort_method = getattr(zs, name)
1506+ sort_func = getattr(np, name)
1507+ for kind in kinds:
1508+ sort_method(kind=kind, **kwargs)
1509+ sort_func(zs, kind=kind, **kwargs)
1510+
1511+ def test_sort(self):
1512+ self._test_sort_partition('sort', kinds='qhs')
1513+
1514+ def test_argsort(self):
1515+ self._test_sort_partition('argsort', kinds='qhs')
1516+
1517+ def test_partition(self):
1518+ self._test_sort_partition('partition', kinds=['introselect'], kth=2)
1519+
1520+ def test_argpartition(self):
1521+ self._test_sort_partition('argpartition', kinds=['introselect'], kth=2)
1522+
1523+ def test_resize(self):
1524+ # previously an error
1525+ for dt in [bytes, np.void, str]:
1526+ zs = self._zeros(10, dt)
1527+ zs.resize(25)
1528+ zs.resize((10, 10))
1529+
1530+ def test_view(self):
1531+ for dt in [bytes, np.void, str]:
1532+ zs = self._zeros(10, dt)
1533+
1534+ # viewing as itself should be allowed
1535+ assert_equal(zs.view(dt).dtype, np.dtype(dt))
1536+
1537+ # viewing as any non-empty type gives an empty result
1538+ assert_equal(zs.view((dt, 1)).shape, (0,))
1539+
1540+ def test_dumps(self):
1541+ zs = self._zeros(10, int)
1542+ assert_equal(zs, pickle.loads(zs.dumps()))
1543+
1544+ def test_pickle(self):
1545+ for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
1546+ for dt in [bytes, np.void, str]:
1547+ zs = self._zeros(10, dt)
1548+ p = pickle.dumps(zs, protocol=proto)
1549+ zs2 = pickle.loads(p)
1550+
1551+ assert_equal(zs.dtype, zs2.dtype)
1552+
1553+ @pytest.mark.skipif(pickle.HIGHEST_PROTOCOL < 5,
1554+ reason="requires pickle protocol 5")
1555+ def test_pickle_with_buffercallback(self):
1556+ array = np.arange(10)
1557+ buffers = []
1558+ bytes_string = pickle.dumps(array, buffer_callback=buffers.append,
1559+ protocol=5)
1560+ array_from_buffer = pickle.loads(bytes_string, buffers=buffers)
1561+ # when using pickle protocol 5 with buffer callbacks,
1562+ # array_from_buffer is reconstructed from a buffer holding a view
1563+ # to the initial array's data, so modifying an element in array
1564+ # should modify it in array_from_buffer too.
1565+ array[0] = -1
1566+ assert array_from_buffer[0] == -1, array_from_buffer[0]
1567+
1568+
1569+class TestMethods:
1570+
1571+ sort_kinds = ['quicksort', 'heapsort', 'stable']
1572+
1573+ def test_compress(self):
1574+ tgt = [[5, 6, 7, 8, 9]]
1575+ arr = np.arange(10).reshape(2, 5)
1576+ out = arr.compress([0, 1], axis=0)
1577+ assert_equal(out, tgt)
1578+
1579+ tgt = [[1, 3], [6, 8]]
1580+ out = arr.compress([0, 1, 0, 1, 0], axis=1)
1581+ assert_equal(out, tgt)
1582+
1583+ tgt = [[1], [6]]
1584+ arr = np.arange(10).reshape(2, 5)
1585+ out = arr.compress([0, 1], axis=1)
1586+ assert_equal(out, tgt)
1587+
1588+ arr = np.arange(10).reshape(2, 5)
1589+ out = arr.compress([0, 1])
1590+ assert_equal(out, 1)
1591+
1592+ def test_choose(self):
1593+ x = 2*np.ones((3,), dtype=int)
1594+ y = 3*np.ones((3,), dtype=int)
1595+ x2 = 2*np.ones((2, 3), dtype=int)
1596+ y2 = 3*np.ones((2, 3), dtype=int)
1597+ ind = np.array([0, 0, 1])
1598+
1599+ A = ind.choose((x, y))
1600+ assert_equal(A, [2, 2, 3])
1601+
1602+ A = ind.choose((x2, y2))
1603+ assert_equal(A, [[2, 2, 3], [2, 2, 3]])
1604+
1605+ A = ind.choose((x, y2))
1606+ assert_equal(A, [[2, 2, 3], [2, 2, 3]])
1607+
1608+ oned = np.ones(1)
1609+ # gh-12031, caused SEGFAULT
1610+ assert_raises(TypeError, oned.choose,np.void(0), [oned])
1611+
1612+ # gh-6272 check overlap on out
1613+ x = np.arange(5)
1614+ y = np.choose([0,0,0], [x[:3], x[:3], x[:3]], out=x[1:4], mode='wrap')
1615+ assert_equal(y, np.array([0, 1, 2]))
1616+
1617+ def test_prod(self):
1618+ ba = [1, 2, 10, 11, 6, 5, 4]
1619+ ba2 = [[1, 2, 3, 4], [5, 6, 7, 9], [10, 3, 4, 5]]
1620+
1621+ for ctype in [np.int16, np.uint16, np.int32, np.uint32,
1622+ np.float32, np.float64, np.complex64, np.complex128]:
1623+ a = np.array(ba, ctype)
1624+ a2 = np.array(ba2, ctype)
1625+ if ctype in ['1', 'b']:
1626+ assert_raises(ArithmeticError, a.prod)
1627+ assert_raises(ArithmeticError, a2.prod, axis=1)
1628+ else:
1629+ assert_equal(a.prod(axis=0), 26400)
1630+ assert_array_equal(a2.prod(axis=0),
1631+ np.array([50, 36, 84, 180], ctype))
1632+ assert_array_equal(a2.prod(axis=-1),
1633+ np.array([24, 1890, 600], ctype))
1634+
1635+ def test_repeat(self):
1636+ m = np.array([1, 2, 3, 4, 5, 6])
1637+ m_rect = m.reshape((2, 3))
1638+
1639+ A = m.repeat([1, 3, 2, 1, 1, 2])
1640+ assert_equal(A, [1, 2, 2, 2, 3,
1641+ 3, 4, 5, 6, 6])
1642+
1643+ A = m.repeat(2)
1644+ assert_equal(A, [1, 1, 2, 2, 3, 3,
1645+ 4, 4, 5, 5, 6, 6])
1646+
1647+ A = m_rect.repeat([2, 1], axis=0)
1648+ assert_equal(A, [[1, 2, 3],
1649+ [1, 2, 3],
1650+ [4, 5, 6]])
1651+
1652+ A = m_rect.repeat([1, 3, 2], axis=1)
1653+ assert_equal(A, [[1, 2, 2, 2, 3, 3],
1654+ [4, 5, 5, 5, 6, 6]])
1655+
1656+ A = m_rect.repeat(2, axis=0)
1657+ assert_equal(A, [[1, 2, 3],
1658+ [1, 2, 3],
1659+ [4, 5, 6],
1660+ [4, 5, 6]])
1661+
1662+ A = m_rect.repeat(2, axis=1)
1663+ assert_equal(A, [[1, 1, 2, 2, 3, 3],
1664+ [4, 4, 5, 5, 6, 6]])
1665+
1666+ def test_reshape(self):
1667+ arr = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
1668+
1669+ tgt = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
1670+ assert_equal(arr.reshape(2, 6), tgt)
1671+
1672+ tgt = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
1673+ assert_equal(arr.reshape(3, 4), tgt)
1674+
1675+ tgt = [[1, 10, 8, 6], [4, 2, 11, 9], [7, 5, 3, 12]]
1676+ assert_equal(arr.reshape((3, 4), order='F'), tgt)
1677+
1678+ tgt = [[1, 4, 7, 10], [2, 5, 8, 11], [3, 6, 9, 12]]
1679+ assert_equal(arr.T.reshape((3, 4), order='C'), tgt)
1680+
1681+ def test_round(self):
1682+ def check_round(arr, expected, *round_args):
1683+ assert_equal(arr.round(*round_args), expected)
1684+ # With output array
1685+ out = np.zeros_like(arr)
1686+ res = arr.round(*round_args, out=out)
1687+ assert_equal(out, expected)
1688+ assert_equal(out, res)
1689+
1690+ check_round(np.array([1.2, 1.5]), [1, 2])
1691+ check_round(np.array(1.5), 2)
1692+ check_round(np.array([12.2, 15.5]), [10, 20], -1)
1693+ check_round(np.array([12.15, 15.51]), [12.2, 15.5], 1)
1694+ # Complex rounding
1695+ check_round(np.array([4.5 + 1.5j]), [4 + 2j])
1696+ check_round(np.array([12.5 + 15.5j]), [10 + 20j], -1)
1697+
1698+ def test_squeeze(self):
1699+ a = np.array([[[1], [2], [3]]])
1700+ assert_equal(a.squeeze(), [1, 2, 3])
1701+ assert_equal(a.squeeze(axis=(0,)), [[1], [2], [3]])
1702+ assert_raises(ValueError, a.squeeze, axis=(1,))
1703+ assert_equal(a.squeeze(axis=(2,)), [[1, 2, 3]])
1704+
1705+ def test_transpose(self):
1706+ a = np.array([[1, 2], [3, 4]])
1707+ assert_equal(a.transpose(), [[1, 3], [2, 4]])
1708+ assert_raises(ValueError, lambda: a.transpose(0))
1709+ assert_raises(ValueError, lambda: a.transpose(0, 0))
1710+ assert_raises(ValueError, lambda: a.transpose(0, 1, 2))
1711+
1712+ def test_sort(self):
1713+ # test ordering for floats and complex containing nans. It is only
1714+ # necessary to check the less-than comparison, so sorts that
1715+ # only follow the insertion sort path are sufficient. We only
1716+ # test doubles and complex doubles as the logic is the same.
1717+
1718+ # check doubles
1719+ msg = "Test real sort order with nans"
1720+ a = np.array([np.nan, 1, 0])
1721+ b = np.sort(a)
1722+ assert_equal(b, a[::-1], msg)
1723+ # check complex
1724+ msg = "Test complex sort order with nans"
1725+ a = np.zeros(9, dtype=np.complex128)
1726+ a.real += [np.nan, np.nan, np.nan, 1, 0, 1, 1, 0, 0]
1727+ a.imag += [np.nan, 1, 0, np.nan, np.nan, 1, 0, 1, 0]
1728+ b = np.sort(a)
1729+ assert_equal(b, a[::-1], msg)
1730+
1731+ # all c scalar sorts use the same code with different types
1732+ # so it suffices to run a quick check with one type. The number
1733+ # of sorted items must be greater than ~50 to check the actual
1734+ # algorithm because quick and merge sort fall over to insertion
1735+ # sort for small arrays.
1736+
1737+ @pytest.mark.parametrize('dtype', [np.uint8, np.uint16, np.uint32, np.uint64,
1738+ np.float16, np.float32, np.float64,
1739+ np.longdouble])
1740+ def test_sort_unsigned(self, dtype):
1741+ a = np.arange(101, dtype=dtype)
1742+ b = a[::-1].copy()
1743+ for kind in self.sort_kinds:
1744+ msg = "scalar sort, kind=%s" % kind
1745+ c = a.copy()
1746+ c.sort(kind=kind)
1747+ assert_equal(c, a, msg)
1748+ c = b.copy()
1749+ c.sort(kind=kind)
1750+ assert_equal(c, a, msg)
1751+
1752+ @pytest.mark.parametrize('dtype',
1753+ [np.int8, np.int16, np.int32, np.int64, np.float16,
1754+ np.float32, np.float64, np.longdouble])
1755+ def test_sort_signed(self, dtype):
1756+ a = np.arange(-50, 51, dtype=dtype)
1757+ b = a[::-1].copy()
1758+ for kind in self.sort_kinds:
1759+ msg = "scalar sort, kind=%s" % (kind)
1760+ c = a.copy()
1761+ c.sort(kind=kind)
1762+ assert_equal(c, a, msg)
1763+ c = b.copy()
1764+ c.sort(kind=kind)
1765+ assert_equal(c, a, msg)
1766+
1767+ @pytest.mark.parametrize('dtype', [np.float32, np.float64, np.longdouble])
1768+ @pytest.mark.parametrize('part', ['real', 'imag'])
1769+ def test_sort_complex(self, part, dtype):
1770+ # test complex sorts. These use the same code as the scalars
1771+ # but the compare function differs.
1772+ cdtype = {
1773+ np.single: np.csingle,
1774+ np.double: np.cdouble,
1775+ np.longdouble: np.clongdouble,
1776+ }[dtype]
1777+ a = np.arange(-50, 51, dtype=dtype)
1778+ b = a[::-1].copy()
1779+ ai = (a * (1+1j)).astype(cdtype)
1780+ bi = (b * (1+1j)).astype(cdtype)
1781+ setattr(ai, part, 1)
1782+ setattr(bi, part, 1)
1783+ for kind in self.sort_kinds:
1784+ msg = "complex sort, %s part == 1, kind=%s" % (part, kind)
1785+ c = ai.copy()
1786+ c.sort(kind=kind)
1787+ assert_equal(c, ai, msg)
1788+ c = bi.copy()
1789+ c.sort(kind=kind)
1790+ assert_equal(c, ai, msg)
1791+
1792+ def test_sort_complex_byte_swapping(self):
1793+ # test sorting of complex arrays requiring byte-swapping, gh-5441
1794+ for endianness in '<>':
1795+ for dt in np.typecodes['Complex']:
1796+ arr = np.array([1+3.j, 2+2.j, 3+1.j], dtype=endianness + dt)
1797+ c = arr.copy()
1798+ c.sort()
1799+ msg = 'byte-swapped complex sort, dtype={0}'.format(dt)
1800+ assert_equal(c, arr, msg)
1801+
1802+ @pytest.mark.parametrize('dtype', [np.bytes_, np.unicode_])
1803+ def test_sort_string(self, dtype):
1804+ # np.array will perform the encoding to bytes for us in the bytes test
1805+ a = np.array(['aaaaaaaa' + chr(i) for i in range(101)], dtype=dtype)
1806+ b = a[::-1].copy()
1807+ for kind in self.sort_kinds:
1808+ msg = "kind=%s" % kind
1809+ c = a.copy()
1810+ c.sort(kind=kind)
1811+ assert_equal(c, a, msg)
1812+ c = b.copy()
1813+ c.sort(kind=kind)
1814+ assert_equal(c, a, msg)
1815+
1816+ def test_sort_object(self):
1817+ # test object array sorts.
1818+ a = np.empty((101,), dtype=object)
1819+ a[:] = list(range(101))
1820+ b = a[::-1]
1821+ for kind in ['q', 'h', 'm']:
1822+ msg = "kind=%s" % kind
1823+ c = a.copy()
1824+ c.sort(kind=kind)
1825+ assert_equal(c, a, msg)
1826+ c = b.copy()
1827+ c.sort(kind=kind)
1828+ assert_equal(c, a, msg)
1829+
1830+ def test_sort_structured(self):
1831+ # test record array sorts.
1832+ dt = np.dtype([('f', float), ('i', int)])
1833+ a = np.array([(i, i) for i in range(101)], dtype=dt)
1834+ b = a[::-1]
1835+ for kind in ['q', 'h', 'm']:
1836+ msg = "kind=%s" % kind
1837+ c = a.copy()
1838+ c.sort(kind=kind)
1839+ assert_equal(c, a, msg)
1840+ c = b.copy()
1841+ c.sort(kind=kind)
1842+ assert_equal(c, a, msg)
1843+
1844+ @pytest.mark.parametrize('dtype', ['datetime64[D]', 'timedelta64[D]'])
1845+ def test_sort_time(self, dtype):
1846+ # test datetime64 and timedelta64 sorts.
1847+ a = np.arange(0, 101, dtype=dtype)
1848+ b = a[::-1]
1849+ for kind in ['q', 'h', 'm']:
1850+ msg = "kind=%s" % kind
1851+ c = a.copy()
1852+ c.sort(kind=kind)
1853+ assert_equal(c, a, msg)
1854+ c = b.copy()
1855+ c.sort(kind=kind)
1856+ assert_equal(c, a, msg)
1857+
1858+ def test_sort_axis(self):
1859+ # check axis handling. This should be the same for all type
1860+ # specific sorts, so we only check it for one type and one kind
1861+ a = np.array([[3, 2], [1, 0]])
1862+ b = np.array([[1, 0], [3, 2]])
1863+ c = np.array([[2, 3], [0, 1]])
1864+ d = a.copy()
1865+ d.sort(axis=0)
1866+ assert_equal(d, b, "test sort with axis=0")
1867+ d = a.copy()
1868+ d.sort(axis=1)
1869+ assert_equal(d, c, "test sort with axis=1")
1870+ d = a.copy()
1871+ d.sort()
1872+ assert_equal(d, c, "test sort with default axis")
1873+
1874+ def test_sort_size_0(self):
1875+ # check axis handling for multidimensional empty arrays
1876+ a = np.array([])
1877+ a.shape = (3, 2, 1, 0)
1878+ for axis in range(-a.ndim, a.ndim):
1879+ msg = 'test empty array sort with axis={0}'.format(axis)
1880+ assert_equal(np.sort(a, axis=axis), a, msg)
1881+ msg = 'test empty array sort with axis=None'
1882+ assert_equal(np.sort(a, axis=None), a.ravel(), msg)
1883+
1884+ def test_sort_bad_ordering(self):
1885+ # test generic class with bogus ordering,
1886+ # should not segfault.
1887+ class Boom:
1888+ def __lt__(self, other):
1889+ return True
1890+
1891+ a = np.array([Boom()] * 100, dtype=object)
1892+ for kind in self.sort_kinds:
1893+ msg = "kind=%s" % kind
1894+ c = a.copy()
1895+ c.sort(kind=kind)
1896+ assert_equal(c, a, msg)
1897+
1898+ def test_void_sort(self):
1899+ # gh-8210 - previously segfaulted
1900+ for i in range(4):
1901+ rand = np.random.randint(256, size=4000, dtype=np.uint8)
1902+ arr = rand.view('V4')
1903+ arr[::-1].sort()
1904+
1905+ dt = np.dtype([('val', 'i4', (1,))])
1906+ for i in range(4):
1907+ rand = np.random.randint(256, size=4000, dtype=np.uint8)
1908+ arr = rand.view(dt)
1909+ arr[::-1].sort()
1910+
1911+ def test_sort_raises(self):
1912+ #gh-9404
1913+ arr = np.array([0, datetime.now(), 1], dtype=object)
1914+ for kind in self.sort_kinds:
1915+ assert_raises(TypeError, arr.sort, kind=kind)
1916+ #gh-3879
1917+ class Raiser:
1918+ def raises_anything(*args, **kwargs):
1919+ raise TypeError("SOMETHING ERRORED")
1920+ __eq__ = __ne__ = __lt__ = __gt__ = __ge__ = __le__ = raises_anything
1921+ arr = np.array([[Raiser(), n] for n in range(10)]).reshape(-1)
1922+ np.random.shuffle(arr)
1923+ for kind in self.sort_kinds:
1924+ assert_raises(TypeError, arr.sort, kind=kind)
1925+
1926+ def test_sort_degraded(self):
1927+ # test degraded dataset would take minutes to run with normal qsort
1928+ d = np.arange(1000000)
1929+ do = d.copy()
1930+ x = d
1931+ # create a median of 3 killer where each median is the sorted second
1932+ # last element of the quicksort partition
1933+ while x.size > 3:
1934+ mid = x.size // 2
1935+ x[mid], x[-2] = x[-2], x[mid]
1936+ x = x[:-2]
1937+
1938+ assert_equal(np.sort(d), do)
1939+ assert_equal(d[np.argsort(d)], do)
1940+
1941+ def test_copy(self):
1942+ def assert_fortran(arr):
1943+ assert_(arr.flags.fortran)
1944+ assert_(arr.flags.f_contiguous)
1945+ assert_(not arr.flags.c_contiguous)
1946+
1947+ def assert_c(arr):
1948+ assert_(not arr.flags.fortran)
1949+ assert_(not arr.flags.f_contiguous)
1950+ assert_(arr.flags.c_contiguous)
1951+
1952+ a = np.empty((2, 2), order='F')
1953+ # Test copying a Fortran array
1954+ assert_c(a.copy())
1955+ assert_c(a.copy('C'))
1956+ assert_fortran(a.copy('F'))
1957+ assert_fortran(a.copy('A'))
1958+
1959+ # Now test starting with a C array.
1960+ a = np.empty((2, 2), order='C')
1961+ assert_c(a.copy())
1962+ assert_c(a.copy('C'))
1963+ assert_fortran(a.copy('F'))
1964+ assert_c(a.copy('A'))
1965+
1966+ def test_sort_order(self):
1967+ # Test sorting an array with fields
1968+ x1 = np.array([21, 32, 14])
1969+ x2 = np.array(['my', 'first', 'name'])
1970+ x3 = np.array([3.1, 4.5, 6.2])
1971+ r = np.rec.fromarrays([x1, x2, x3], names='id,word,number')
1972+
1973+ r.sort(order=['id'])
1974+ assert_equal(r.id, np.array([14, 21, 32]))
1975+ assert_equal(r.word, np.array(['name', 'my', 'first']))
1976+ assert_equal(r.number, np.array([6.2, 3.1, 4.5]))
1977+
1978+ r.sort(order=['word'])
1979+ assert_equal(r.id, np.array([32, 21, 14]))
1980+ assert_equal(r.word, np.array(['first', 'my', 'name']))
1981+ assert_equal(r.number, np.array([4.5, 3.1, 6.2]))
1982+
1983+ r.sort(order=['number'])
1984+ assert_equal(r.id, np.array([21, 32, 14]))
1985+ assert_equal(r.word, np.array(['my', 'first', 'name']))
1986+ assert_equal(r.number, np.array([3.1, 4.5, 6.2]))
1987+
1988+ assert_raises_regex(ValueError, 'duplicate',
1989+ lambda: r.sort(order=['id', 'id']))
1990+
1991+ if sys.byteorder == 'little':
1992+ strtype = '>i2'
1993+ else:
1994+ strtype = '<i2'
1995+ mydtype = [('name', strchar + '5'), ('col2', strtype)]
1996+ r = np.array([('a', 1), ('b', 255), ('c', 3), ('d', 258)],
1997+ dtype=mydtype)
1998+ r.sort(order='col2')
1999+ assert_equal(r['col2'], [1, 3, 255, 258])
2000+ assert_equal(r, np.array([('a', 1), ('c', 3), ('b', 255), ('d', 258)],
2001+ dtype=mydtype))
2002+
2003+ def test_argsort(self):
2004+ # all c scalar argsorts use the same code with different types
2005+ # so it suffices to run a quick check with one type. The number
2006+ # of sorted items must be greater than ~50 to check the actual
2007+ # algorithm because quick and merge sort fall over to insertion
2008+ # sort for small arrays.
2009+
2010+ for dtype in [np.int32, np.uint32, np.float32]:
2011+ a = np.arange(101, dtype=dtype)
2012+ b = a[::-1].copy()
2013+ for kind in self.sort_kinds:
2014+ msg = "scalar argsort, kind=%s, dtype=%s" % (kind, dtype)
2015+ assert_equal(a.copy().argsort(kind=kind), a, msg)
2016+ assert_equal(b.copy().argsort(kind=kind), b, msg)
2017+
2018+ # test complex argsorts. These use the same code as the scalars
2019+ # but the compare function differs.
2020+ ai = a*1j + 1
2021+ bi = b*1j + 1
2022+ for kind in self.sort_kinds:
2023+ msg = "complex argsort, kind=%s" % kind
2024+ assert_equal(ai.copy().argsort(kind=kind), a, msg)
2025+ assert_equal(bi.copy().argsort(kind=kind), b, msg)
2026+ ai = a + 1j
2027+ bi = b + 1j
2028+ for kind in self.sort_kinds:
2029+ msg = "complex argsort, kind=%s" % kind
2030+ assert_equal(ai.copy().argsort(kind=kind), a, msg)
2031+ assert_equal(bi.copy().argsort(kind=kind), b, msg)
2032+
2033+ # test argsort of complex arrays requiring byte-swapping, gh-5441
2034+ for endianness in '<>':
2035+ for dt in np.typecodes['Complex']:
2036+ arr = np.array([1+3.j, 2+2.j, 3+1.j], dtype=endianness + dt)
2037+ msg = 'byte-swapped complex argsort, dtype={0}'.format(dt)
2038+ assert_equal(arr.argsort(),
2039+ np.arange(len(arr), dtype=np.intp), msg)
2040+
2041+ # test string argsorts.
2042+ s = 'aaaaaaaa'
2043+ a = np.array([s + chr(i) for i in range(101)])
2044+ b = a[::-1].copy()
2045+ r = np.arange(101)
2046+ rr = r[::-1]
2047+ for kind in self.sort_kinds:
2048+ msg = "string argsort, kind=%s" % kind
2049+ assert_equal(a.copy().argsort(kind=kind), r, msg)
2050+ assert_equal(b.copy().argsort(kind=kind), rr, msg)
2051+
2052+ # test unicode argsorts.
2053+ s = 'aaaaaaaa'
2054+ a = np.array([s + chr(i) for i in range(101)], dtype=np.unicode_)
2055+ b = a[::-1]
2056+ r = np.arange(101)
2057+ rr = r[::-1]
2058+ for kind in self.sort_kinds:
2059+ msg = "unicode argsort, kind=%s" % kind
2060+ assert_equal(a.copy().argsort(kind=kind), r, msg)
2061+ assert_equal(b.copy().argsort(kind=kind), rr, msg)
2062+
2063+ # test object array argsorts.
2064+ a = np.empty((101,), dtype=object)
2065+ a[:] = list(range(101))
2066+ b = a[::-1]
2067+ r = np.arange(101)
2068+ rr = r[::-1]
2069+ for kind in self.sort_kinds:
2070+ msg = "object argsort, kind=%s" % kind
2071+ assert_equal(a.copy().argsort(kind=kind), r, msg)
2072+ assert_equal(b.copy().argsort(kind=kind), rr, msg)
2073+
2074+ # test structured array argsorts.
2075+ dt = np.dtype([('f', float), ('i', int)])
2076+ a = np.array([(i, i) for i in range(101)], dtype=dt)
2077+ b = a[::-1]
2078+ r = np.arange(101)
2079+ rr = r[::-1]
2080+ for kind in self.sort_kinds:
2081+ msg = "structured array argsort, kind=%s" % kind
2082+ assert_equal(a.copy().argsort(kind=kind), r, msg)
2083+ assert_equal(b.copy().argsort(kind=kind), rr, msg)
2084+
2085+ # test datetime64 argsorts.
2086+ a = np.arange(0, 101, dtype='datetime64[D]')
2087+ b = a[::-1]
2088+ r = np.arange(101)
2089+ rr = r[::-1]
2090+ for kind in ['q', 'h', 'm']:
2091+ msg = "datetime64 argsort, kind=%s" % kind
2092+ assert_equal(a.copy().argsort(kind=kind), r, msg)
2093+ assert_equal(b.copy().argsort(kind=kind), rr, msg)
2094+
2095+ # test timedelta64 argsorts.
2096+ a = np.arange(0, 101, dtype='timedelta64[D]')
2097+ b = a[::-1]
2098+ r = np.arange(101)
2099+ rr = r[::-1]
2100+ for kind in ['q', 'h', 'm']:
2101+ msg = "timedelta64 argsort, kind=%s" % kind
2102+ assert_equal(a.copy().argsort(kind=kind), r, msg)
2103+ assert_equal(b.copy().argsort(kind=kind), rr, msg)
2104+
2105+ # check axis handling. This should be the same for all type
2106+ # specific argsorts, so we only check it for one type and one kind
2107+ a = np.array([[3, 2], [1, 0]])
2108+ b = np.array([[1, 1], [0, 0]])
2109+ c = np.array([[1, 0], [1, 0]])
2110+ assert_equal(a.copy().argsort(axis=0), b)
2111+ assert_equal(a.copy().argsort(axis=1), c)
2112+ assert_equal(a.copy().argsort(), c)
2113+
2114+ # check axis handling for multidimensional empty arrays
2115+ a = np.array([])
2116+ a.shape = (3, 2, 1, 0)
2117+ for axis in range(-a.ndim, a.ndim):
2118+ msg = 'test empty array argsort with axis={0}'.format(axis)
2119+ assert_equal(np.argsort(a, axis=axis),
2120+ np.zeros_like(a, dtype=np.intp), msg)
2121+ msg = 'test empty array argsort with axis=None'
2122+ assert_equal(np.argsort(a, axis=None),
2123+ np.zeros_like(a.ravel(), dtype=np.intp), msg)
2124+
2125+ # check that stable argsorts are stable
2126+ r = np.arange(100)
2127+ # scalars
2128+ a = np.zeros(100)
2129+ assert_equal(a.argsort(kind='m'), r)
2130+ # complex
2131+ a = np.zeros(100, dtype=complex)
2132+ assert_equal(a.argsort(kind='m'), r)
2133+ # string
2134+ a = np.array(['aaaaaaaaa' for i in range(100)])
2135+ assert_equal(a.argsort(kind='m'), r)
2136+ # unicode
2137+ a = np.array(['aaaaaaaaa' for i in range(100)], dtype=np.unicode_)
2138+ assert_equal(a.argsort(kind='m'), r)
2139+
2140+ def test_sort_unicode_kind(self):
2141+ d = np.arange(10)
2142+ k = b'\xc3\xa4'.decode("UTF8")
2143+ assert_raises(ValueError, d.sort, kind=k)
2144+ assert_raises(ValueError, d.argsort, kind=k)
2145+
2146+ def test_searchsorted(self):
2147+ # test for floats and complex containing nans. The logic is the
2148+ # same for all float types so only test double types for now.
2149+ # The search sorted routines use the compare functions for the
2150+ # array type, so this checks if that is consistent with the sort
2151+ # order.
2152+
2153+ # check double
2154+ a = np.array([0, 1, np.nan])
2155+ msg = "Test real searchsorted with nans, side='l'"
2156+ b = a.searchsorted(a, side='l')
2157+ assert_equal(b, np.arange(3), msg)
2158+ msg = "Test real searchsorted with nans, side='r'"
2159+ b = a.searchsorted(a, side='r')
2160+ assert_equal(b, np.arange(1, 4), msg)
2161+ # check keyword arguments
2162+ a.searchsorted(v=1)
2163+ # check double complex
2164+ a = np.zeros(9, dtype=np.complex128)
2165+ a.real += [0, 0, 1, 1, 0, 1, np.nan, np.nan, np.nan]
2166+ a.imag += [0, 1, 0, 1, np.nan, np.nan, 0, 1, np.nan]
2167+ msg = "Test complex searchsorted with nans, side='l'"
2168+ b = a.searchsorted(a, side='l')
2169+ assert_equal(b, np.arange(9), msg)
2170+ msg = "Test complex searchsorted with nans, side='r'"
2171+ b = a.searchsorted(a, side='r')
2172+ assert_equal(b, np.arange(1, 10), msg)
2173+ msg = "Test searchsorted with little endian, side='l'"
2174+ a = np.array([0, 128], dtype='<i4')
2175+ b = a.searchsorted(np.array(128, dtype='<i4'))
2176+ assert_equal(b, 1, msg)
2177+ msg = "Test searchsorted with big endian, side='l'"
2178+ a = np.array([0, 128], dtype='>i4')
2179+ b = a.searchsorted(np.array(128, dtype='>i4'))
2180+ assert_equal(b, 1, msg)
2181+
2182+ # Check 0 elements
2183+ a = np.ones(0)
2184+ b = a.searchsorted([0, 1, 2], 'l')
2185+ assert_equal(b, [0, 0, 0])
2186+ b = a.searchsorted([0, 1, 2], 'r')
2187+ assert_equal(b, [0, 0, 0])
2188+ a = np.ones(1)
2189+ # Check 1 element
2190+ b = a.searchsorted([0, 1, 2], 'l')
2191+ assert_equal(b, [0, 0, 1])
2192+ b = a.searchsorted([0, 1, 2], 'r')
2193+ assert_equal(b, [0, 1, 1])
2194+ # Check all elements equal
2195+ a = np.ones(2)
2196+ b = a.searchsorted([0, 1, 2], 'l')
2197+ assert_equal(b, [0, 0, 2])
2198+ b = a.searchsorted([0, 1, 2], 'r')
2199+ assert_equal(b, [0, 2, 2])
2200+
2201+ # Test searching unaligned array
2202+ a = np.arange(10)
2203+ aligned = np.empty(a.itemsize * a.size + 1, 'uint8')
2204+ unaligned = aligned[1:].view(a.dtype)
2205+ unaligned[:] = a
2206+ # Test searching unaligned array
2207+ b = unaligned.searchsorted(a, 'l')
2208+ assert_equal(b, a)
2209+ b = unaligned.searchsorted(a, 'r')
2210+ assert_equal(b, a + 1)
2211+ # Test searching for unaligned keys
2212+ b = a.searchsorted(unaligned, 'l')
2213+ assert_equal(b, a)
2214+ b = a.searchsorted(unaligned, 'r')
2215+ assert_equal(b, a + 1)
2216+
2217+ # Test smart resetting of binsearch indices
2218+ a = np.arange(5)
2219+ b = a.searchsorted([6, 5, 4], 'l')
2220+ assert_equal(b, [5, 5, 4])
2221+ b = a.searchsorted([6, 5, 4], 'r')
2222+ assert_equal(b, [5, 5, 5])
2223+
2224+ # Test all type specific binary search functions
2225+ types = ''.join((np.typecodes['AllInteger'], np.typecodes['AllFloat'],
2226+ np.typecodes['Datetime'], '?O'))
2227+ for dt in types:
2228+ if dt == 'M':
2229+ dt = 'M8[D]'
2230+ if dt == '?':
2231+ a = np.arange(2, dtype=dt)
2232+ out = np.arange(2)
2233+ else:
2234+ a = np.arange(0, 5, dtype=dt)
2235+ out = np.arange(5)
2236+ b = a.searchsorted(a, 'l')
2237+ assert_equal(b, out)
2238+ b = a.searchsorted(a, 'r')
2239+ assert_equal(b, out + 1)
2240+ # Test empty array, use a fresh array to get warnings in
2241+ # valgrind if access happens.
2242+ e = np.ndarray(shape=0, buffer=b'', dtype=dt)
2243+ b = e.searchsorted(a, 'l')
2244+ assert_array_equal(b, np.zeros(len(a), dtype=np.intp))
2245+ b = a.searchsorted(e, 'l')
2246+ assert_array_equal(b, np.zeros(0, dtype=np.intp))
2247+
2248+ def test_searchsorted_unicode(self):
2249+ # Test searchsorted on unicode strings.
2250+
2251+ # 1.6.1 contained a string length miscalculation in
2252+ # arraytypes.c.src:UNICODE_compare() which manifested as
2253+ # incorrect/inconsistent results from searchsorted.
2254+ a = np.array(['P:\\20x_dapi_cy3\\20x_dapi_cy3_20100185_1',
2255+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100186_1',
2256+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100187_1',
2257+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100189_1',
2258+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100190_1',
2259+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100191_1',
2260+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100192_1',
2261+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100193_1',
2262+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100194_1',
2263+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100195_1',
2264+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100196_1',
2265+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100197_1',
2266+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100198_1',
2267+ 'P:\\20x_dapi_cy3\\20x_dapi_cy3_20100199_1'],
2268+ dtype=np.unicode_)
2269+ ind = np.arange(len(a))
2270+ assert_equal([a.searchsorted(v, 'left') for v in a], ind)
2271+ assert_equal([a.searchsorted(v, 'right') for v in a], ind + 1)
2272+ assert_equal([a.searchsorted(a[i], 'left') for i in ind], ind)
2273+ assert_equal([a.searchsorted(a[i], 'right') for i in ind], ind + 1)
2274+
2275+ def test_searchsorted_with_invalid_sorter(self):
2276+ a = np.array([5, 2, 1, 3, 4])
2277+ s = np.argsort(a)
2278+ assert_raises(TypeError, np.searchsorted, a, 0,
2279+ sorter=np.array((1, (2, 3)), dtype=object))
2280+ assert_raises(TypeError, np.searchsorted, a, 0, sorter=[1.1])
2281+ assert_raises(ValueError, np.searchsorted, a, 0, sorter=[1, 2, 3, 4])
2282+ assert_raises(ValueError, np.searchsorted, a, 0, sorter=[1, 2, 3, 4, 5, 6])
2283+
2284+ # bounds check
2285+ assert_raises(ValueError, np.searchsorted, a, 4, sorter=[0, 1, 2, 3, 5])
2286+ assert_raises(ValueError, np.searchsorted, a, 0, sorter=[-1, 0, 1, 2, 3])
2287+ assert_raises(ValueError, np.searchsorted, a, 0, sorter=[4, 0, -1, 2, 3])
2288+
2289+ def test_searchsorted_with_sorter(self):
2290+ a = np.random.rand(300)
2291+ s = a.argsort()
2292+ b = np.sort(a)
2293+ k = np.linspace(0, 1, 20)
2294+ assert_equal(b.searchsorted(k), a.searchsorted(k, sorter=s))
2295+
2296+ a = np.array([0, 1, 2, 3, 5]*20)
2297+ s = a.argsort()
2298+ k = [0, 1, 2, 3, 5]
2299+ expected = [0, 20, 40, 60, 80]
2300+ assert_equal(a.searchsorted(k, side='l', sorter=s), expected)
2301+ expected = [20, 40, 60, 80, 100]
2302+ assert_equal(a.searchsorted(k, side='r', sorter=s), expected)
2303+
2304+ # Test searching unaligned array
2305+ keys = np.arange(10)
2306+ a = keys.copy()
2307+ np.random.shuffle(s)
2308+ s = a.argsort()
2309+ aligned = np.empty(a.itemsize * a.size + 1, 'uint8')
2310+ unaligned = aligned[1:].view(a.dtype)
2311+ # Test searching unaligned array
2312+ unaligned[:] = a
2313+ b = unaligned.searchsorted(keys, 'l', s)
2314+ assert_equal(b, keys)
2315+ b = unaligned.searchsorted(keys, 'r', s)
2316+ assert_equal(b, keys + 1)
2317+ # Test searching for unaligned keys
2318+ unaligned[:] = keys
2319+ b = a.searchsorted(unaligned, 'l', s)
2320+ assert_equal(b, keys)
2321+ b = a.searchsorted(unaligned, 'r', s)
2322+ assert_equal(b, keys + 1)
2323+
2324+ # Test all type specific indirect binary search functions
2325+ types = ''.join((np.typecodes['AllInteger'], np.typecodes['AllFloat'],
2326+ np.typecodes['Datetime'], '?O'))
2327+ for dt in types:
2328+ if dt == 'M':
2329+ dt = 'M8[D]'
2330+ if dt == '?':
2331+ a = np.array([1, 0], dtype=dt)
2332+ # We want the sorter array to be of a type that is different
2333+ # from np.intp in all platforms, to check for #4698
2334+ s = np.array([1, 0], dtype=np.int16)
2335+ out = np.array([1, 0])
2336+ else:
2337+ a = np.array([3, 4, 1, 2, 0], dtype=dt)
2338+ # We want the sorter array to be of a type that is different
2339+ # from np.intp in all platforms, to check for #4698
2340+ s = np.array([4, 2, 3, 0, 1], dtype=np.int16)
2341+ out = np.array([3, 4, 1, 2, 0], dtype=np.intp)
2342+ b = a.searchsorted(a, 'l', s)
2343+ assert_equal(b, out)
2344+ b = a.searchsorted(a, 'r', s)
2345+ assert_equal(b, out + 1)
2346+ # Test empty array, use a fresh array to get warnings in
2347+ # valgrind if access happens.
2348+ e = np.ndarray(shape=0, buffer=b'', dtype=dt)
2349+ b = e.searchsorted(a, 'l', s[:0])
2350+ assert_array_equal(b, np.zeros(len(a), dtype=np.intp))
2351+ b = a.searchsorted(e, 'l', s)
2352+ assert_array_equal(b, np.zeros(0, dtype=np.intp))
2353+
2354+ # Test non-contiguous sorter array
2355+ a = np.array([3, 4, 1, 2, 0])
2356+ srt = np.empty((10,), dtype=np.intp)
2357+ srt[1::2] = -1
2358+ srt[::2] = [4, 2, 3, 0, 1]
2359+ s = srt[::2]
2360+ out = np.array([3, 4, 1, 2, 0], dtype=np.intp)
2361+ b = a.searchsorted(a, 'l', s)
2362+ assert_equal(b, out)
2363+ b = a.searchsorted(a, 'r', s)
2364+ assert_equal(b, out + 1)
2365+
2366+ def test_searchsorted_return_type(self):
2367+ # Functions returning indices should always return base ndarrays
2368+ class A(np.ndarray):
2369+ pass
2370+ a = np.arange(5).view(A)
2371+ b = np.arange(1, 3).view(A)
2372+ s = np.arange(5).view(A)
2373+ assert_(not isinstance(a.searchsorted(b, 'l'), A))
2374+ assert_(not isinstance(a.searchsorted(b, 'r'), A))
2375+ assert_(not isinstance(a.searchsorted(b, 'l', s), A))
2376+ assert_(not isinstance(a.searchsorted(b, 'r', s), A))
2377+
2378+ def test_argpartition_out_of_range(self):
2379+ # Test out of range values in kth raise an error, gh-5469
2380+ d = np.arange(10)
2381+ assert_raises(ValueError, d.argpartition, 10)
2382+ assert_raises(ValueError, d.argpartition, -11)
2383+ # Test also for generic type argpartition, which uses sorting
2384+ # and used to not bound check kth
2385+ d_obj = np.arange(10, dtype=object)
2386+ assert_raises(ValueError, d_obj.argpartition, 10)
2387+ assert_raises(ValueError, d_obj.argpartition, -11)
2388+
2389+ def test_partition_out_of_range(self):
2390+ # Test out of range values in kth raise an error, gh-5469
2391+ d = np.arange(10)
2392+ assert_raises(ValueError, d.partition, 10)
2393+ assert_raises(ValueError, d.partition, -11)
2394+ # Test also for generic type partition, which uses sorting
2395+ # and used to not bound check kth
2396+ d_obj = np.arange(10, dtype=object)
2397+ assert_raises(ValueError, d_obj.partition, 10)
2398+ assert_raises(ValueError, d_obj.partition, -11)
2399+
2400+ def test_argpartition_integer(self):
2401+ # Test non-integer values in kth raise an error/
2402+ d = np.arange(10)
2403+ assert_raises(TypeError, d.argpartition, 9.)
2404+ # Test also for generic type argpartition, which uses sorting
2405+ # and used to not bound check kth
2406+ d_obj = np.arange(10, dtype=object)
2407+ assert_raises(TypeError, d_obj.argpartition, 9.)
2408+
2409+ def test_partition_integer(self):
2410+ # Test out of range values in kth raise an error, gh-5469
2411+ d = np.arange(10)
2412+ assert_raises(TypeError, d.partition, 9.)
2413+ # Test also for generic type partition, which uses sorting
2414+ # and used to not bound check kth
2415+ d_obj = np.arange(10, dtype=object)
2416+ assert_raises(TypeError, d_obj.partition, 9.)
2417+
2418+ def test_partition_empty_array(self):
2419+ # check axis handling for multidimensional empty arrays
2420+ a = np.array([])
2421+ a.shape = (3, 2, 1, 0)
2422+ for axis in range(-a.ndim, a.ndim):
2423+ msg = 'test empty array partition with axis={0}'.format(axis)
2424+ assert_equal(np.partition(a, 0, axis=axis), a, msg)
2425+ msg = 'test empty array partition with axis=None'
2426+ assert_equal(np.partition(a, 0, axis=None), a.ravel(), msg)
2427+
2428+ def test_argpartition_empty_array(self):
2429+ # check axis handling for multidimensional empty arrays
2430+ a = np.array([])
2431+ a.shape = (3, 2, 1, 0)
2432+ for axis in range(-a.ndim, a.ndim):
2433+ msg = 'test empty array argpartition with axis={0}'.format(axis)
2434+ assert_equal(np.partition(a, 0, axis=axis),
2435+ np.zeros_like(a, dtype=np.intp), msg)
2436+ msg = 'test empty array argpartition with axis=None'
2437+ assert_equal(np.partition(a, 0, axis=None),
2438+ np.zeros_like(a.ravel(), dtype=np.intp), msg)
2439+
2440+ def test_partition(self):
2441+ d = np.arange(10)
2442+ assert_raises(TypeError, np.partition, d, 2, kind=1)
2443+ assert_raises(ValueError, np.partition, d, 2, kind="nonsense")
2444+ assert_raises(ValueError, np.argpartition, d, 2, kind="nonsense")
2445+ assert_raises(ValueError, d.partition, 2, axis=0, kind="nonsense")
2446+ assert_raises(ValueError, d.argpartition, 2, axis=0, kind="nonsense")
2447+ for k in ("introselect",):
2448+ d = np.array([])
2449+ assert_array_equal(np.partition(d, 0, kind=k), d)
2450+ assert_array_equal(np.argpartition(d, 0, kind=k), d)
2451+ d = np.ones(1)
2452+ assert_array_equal(np.partition(d, 0, kind=k)[0], d)
2453+ assert_array_equal(d[np.argpartition(d, 0, kind=k)],
2454+ np.partition(d, 0, kind=k))
2455+
2456+ # kth not modified
2457+ kth = np.array([30, 15, 5])
2458+ okth = kth.copy()
2459+ np.partition(np.arange(40), kth)
2460+ assert_array_equal(kth, okth)
2461+
2462+ for r in ([2, 1], [1, 2], [1, 1]):
2463+ d = np.array(r)
2464+ tgt = np.sort(d)
2465+ assert_array_equal(np.partition(d, 0, kind=k)[0], tgt[0])
2466+ assert_array_equal(np.partition(d, 1, kind=k)[1], tgt[1])
2467+ assert_array_equal(d[np.argpartition(d, 0, kind=k)],
2468+ np.partition(d, 0, kind=k))
2469+ assert_array_equal(d[np.argpartition(d, 1, kind=k)],
2470+ np.partition(d, 1, kind=k))
2471+ for i in range(d.size):
2472+ d[i:].partition(0, kind=k)
2473+ assert_array_equal(d, tgt)
2474+
2475+ for r in ([3, 2, 1], [1, 2, 3], [2, 1, 3], [2, 3, 1],
2476+ [1, 1, 1], [1, 2, 2], [2, 2, 1], [1, 2, 1]):
2477+ d = np.array(r)
2478+ tgt = np.sort(d)
2479+ assert_array_equal(np.partition(d, 0, kind=k)[0], tgt[0])
2480+ assert_array_equal(np.partition(d, 1, kind=k)[1], tgt[1])
2481+ assert_array_equal(np.partition(d, 2, kind=k)[2], tgt[2])
2482+ assert_array_equal(d[np.argpartition(d, 0, kind=k)],
2483+ np.partition(d, 0, kind=k))
2484+ assert_array_equal(d[np.argpartition(d, 1, kind=k)],
2485+ np.partition(d, 1, kind=k))
2486+ assert_array_equal(d[np.argpartition(d, 2, kind=k)],
2487+ np.partition(d, 2, kind=k))
2488+ for i in range(d.size):
2489+ d[i:].partition(0, kind=k)
2490+ assert_array_equal(d, tgt)
2491+
2492+ d = np.ones(50)
2493+ assert_array_equal(np.partition(d, 0, kind=k), d)
2494+ assert_array_equal(d[np.argpartition(d, 0, kind=k)],
2495+ np.partition(d, 0, kind=k))
2496+
2497+ # sorted
2498+ d = np.arange(49)
2499+ assert_equal(np.partition(d, 5, kind=k)[5], 5)
2500+ assert_equal(np.partition(d, 15, kind=k)[15], 15)
2501+ assert_array_equal(d[np.argpartition(d, 5, kind=k)],
2502+ np.partition(d, 5, kind=k))
2503+ assert_array_equal(d[np.argpartition(d, 15, kind=k)],
2504+ np.partition(d, 15, kind=k))
2505+
2506+ # rsorted
2507+ d = np.arange(47)[::-1]
2508+ assert_equal(np.partition(d, 6, kind=k)[6], 6)
2509+ assert_equal(np.partition(d, 16, kind=k)[16], 16)
2510+ assert_array_equal(d[np.argpartition(d, 6, kind=k)],
2511+ np.partition(d, 6, kind=k))
2512+ assert_array_equal(d[np.argpartition(d, 16, kind=k)],
2513+ np.partition(d, 16, kind=k))
2514+
2515+ assert_array_equal(np.partition(d, -6, kind=k),
2516+ np.partition(d, 41, kind=k))
2517+ assert_array_equal(np.partition(d, -16, kind=k),
2518+ np.partition(d, 31, kind=k))
2519+ assert_array_equal(d[np.argpartition(d, -6, kind=k)],
2520+ np.partition(d, 41, kind=k))
2521+
2522+ # median of 3 killer, O(n^2) on pure median 3 pivot quickselect
2523+ # exercises the median of median of 5 code used to keep O(n)
2524+ d = np.arange(1000000)
2525+ x = np.roll(d, d.size // 2)
2526+ mid = x.size // 2 + 1
2527+ assert_equal(np.partition(x, mid)[mid], mid)
2528+ d = np.arange(1000001)
2529+ x = np.roll(d, d.size // 2 + 1)
2530+ mid = x.size // 2 + 1
2531+ assert_equal(np.partition(x, mid)[mid], mid)
2532+
2533+ # max
2534+ d = np.ones(10)
2535+ d[1] = 4
2536+ assert_equal(np.partition(d, (2, -1))[-1], 4)
2537+ assert_equal(np.partition(d, (2, -1))[2], 1)
2538+ assert_equal(d[np.argpartition(d, (2, -1))][-1], 4)
2539+ assert_equal(d[np.argpartition(d, (2, -1))][2], 1)
2540+ d[1] = np.nan
2541+ assert_(np.isnan(d[np.argpartition(d, (2, -1))][-1]))
2542+ assert_(np.isnan(np.partition(d, (2, -1))[-1]))
2543+
2544+ # equal elements
2545+ d = np.arange(47) % 7
2546+ tgt = np.sort(np.arange(47) % 7)
2547+ np.random.shuffle(d)
2548+ for i in range(d.size):
2549+ assert_equal(np.partition(d, i, kind=k)[i], tgt[i])
2550+ assert_array_equal(d[np.argpartition(d, 6, kind=k)],
2551+ np.partition(d, 6, kind=k))
2552+ assert_array_equal(d[np.argpartition(d, 16, kind=k)],
2553+ np.partition(d, 16, kind=k))
2554+ for i in range(d.size):
2555+ d[i:].partition(0, kind=k)
2556+ assert_array_equal(d, tgt)
2557+
2558+ d = np.array([0, 1, 2, 3, 4, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
2559+ 7, 7, 7, 7, 7, 9])
2560+ kth = [0, 3, 19, 20]
2561+ assert_equal(np.partition(d, kth, kind=k)[kth], (0, 3, 7, 7))
2562+ assert_equal(d[np.argpartition(d, kth, kind=k)][kth], (0, 3, 7, 7))
2563+
2564+ d = np.array([2, 1])
2565+ d.partition(0, kind=k)
2566+ assert_raises(ValueError, d.partition, 2)
2567+ assert_raises(np.AxisError, d.partition, 3, axis=1)
2568+ assert_raises(ValueError, np.partition, d, 2)
2569+ assert_raises(np.AxisError, np.partition, d, 2, axis=1)
2570+ assert_raises(ValueError, d.argpartition, 2)
2571+ assert_raises(np.AxisError, d.argpartition, 3, axis=1)
2572+ assert_raises(ValueError, np.argpartition, d, 2)
2573+ assert_raises(np.AxisError, np.argpartition, d, 2, axis=1)
2574+ d = np.arange(10).reshape((2, 5))
2575+ d.partition(1, axis=0, kind=k)
2576+ d.partition(4, axis=1, kind=k)
2577+ np.partition(d, 1, axis=0, kind=k)
2578+ np.partition(d, 4, axis=1, kind=k)
2579+ np.partition(d, 1, axis=None, kind=k)
2580+ np.partition(d, 9, axis=None, kind=k)
2581+ d.argpartition(1, axis=0, kind=k)
2582+ d.argpartition(4, axis=1, kind=k)
2583+ np.argpartition(d, 1, axis=0, kind=k)
2584+ np.argpartition(d, 4, axis=1, kind=k)
2585+ np.argpartition(d, 1, axis=None, kind=k)
2586+ np.argpartition(d, 9, axis=None, kind=k)
2587+ assert_raises(ValueError, d.partition, 2, axis=0)
2588+ assert_raises(ValueError, d.partition, 11, axis=1)
2589+ assert_raises(TypeError, d.partition, 2, axis=None)
2590+ assert_raises(ValueError, np.partition, d, 9, axis=1)
2591+ assert_raises(ValueError, np.partition, d, 11, axis=None)
2592+ assert_raises(ValueError, d.argpartition, 2, axis=0)
2593+ assert_raises(ValueError, d.argpartition, 11, axis=1)
2594+ assert_raises(ValueError, np.argpartition, d, 9, axis=1)
2595+ assert_raises(ValueError, np.argpartition, d, 11, axis=None)
2596+
2597+ td = [(dt, s) for dt in [np.int32, np.float32, np.complex64]
2598+ for s in (9, 16)]
2599+ for dt, s in td:
2600+ aae = assert_array_equal
2601+ at = assert_
2602+
2603+ d = np.arange(s, dtype=dt)
2604+ np.random.shuffle(d)
2605+ d1 = np.tile(np.arange(s, dtype=dt), (4, 1))
2606+ map(np.random.shuffle, d1)
2607+ d0 = np.transpose(d1)
2608+ for i in range(d.size):
2609+ p = np.partition(d, i, kind=k)
2610+ assert_equal(p[i], i)
2611+ # all before are smaller
2612+ assert_array_less(p[:i], p[i])
2613+ # all after are larger
2614+ assert_array_less(p[i], p[i + 1:])
2615+ aae(p, d[np.argpartition(d, i, kind=k)])
2616+
2617+ p = np.partition(d1, i, axis=1, kind=k)
2618+ aae(p[:, i], np.array([i] * d1.shape[0], dtype=dt))
2619+ # array_less does not seem to work right
2620+ at((p[:, :i].T <= p[:, i]).all(),
2621+ msg="%d: %r <= %r" % (i, p[:, i], p[:, :i].T))
2622+ at((p[:, i + 1:].T > p[:, i]).all(),
2623+ msg="%d: %r < %r" % (i, p[:, i], p[:, i + 1:].T))
2624+ aae(p, d1[np.arange(d1.shape[0])[:, None],
2625+ np.argpartition(d1, i, axis=1, kind=k)])
2626+
2627+ p = np.partition(d0, i, axis=0, kind=k)
2628+ aae(p[i, :], np.array([i] * d1.shape[0], dtype=dt))
2629+ # array_less does not seem to work right
2630+ at((p[:i, :] <= p[i, :]).all(),
2631+ msg="%d: %r <= %r" % (i, p[i, :], p[:i, :]))
2632+ at((p[i + 1:, :] > p[i, :]).all(),
2633+ msg="%d: %r < %r" % (i, p[i, :], p[:, i + 1:]))
2634+ aae(p, d0[np.argpartition(d0, i, axis=0, kind=k),
2635+ np.arange(d0.shape[1])[None, :]])
2636+
2637+ # check inplace
2638+ dc = d.copy()
2639+ dc.partition(i, kind=k)
2640+ assert_equal(dc, np.partition(d, i, kind=k))
2641+ dc = d0.copy()
2642+ dc.partition(i, axis=0, kind=k)
2643+ assert_equal(dc, np.partition(d0, i, axis=0, kind=k))
2644+ dc = d1.copy()
2645+ dc.partition(i, axis=1, kind=k)
2646+ assert_equal(dc, np.partition(d1, i, axis=1, kind=k))
2647+
2648+ def assert_partitioned(self, d, kth):
2649+ prev = 0
2650+ for k in np.sort(kth):
2651+ assert_array_less(d[prev:k], d[k], err_msg='kth %d' % k)
2652+ assert_((d[k:] >= d[k]).all(),
2653+ msg="kth %d, %r not greater equal %d" % (k, d[k:], d[k]))
2654+ prev = k + 1
2655+
2656+ def test_partition_iterative(self):
2657+ d = np.arange(17)
2658+ kth = (0, 1, 2, 429, 231)
2659+ assert_raises(ValueError, d.partition, kth)
2660+ assert_raises(ValueError, d.argpartition, kth)
2661+ d = np.arange(10).reshape((2, 5))
2662+ assert_raises(ValueError, d.partition, kth, axis=0)
2663+ assert_raises(ValueError, d.partition, kth, axis=1)
2664+ assert_raises(ValueError, np.partition, d, kth, axis=1)
2665+ assert_raises(ValueError, np.partition, d, kth, axis=None)
2666+
2667+ d = np.array([3, 4, 2, 1])
2668+ p = np.partition(d, (0, 3))
2669+ self.assert_partitioned(p, (0, 3))
2670+ self.assert_partitioned(d[np.argpartition(d, (0, 3))], (0, 3))
2671+
2672+ assert_array_equal(p, np.partition(d, (-3, -1)))
2673+ assert_array_equal(p, d[np.argpartition(d, (-3, -1))])
2674+
2675+ d = np.arange(17)
2676+ np.random.shuffle(d)
2677+ d.partition(range(d.size))
2678+ assert_array_equal(np.arange(17), d)
2679+ np.random.shuffle(d)
2680+ assert_array_equal(np.arange(17), d[d.argpartition(range(d.size))])
2681+
2682+ # test unsorted kth
2683+ d = np.arange(17)
2684+ np.random.shuffle(d)
2685+ keys = np.array([1, 3, 8, -2])
2686+ np.random.shuffle(d)
2687+ p = np.partition(d, keys)
2688+ self.assert_partitioned(p, keys)
2689+ p = d[np.argpartition(d, keys)]
2690+ self.assert_partitioned(p, keys)
2691+ np.random.shuffle(keys)
2692+ assert_array_equal(np.partition(d, keys), p)
2693+ assert_array_equal(d[np.argpartition(d, keys)], p)
2694+
2695+ # equal kth
2696+ d = np.arange(20)[::-1]
2697+ self.assert_partitioned(np.partition(d, [5]*4), [5])
2698+ self.assert_partitioned(np.partition(d, [5]*4 + [6, 13]),
2699+ [5]*4 + [6, 13])
2700+ self.assert_partitioned(d[np.argpartition(d, [5]*4)], [5])
2701+ self.assert_partitioned(d[np.argpartition(d, [5]*4 + [6, 13])],
2702+ [5]*4 + [6, 13])
2703+
2704+ d = np.arange(12)
2705+ np.random.shuffle(d)
2706+ d1 = np.tile(np.arange(12), (4, 1))
2707+ map(np.random.shuffle, d1)
2708+ d0 = np.transpose(d1)
2709+
2710+ kth = (1, 6, 7, -1)
2711+ p = np.partition(d1, kth, axis=1)
2712+ pa = d1[np.arange(d1.shape[0])[:, None],
2713+ d1.argpartition(kth, axis=1)]
2714+ assert_array_equal(p, pa)
2715+ for i in range(d1.shape[0]):
2716+ self.assert_partitioned(p[i,:], kth)
2717+ p = np.partition(d0, kth, axis=0)
2718+ pa = d0[np.argpartition(d0, kth, axis=0),
2719+ np.arange(d0.shape[1])[None,:]]
2720+ assert_array_equal(p, pa)
2721+ for i in range(d0.shape[1]):
2722+ self.assert_partitioned(p[:, i], kth)
2723+
2724+ def test_partition_cdtype(self):
2725+ d = np.array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41),
2726+ ('Lancelot', 1.9, 38)],
2727+ dtype=[('name', '|S10'), ('height', '<f8'), ('age', '<i4')])
2728+
2729+ tgt = np.sort(d, order=['age', 'height'])
2730+ assert_array_equal(np.partition(d, range(d.size),
2731+ order=['age', 'height']),
2732+ tgt)
2733+ assert_array_equal(d[np.argpartition(d, range(d.size),
2734+ order=['age', 'height'])],
2735+ tgt)
2736+ for k in range(d.size):
2737+ assert_equal(np.partition(d, k, order=['age', 'height'])[k],
2738+ tgt[k])
2739+ assert_equal(d[np.argpartition(d, k, order=['age', 'height'])][k],
2740+ tgt[k])
2741+
2742+ d = np.array(['Galahad', 'Arthur', 'zebra', 'Lancelot'])
2743+ tgt = np.sort(d)
2744+ assert_array_equal(np.partition(d, range(d.size)), tgt)
2745+ for k in range(d.size):
2746+ assert_equal(np.partition(d, k)[k], tgt[k])
2747+ assert_equal(d[np.argpartition(d, k)][k], tgt[k])
2748+
2749+ def test_partition_unicode_kind(self):
2750+ d = np.arange(10)
2751+ k = b'\xc3\xa4'.decode("UTF8")
2752+ assert_raises(ValueError, d.partition, 2, kind=k)
2753+ assert_raises(ValueError, d.argpartition, 2, kind=k)
2754+
2755+ def test_partition_fuzz(self):
2756+ # a few rounds of random data testing
2757+ for j in range(10, 30):
2758+ for i in range(1, j - 2):
2759+ d = np.arange(j)
2760+ np.random.shuffle(d)
2761+ d = d % np.random.randint(2, 30)
2762+ idx = np.random.randint(d.size)
2763+ kth = [0, idx, i, i + 1]
2764+ tgt = np.sort(d)[kth]
2765+ assert_array_equal(np.partition(d, kth)[kth], tgt,
2766+ err_msg="data: %r\n kth: %r" % (d, kth))
2767+
2768+ def test_argpartition_gh5524(self):
2769+ # A test for functionality of argpartition on lists.
2770+ d = [6,7,3,2,9,0]
2771+ p = np.argpartition(d,1)
2772+ self.assert_partitioned(np.array(d)[p],[1])
2773+
2774+ def test_flatten(self):
2775+ x0 = np.array([[1, 2, 3], [4, 5, 6]], np.int32)
2776+ x1 = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], np.int32)
2777+ y0 = np.array([1, 2, 3, 4, 5, 6], np.int32)
2778+ y0f = np.array([1, 4, 2, 5, 3, 6], np.int32)
2779+ y1 = np.array([1, 2, 3, 4, 5, 6, 7, 8], np.int32)
2780+ y1f = np.array([1, 5, 3, 7, 2, 6, 4, 8], np.int32)
2781+ assert_equal(x0.flatten(), y0)
2782+ assert_equal(x0.flatten('F'), y0f)
2783+ assert_equal(x0.flatten('F'), x0.T.flatten())
2784+ assert_equal(x1.flatten(), y1)
2785+ assert_equal(x1.flatten('F'), y1f)
2786+ assert_equal(x1.flatten('F'), x1.T.flatten())
2787+
2788+
2789+ @pytest.mark.parametrize('func', (np.dot, np.matmul))
2790+ def test_arr_mult(self, func):
2791+ a = np.array([[1, 0], [0, 1]])
2792+ b = np.array([[0, 1], [1, 0]])
2793+ c = np.array([[9, 1], [1, -9]])
2794+ d = np.arange(24).reshape(4, 6)
2795+ ddt = np.array(
2796+ [[ 55, 145, 235, 325],
2797+ [ 145, 451, 757, 1063],
2798+ [ 235, 757, 1279, 1801],
2799+ [ 325, 1063, 1801, 2539]]
2800+ )
2801+ dtd = np.array(
2802+ [[504, 540, 576, 612, 648, 684],
2803+ [540, 580, 620, 660, 700, 740],
2804+ [576, 620, 664, 708, 752, 796],
2805+ [612, 660, 708, 756, 804, 852],
2806+ [648, 700, 752, 804, 856, 908],
2807+ [684, 740, 796, 852, 908, 964]]
2808+ )
2809+
2810+
2811+ # gemm vs syrk optimizations
2812+ for et in [np.float32, np.float64, np.complex64, np.complex128]:
2813+ eaf = a.astype(et)
2814+ assert_equal(func(eaf, eaf), eaf)
2815+ assert_equal(func(eaf.T, eaf), eaf)
2816+ assert_equal(func(eaf, eaf.T), eaf)
2817+ assert_equal(func(eaf.T, eaf.T), eaf)
2818+ assert_equal(func(eaf.T.copy(), eaf), eaf)
2819+ assert_equal(func(eaf, eaf.T.copy()), eaf)
2820+ assert_equal(func(eaf.T.copy(), eaf.T.copy()), eaf)
2821+
2822+ # syrk validations
2823+ for et in [np.float32, np.float64, np.complex64, np.complex128]:
2824+ eaf = a.astype(et)
2825+ ebf = b.astype(et)
2826+ assert_equal(func(ebf, ebf), eaf)
2827+ assert_equal(func(ebf.T, ebf), eaf)
2828+ assert_equal(func(ebf, ebf.T), eaf)
2829+ assert_equal(func(ebf.T, ebf.T), eaf)
2830+
2831+ # syrk - different shape, stride, and view validations
2832+ for et in [np.float32, np.float64, np.complex64, np.complex128]:
2833+ edf = d.astype(et)
2834+ assert_equal(
2835+ func(edf[::-1, :], edf.T),
2836+ func(edf[::-1, :].copy(), edf.T.copy())
2837+ )
2838+ assert_equal(
2839+ func(edf[:, ::-1], edf.T),
2840+ func(edf[:, ::-1].copy(), edf.T.copy())
2841+ )
2842+ assert_equal(
2843+ func(edf, edf[::-1, :].T),
2844+ func(edf, edf[::-1, :].T.copy())
2845+ )
2846+ assert_equal(
2847+ func(edf, edf[:, ::-1].T),
2848+ func(edf, edf[:, ::-1].T.copy())
2849+ )
2850+ assert_equal(
2851+ func(edf[:edf.shape[0] // 2, :], edf[::2, :].T),
2852+ func(edf[:edf.shape[0] // 2, :].copy(), edf[::2, :].T.copy())
2853+ )
2854+ assert_equal(
2855+ func(edf[::2, :], edf[:edf.shape[0] // 2, :].T),
2856+ func(edf[::2, :].copy(), edf[:edf.shape[0] // 2, :].T.copy())
2857+ )
2858+
2859+ # syrk - different shape
2860+ for et in [np.float32, np.float64, np.complex64, np.complex128]:
2861+ edf = d.astype(et)
2862+ eddtf = ddt.astype(et)
2863+ edtdf = dtd.astype(et)
2864+ assert_equal(func(edf, edf.T), eddtf)
2865+ assert_equal(func(edf.T, edf), edtdf)
2866+
2867+ @pytest.mark.parametrize('func', (np.dot, np.matmul))
2868+ @pytest.mark.parametrize('dtype', 'ifdFD')
2869+ def test_no_dgemv(self, func, dtype):
2870+ # check vector arg for contiguous before gemv
2871+ # gh-12156
2872+ a = np.arange(8.0, dtype=dtype).reshape(2, 4)
2873+ b = np.broadcast_to(1., (4, 1))
2874+ ret1 = func(a, b)
2875+ ret2 = func(a, b.copy())
2876+ assert_equal(ret1, ret2)
2877+
2878+ ret1 = func(b.T, a.T)
2879+ ret2 = func(b.T.copy(), a.T)
2880+ assert_equal(ret1, ret2)
2881+
2882+ # check for unaligned data
2883+ dt = np.dtype(dtype)
2884+ a = np.zeros(8 * dt.itemsize // 2 + 1, dtype='int16')[1:].view(dtype)
2885+ a = a.reshape(2, 4)
2886+ b = a[0]
2887+ # make sure it is not aligned
2888+ assert_(a.__array_interface__['data'][0] % dt.itemsize != 0)
2889+ ret1 = func(a, b)
2890+ ret2 = func(a.copy(), b.copy())
2891+ assert_equal(ret1, ret2)
2892+
2893+ ret1 = func(b.T, a.T)
2894+ ret2 = func(b.T.copy(), a.T.copy())
2895+ assert_equal(ret1, ret2)
2896+
2897+ def test_dot(self):
2898+ a = np.array([[1, 0], [0, 1]])
2899+ b = np.array([[0, 1], [1, 0]])
2900+ c = np.array([[9, 1], [1, -9]])
2901+ # function versus methods
2902+ assert_equal(np.dot(a, b), a.dot(b))
2903+ assert_equal(np.dot(np.dot(a, b), c), a.dot(b).dot(c))
2904+
2905+ # test passing in an output array
2906+ c = np.zeros_like(a)
2907+ a.dot(b, c)
2908+ assert_equal(c, np.dot(a, b))
2909+
2910+ # test keyword args
2911+ c = np.zeros_like(a)
2912+ a.dot(b=b, out=c)
2913+ assert_equal(c, np.dot(a, b))
2914+
2915+ def test_dot_type_mismatch(self):
2916+ c = 1.
2917+ A = np.array((1,1), dtype='i,i')
2918+
2919+ assert_raises(TypeError, np.dot, c, A)
2920+ assert_raises(TypeError, np.dot, A, c)
2921+
2922+ def test_dot_out_mem_overlap(self):
2923+ np.random.seed(1)
2924+
2925+ # Test BLAS and non-BLAS code paths, including all dtypes
2926+ # that dot() supports
2927+ dtypes = [np.dtype(code) for code in np.typecodes['All']
2928+ if code not in 'USVM']
2929+ for dtype in dtypes:
2930+ a = np.random.rand(3, 3).astype(dtype)
2931+
2932+ # Valid dot() output arrays must be aligned
2933+ b = _aligned_zeros((3, 3), dtype=dtype)
2934+ b[...] = np.random.rand(3, 3)
2935+
2936+ y = np.dot(a, b)
2937+ x = np.dot(a, b, out=b)
2938+ assert_equal(x, y, err_msg=repr(dtype))
2939+
2940+ # Check invalid output array
2941+ assert_raises(ValueError, np.dot, a, b, out=b[::2])
2942+ assert_raises(ValueError, np.dot, a, b, out=b.T)
2943+
2944+ def test_dot_matmul_out(self):
2945+ # gh-9641
2946+ class Sub(np.ndarray):
2947+ pass
2948+ a = np.ones((2, 2)).view(Sub)
2949+ b = np.ones((2, 2)).view(Sub)
2950+ out = np.ones((2, 2))
2951+
2952+ # make sure out can be any ndarray (not only subclass of inputs)
2953+ np.dot(a, b, out=out)
2954+ np.matmul(a, b, out=out)
2955+
2956+ def test_dot_matmul_inner_array_casting_fails(self):
2957+
2958+ class A:
2959+ def __array__(self, *args, **kwargs):
2960+ raise NotImplementedError
2961+
2962+ # Don't override the error from calling __array__()
2963+ assert_raises(NotImplementedError, np.dot, A(), A())
2964+ assert_raises(NotImplementedError, np.matmul, A(), A())
2965+ assert_raises(NotImplementedError, np.inner, A(), A())
2966+
2967+ def test_matmul_out(self):
2968+ # overlapping memory
2969+ a = np.arange(18).reshape(2, 3, 3)
2970+ b = np.matmul(a, a)
2971+ c = np.matmul(a, a, out=a)
2972+ assert_(c is a)
2973+ assert_equal(c, b)
2974+ a = np.arange(18).reshape(2, 3, 3)
2975+ c = np.matmul(a, a, out=a[::-1, ...])
2976+ assert_(c.base is a.base)
2977+ assert_equal(c, b)
2978+
2979+ def test_diagonal(self):
2980+ a = np.arange(12).reshape((3, 4))
2981+ assert_equal(a.diagonal(), [0, 5, 10])
2982+ assert_equal(a.diagonal(0), [0, 5, 10])
2983+ assert_equal(a.diagonal(1), [1, 6, 11])
2984+ assert_equal(a.diagonal(-1), [4, 9])
2985+ assert_raises(np.AxisError, a.diagonal, axis1=0, axis2=5)
2986+ assert_raises(np.AxisError, a.diagonal, axis1=5, axis2=0)
2987+ assert_raises(np.AxisError, a.diagonal, axis1=5, axis2=5)
2988+ assert_raises(ValueError, a.diagonal, axis1=1, axis2=1)
2989+
2990+ b = np.arange(8).reshape((2, 2, 2))
2991+ assert_equal(b.diagonal(), [[0, 6], [1, 7]])
2992+ assert_equal(b.diagonal(0), [[0, 6], [1, 7]])
2993+ assert_equal(b.diagonal(1), [[2], [3]])
2994+ assert_equal(b.diagonal(-1), [[4], [5]])
2995+ assert_raises(ValueError, b.diagonal, axis1=0, axis2=0)
2996+ assert_equal(b.diagonal(0, 1, 2), [[0, 3], [4, 7]])
2997+ assert_equal(b.diagonal(0, 0, 1), [[0, 6], [1, 7]])
2998+ assert_equal(b.diagonal(offset=1, axis1=0, axis2=2), [[1], [3]])
2999+ # Order of axis argument doesn't matter:
3000+ assert_equal(b.diagonal(0, 2, 1), [[0, 3], [4, 7]])
3001+
3002+ def test_diagonal_view_notwriteable(self):
3003+ a = np.eye(3).diagonal()
3004+ assert_(not a.flags.writeable)
3005+ assert_(not a.flags.owndata)
3006+
3007+ a = np.diagonal(np.eye(3))
3008+ assert_(not a.flags.writeable)
3009+ assert_(not a.flags.owndata)
3010+
3011+ a = np.diag(np.eye(3))
3012+ assert_(not a.flags.writeable)
3013+ assert_(not a.flags.owndata)
3014+
3015+ def test_diagonal_memleak(self):
3016+ # Regression test for a bug that crept in at one point
3017+ a = np.zeros((100, 100))
3018+ if HAS_REFCOUNT:
3019+ assert_(sys.getrefcount(a) < 50)
3020+ for i in range(100):
3021+ a.diagonal()
3022+ if HAS_REFCOUNT:
3023+ assert_(sys.getrefcount(a) < 50)
3024+
3025+ def test_size_zero_memleak(self):
3026+ # Regression test for issue 9615
3027+ # Exercises a special-case code path for dot products of length
3028+ # zero in cblasfuncs (making it is specific to floating dtypes).
3029+ a = np.array([], dtype=np.float64)
3030+ x = np.array(2.0)
3031+ for _ in range(100):
3032+ np.dot(a, a, out=x)
3033+ if HAS_REFCOUNT:
3034+ assert_(sys.getrefcount(x) < 50)
3035+
3036+ def test_trace(self):
3037+ a = np.arange(12).reshape((3, 4))
3038+ assert_equal(a.trace(), 15)
3039+ assert_equal(a.trace(0), 15)
3040+ assert_equal(a.trace(1), 18)
3041+ assert_equal(a.trace(-1), 13)
3042+
3043+ b = np.arange(8).reshape((2, 2, 2))
3044+ assert_equal(b.trace(), [6, 8])
3045+ assert_equal(b.trace(0), [6, 8])
3046+ assert_equal(b.trace(1), [2, 3])
3047+ assert_equal(b.trace(-1), [4, 5])
3048+ assert_equal(b.trace(0, 0, 1), [6, 8])
3049+ assert_equal(b.trace(0, 0, 2), [5, 9])
3050+ assert_equal(b.trace(0, 1, 2), [3, 11])
3051+ assert_equal(b.trace(offset=1, axis1=0, axis2=2), [1, 3])
3052+
3053+ def test_trace_subclass(self):
3054+ # The class would need to overwrite trace to ensure single-element
3055+ # output also has the right subclass.
3056+ class MyArray(np.ndarray):
3057+ pass
3058+
3059+ b = np.arange(8).reshape((2, 2, 2)).view(MyArray)
3060+ t = b.trace()
3061+ assert_(isinstance(t, MyArray))
3062+
3063+ def test_put(self):
3064+ icodes = np.typecodes['AllInteger']
3065+ fcodes = np.typecodes['AllFloat']
3066+ for dt in icodes + fcodes + 'O':
3067+ tgt = np.array([0, 1, 0, 3, 0, 5], dtype=dt)
3068+
3069+ # test 1-d
3070+ a = np.zeros(6, dtype=dt)
3071+ a.put([1, 3, 5], [1, 3, 5])
3072+ assert_equal(a, tgt)
3073+
3074+ # test 2-d
3075+ a = np.zeros((2, 3), dtype=dt)
3076+ a.put([1, 3, 5], [1, 3, 5])
3077+ assert_equal(a, tgt.reshape(2, 3))
3078+
3079+ for dt in '?':
3080+ tgt = np.array([False, True, False, True, False, True], dtype=dt)
3081+
3082+ # test 1-d
3083+ a = np.zeros(6, dtype=dt)
3084+ a.put([1, 3, 5], [True]*3)
3085+ assert_equal(a, tgt)
3086+
3087+ # test 2-d
3088+ a = np.zeros((2, 3), dtype=dt)
3089+ a.put([1, 3, 5], [True]*3)
3090+ assert_equal(a, tgt.reshape(2, 3))
3091+
3092+ # check must be writeable
3093+ a = np.zeros(6)
3094+ a.flags.writeable = False
3095+ assert_raises(ValueError, a.put, [1, 3, 5], [1, 3, 5])
3096+
3097+ # when calling np.put, make sure a
3098+ # TypeError is raised if the object
3099+ # isn't an ndarray
3100+ bad_array = [1, 2, 3]
3101+ assert_raises(TypeError, np.put, bad_array, [0, 2], 5)
3102+
3103+ def test_ravel(self):
3104+ a = np.array([[0, 1], [2, 3]])
3105+ assert_equal(a.ravel(), [0, 1, 2, 3])
3106+ assert_(not a.ravel().flags.owndata)
3107+ assert_equal(a.ravel('F'), [0, 2, 1, 3])
3108+ assert_equal(a.ravel(order='C'), [0, 1, 2, 3])
3109+ assert_equal(a.ravel(order='F'), [0, 2, 1, 3])
3110+ assert_equal(a.ravel(order='A'), [0, 1, 2, 3])
3111+ assert_(not a.ravel(order='A').flags.owndata)
3112+ assert_equal(a.ravel(order='K'), [0, 1, 2, 3])
3113+ assert_(not a.ravel(order='K').flags.owndata)
3114+ assert_equal(a.ravel(), a.reshape(-1))
3115+
3116+ a = np.array([[0, 1], [2, 3]], order='F')
3117+ assert_equal(a.ravel(), [0, 1, 2, 3])
3118+ assert_equal(a.ravel(order='A'), [0, 2, 1, 3])
3119+ assert_equal(a.ravel(order='K'), [0, 2, 1, 3])
3120+ assert_(not a.ravel(order='A').flags.owndata)
3121+ assert_(not a.ravel(order='K').flags.owndata)
3122+ assert_equal(a.ravel(), a.reshape(-1))
3123+ assert_equal(a.ravel(order='A'), a.reshape(-1, order='A'))
3124+
3125+ a = np.array([[0, 1], [2, 3]])[::-1, :]
3126+ assert_equal(a.ravel(), [2, 3, 0, 1])
3127+ assert_equal(a.ravel(order='C'), [2, 3, 0, 1])
3128+ assert_equal(a.ravel(order='F'), [2, 0, 3, 1])
3129+ assert_equal(a.ravel(order='A'), [2, 3, 0, 1])
3130+ # 'K' doesn't reverse the axes of negative strides
3131+ assert_equal(a.ravel(order='K'), [2, 3, 0, 1])
3132+ assert_(a.ravel(order='K').flags.owndata)
3133+
3134+ # Test simple 1-d copy behaviour:
3135+ a = np.arange(10)[::2]
3136+ assert_(a.ravel('K').flags.owndata)
3137+ assert_(a.ravel('C').flags.owndata)
3138+ assert_(a.ravel('F').flags.owndata)
3139+
3140+ # Not contiguous and 1-sized axis with non matching stride
3141+ a = np.arange(2**3 * 2)[::2]
3142+ a = a.reshape(2, 1, 2, 2).swapaxes(-1, -2)
3143+ strides = list(a.strides)
3144+ strides[1] = 123
3145+ a.strides = strides
3146+ assert_(a.ravel(order='K').flags.owndata)
3147+ assert_equal(a.ravel('K'), np.arange(0, 15, 2))
3148+
3149+ # contiguous and 1-sized axis with non matching stride works:
3150+ a = np.arange(2**3)
3151+ a = a.reshape(2, 1, 2, 2).swapaxes(-1, -2)
3152+ strides = list(a.strides)
3153+ strides[1] = 123
3154+ a.strides = strides
3155+ assert_(np.may_share_memory(a.ravel(order='K'), a))
3156+ assert_equal(a.ravel(order='K'), np.arange(2**3))
3157+
3158+ # Test negative strides (not very interesting since non-contiguous):
3159+ a = np.arange(4)[::-1].reshape(2, 2)
3160+ assert_(a.ravel(order='C').flags.owndata)
3161+ assert_(a.ravel(order='K').flags.owndata)
3162+ assert_equal(a.ravel('C'), [3, 2, 1, 0])
3163+ assert_equal(a.ravel('K'), [3, 2, 1, 0])
3164+
3165+ # 1-element tidy strides test (NPY_RELAXED_STRIDES_CHECKING):
3166+ a = np.array([[1]])
3167+ a.strides = (123, 432)
3168+ # If the stride is not 8, NPY_RELAXED_STRIDES_CHECKING is messing
3169+ # them up on purpose:
3170+ if np.ones(1).strides == (8,):
3171+ assert_(np.may_share_memory(a.ravel('K'), a))
3172+ assert_equal(a.ravel('K').strides, (a.dtype.itemsize,))
3173+
3174+ for order in ('C', 'F', 'A', 'K'):
3175+ # 0-d corner case:
3176+ a = np.array(0)
3177+ assert_equal(a.ravel(order), [0])
3178+ assert_(np.may_share_memory(a.ravel(order), a))
3179+
3180+ # Test that certain non-inplace ravels work right (mostly) for 'K':
3181+ b = np.arange(2**4 * 2)[::2].reshape(2, 2, 2, 2)
3182+ a = b[..., ::2]
3183+ assert_equal(a.ravel('K'), [0, 4, 8, 12, 16, 20, 24, 28])
3184+ assert_equal(a.ravel('C'), [0, 4, 8, 12, 16, 20, 24, 28])
3185+ assert_equal(a.ravel('A'), [0, 4, 8, 12, 16, 20, 24, 28])
3186+ assert_equal(a.ravel('F'), [0, 16, 8, 24, 4, 20, 12, 28])
3187+
3188+ a = b[::2, ...]
3189+ assert_equal(a.ravel('K'), [0, 2, 4, 6, 8, 10, 12, 14])
3190+ assert_equal(a.ravel('C'), [0, 2, 4, 6, 8, 10, 12, 14])
3191+ assert_equal(a.ravel('A'), [0, 2, 4, 6, 8, 10, 12, 14])
3192+ assert_equal(a.ravel('F'), [0, 8, 4, 12, 2, 10, 6, 14])
3193+
3194+ def test_ravel_subclass(self):
3195+ class ArraySubclass(np.ndarray):
3196+ pass
3197+
3198+ a = np.arange(10).view(ArraySubclass)
3199+ assert_(isinstance(a.ravel('C'), ArraySubclass))
3200+ assert_(isinstance(a.ravel('F'), ArraySubclass))
3201+ assert_(isinstance(a.ravel('A'), ArraySubclass))
3202+ assert_(isinstance(a.ravel('K'), ArraySubclass))
3203+
3204+ a = np.arange(10)[::2].view(ArraySubclass)
3205+ assert_(isinstance(a.ravel('C'), ArraySubclass))
3206+ assert_(isinstance(a.ravel('F'), ArraySubclass))
3207+ assert_(isinstance(a.ravel('A'), ArraySubclass))
3208+ assert_(isinstance(a.ravel('K'), ArraySubclass))
3209+
3210+ def test_swapaxes(self):
3211+ a = np.arange(1*2*3*4).reshape(1, 2, 3, 4).copy()
3212+ idx = np.indices(a.shape)
3213+ assert_(a.flags['OWNDATA'])
3214+ b = a.copy()
3215+ # check exceptions
3216+ assert_raises(np.AxisError, a.swapaxes, -5, 0)
3217+ assert_raises(np.AxisError, a.swapaxes, 4, 0)
3218+ assert_raises(np.AxisError, a.swapaxes, 0, -5)
3219+ assert_raises(np.AxisError, a.swapaxes, 0, 4)
3220+
3221+ for i in range(-4, 4):
3222+ for j in range(-4, 4):
3223+ for k, src in enumerate((a, b)):
3224+ c = src.swapaxes(i, j)
3225+ # check shape
3226+ shape = list(src.shape)
3227+ shape[i] = src.shape[j]
3228+ shape[j] = src.shape[i]
3229+ assert_equal(c.shape, shape, str((i, j, k)))
3230+ # check array contents
3231+ i0, i1, i2, i3 = [dim-1 for dim in c.shape]
3232+ j0, j1, j2, j3 = [dim-1 for dim in src.shape]
3233+ assert_equal(src[idx[j0], idx[j1], idx[j2], idx[j3]],
3234+ c[idx[i0], idx[i1], idx[i2], idx[i3]],
3235+ str((i, j, k)))
3236+ # check a view is always returned, gh-5260
3237+ assert_(not c.flags['OWNDATA'], str((i, j, k)))
3238+ # check on non-contiguous input array
3239+ if k == 1:
3240+ b = c
3241+
3242+ def test_conjugate(self):
3243+ a = np.array([1-1j, 1+1j, 23+23.0j])
3244+ ac = a.conj()
3245+ assert_equal(a.real, ac.real)
3246+ assert_equal(a.imag, -ac.imag)
3247+ assert_equal(ac, a.conjugate())
3248+ assert_equal(ac, np.conjugate(a))
3249+
3250+ a = np.array([1-1j, 1+1j, 23+23.0j], 'F')
3251+ ac = a.conj()
3252+ assert_equal(a.real, ac.real)
3253+ assert_equal(a.imag, -ac.imag)
3254+ assert_equal(ac, a.conjugate())
3255+ assert_equal(ac, np.conjugate(a))
3256+
3257+ a = np.array([1, 2, 3])
3258+ ac = a.conj()
3259+ assert_equal(a, ac)
3260+ assert_equal(ac, a.conjugate())
3261+ assert_equal(ac, np.conjugate(a))
3262+
3263+ a = np.array([1.0, 2.0, 3.0])
3264+ ac = a.conj()
3265+ assert_equal(a, ac)
3266+ assert_equal(ac, a.conjugate())
3267+ assert_equal(ac, np.conjugate(a))
3268+
3269+ a = np.array([1-1j, 1+1j, 1, 2.0], object)
3270+ ac = a.conj()
3271+ assert_equal(ac, [k.conjugate() for k in a])
3272+ assert_equal(ac, a.conjugate())
3273+ assert_equal(ac, np.conjugate(a))
3274+
3275+ a = np.array([1-1j, 1, 2.0, 'f'], object)
3276+ assert_raises(TypeError, lambda: a.conj())
3277+ assert_raises(TypeError, lambda: a.conjugate())
3278+
3279+ def test__complex__(self):
3280+ dtypes = ['i1', 'i2', 'i4', 'i8',
3281+ 'u1', 'u2', 'u4', 'u8',
3282+ 'f', 'd', 'g', 'F', 'D', 'G',
3283+ '?', 'O']
3284+ for dt in dtypes:
3285+ a = np.array(7, dtype=dt)
3286+ b = np.array([7], dtype=dt)
3287+ c = np.array([[[[[7]]]]], dtype=dt)
3288+
3289+ msg = 'dtype: {0}'.format(dt)
3290+ ap = complex(a)
3291+ assert_equal(ap, a, msg)
3292+ bp = complex(b)
3293+ assert_equal(bp, b, msg)
3294+ cp = complex(c)
3295+ assert_equal(cp, c, msg)
3296+
3297+ def test__complex__should_not_work(self):
3298+ dtypes = ['i1', 'i2', 'i4', 'i8',
3299+ 'u1', 'u2', 'u4', 'u8',
3300+ 'f', 'd', 'g', 'F', 'D', 'G',
3301+ '?', 'O']
3302+ for dt in dtypes:
3303+ a = np.array([1, 2, 3], dtype=dt)
3304+ assert_raises(TypeError, complex, a)
3305+
3306+ dt = np.dtype([('a', 'f8'), ('b', 'i1')])
3307+ b = np.array((1.0, 3), dtype=dt)
3308+ assert_raises(TypeError, complex, b)
3309+
3310+ c = np.array([(1.0, 3), (2e-3, 7)], dtype=dt)
3311+ assert_raises(TypeError, complex, c)
3312+
3313+ d = np.array('1+1j')
3314+ assert_raises(TypeError, complex, d)
3315+
3316+ e = np.array(['1+1j'], 'U')
3317+ assert_raises(TypeError, complex, e)
3318+
3319+class TestCequenceMethods:
3320+ def test_array_contains(self):
3321+ assert_(4.0 in np.arange(16.).reshape(4,4))
3322+ assert_(20.0 not in np.arange(16.).reshape(4,4))
3323+
3324+class TestBinop:
3325+ def test_inplace(self):
3326+ # test refcount 1 inplace conversion
3327+ assert_array_almost_equal(np.array([0.5]) * np.array([1.0, 2.0]),
3328+ [0.5, 1.0])
3329+
3330+ d = np.array([0.5, 0.5])[::2]
3331+ assert_array_almost_equal(d * (d * np.array([1.0, 2.0])),
3332+ [0.25, 0.5])
3333+
3334+ a = np.array([0.5])
3335+ b = np.array([0.5])
3336+ c = a + b
3337+ c = a - b
3338+ c = a * b
3339+ c = a / b
3340+ assert_equal(a, b)
3341+ assert_almost_equal(c, 1.)
3342+
3343+ c = a + b * 2. / b * a - a / b
3344+ assert_equal(a, b)
3345+ assert_equal(c, 0.5)
3346+
3347+ # true divide
3348+ a = np.array([5])
3349+ b = np.array([3])
3350+ c = (a * a) / b
3351+
3352+ assert_almost_equal(c, 25 / 3)
3353+ assert_equal(a, 5)
3354+ assert_equal(b, 3)
3355+
3356+ # ndarray.__rop__ always calls ufunc
3357+ # ndarray.__iop__ always calls ufunc
3358+ # ndarray.__op__, __rop__:
3359+ # - defer if other has __array_ufunc__ and it is None
3360+ # or other is not a subclass and has higher array priority
3361+ # - else, call ufunc
3362+ def test_ufunc_binop_interaction(self):
3363+ # Python method name (without underscores)
3364+ # -> (numpy ufunc, has_in_place_version, preferred_dtype)
3365+ ops = {
3366+ 'add': (np.add, True, float),
3367+ 'sub': (np.subtract, True, float),
3368+ 'mul': (np.multiply, True, float),
3369+ 'truediv': (np.true_divide, True, float),
3370+ 'floordiv': (np.floor_divide, True, float),
3371+ 'mod': (np.remainder, True, float),
3372+ 'divmod': (np.divmod, False, float),
3373+ 'pow': (np.power, True, int),
3374+ 'lshift': (np.left_shift, True, int),
3375+ 'rshift': (np.right_shift, True, int),
3376+ 'and': (np.bitwise_and, True, int),
3377+ 'xor': (np.bitwise_xor, True, int),
3378+ 'or': (np.bitwise_or, True, int),
3379+ 'matmul': (np.matmul, False, float),
3380+ # 'ge': (np.less_equal, False),
3381+ # 'gt': (np.less, False),
3382+ # 'le': (np.greater_equal, False),
3383+ # 'lt': (np.greater, False),
3384+ # 'eq': (np.equal, False),
3385+ # 'ne': (np.not_equal, False),
3386+ }
3387+
3388+ class Coerced(Exception):
3389+ pass
3390+
3391+ def array_impl(self):
3392+ raise Coerced
3393+
3394+ def op_impl(self, other):
3395+ return "forward"
3396+
3397+ def rop_impl(self, other):
3398+ return "reverse"
3399+
3400+ def iop_impl(self, other):
3401+ return "in-place"
3402+
3403+ def array_ufunc_impl(self, ufunc, method, *args, **kwargs):
3404+ return ("__array_ufunc__", ufunc, method, args, kwargs)
3405+
3406+ # Create an object with the given base, in the given module, with a
3407+ # bunch of placeholder __op__ methods, and optionally a
3408+ # __array_ufunc__ and __array_priority__.
3409+ def make_obj(base, array_priority=False, array_ufunc=False,
3410+ alleged_module="__main__"):
3411+ class_namespace = {"__array__": array_impl}
3412+ if array_priority is not False:
3413+ class_namespace["__array_priority__"] = array_priority
3414+ for op in ops:
3415+ class_namespace["__{0}__".format(op)] = op_impl
3416+ class_namespace["__r{0}__".format(op)] = rop_impl
3417+ class_namespace["__i{0}__".format(op)] = iop_impl
3418+ if array_ufunc is not False:
3419+ class_namespace["__array_ufunc__"] = array_ufunc
3420+ eval_namespace = {"base": base,
3421+ "class_namespace": class_namespace,
3422+ "__name__": alleged_module,
3423+ }
3424+ MyType = eval("type('MyType', (base,), class_namespace)",
3425+ eval_namespace)
3426+ if issubclass(MyType, np.ndarray):
3427+ # Use this range to avoid special case weirdnesses around
3428+ # divide-by-0, pow(x, 2), overflow due to pow(big, big), etc.
3429+ return np.arange(3, 7).reshape(2, 2).view(MyType)
3430+ else:
3431+ return MyType()
3432+
3433+ def check(obj, binop_override_expected, ufunc_override_expected,
3434+ inplace_override_expected, check_scalar=True):
3435+ for op, (ufunc, has_inplace, dtype) in ops.items():
3436+ err_msg = ('op: %s, ufunc: %s, has_inplace: %s, dtype: %s'
3437+ % (op, ufunc, has_inplace, dtype))
3438+ check_objs = [np.arange(3, 7, dtype=dtype).reshape(2, 2)]
3439+ if check_scalar:
3440+ check_objs.append(check_objs[0][0])
3441+ for arr in check_objs:
3442+ arr_method = getattr(arr, "__{0}__".format(op))
3443+
3444+ def first_out_arg(result):
3445+ if op == "divmod":
3446+ assert_(isinstance(result, tuple))
3447+ return result[0]
3448+ else:
3449+ return result
3450+
3451+ # arr __op__ obj
3452+ if binop_override_expected:
3453+ assert_equal(arr_method(obj), NotImplemented, err_msg)
3454+ elif ufunc_override_expected:
3455+ assert_equal(arr_method(obj)[0], "__array_ufunc__",
3456+ err_msg)
3457+ else:
3458+ if (isinstance(obj, np.ndarray) and
3459+ (type(obj).__array_ufunc__ is
3460+ np.ndarray.__array_ufunc__)):
3461+ # __array__ gets ignored
3462+ res = first_out_arg(arr_method(obj))
3463+ assert_(res.__class__ is obj.__class__, err_msg)
3464+ else:
3465+ assert_raises((TypeError, Coerced),
3466+ arr_method, obj, err_msg=err_msg)
3467+ # obj __op__ arr
3468+ arr_rmethod = getattr(arr, "__r{0}__".format(op))
3469+ if ufunc_override_expected:
3470+ res = arr_rmethod(obj)
3471+ assert_equal(res[0], "__array_ufunc__",
3472+ err_msg=err_msg)
3473+ assert_equal(res[1], ufunc, err_msg=err_msg)
3474+ else:
3475+ if (isinstance(obj, np.ndarray) and
3476+ (type(obj).__array_ufunc__ is
3477+ np.ndarray.__array_ufunc__)):
3478+ # __array__ gets ignored
3479+ res = first_out_arg(arr_rmethod(obj))
3480+ assert_(res.__class__ is obj.__class__, err_msg)
3481+ else:
3482+ # __array_ufunc__ = "asdf" creates a TypeError
3483+ assert_raises((TypeError, Coerced),
3484+ arr_rmethod, obj, err_msg=err_msg)
3485+
3486+ # arr __iop__ obj
3487+ # array scalars don't have in-place operators
3488+ if has_inplace and isinstance(arr, np.ndarray):
3489+ arr_imethod = getattr(arr, "__i{0}__".format(op))
3490+ if inplace_override_expected:
3491+ assert_equal(arr_method(obj), NotImplemented,
3492+ err_msg=err_msg)
3493+ elif ufunc_override_expected:
3494+ res = arr_imethod(obj)
3495+ assert_equal(res[0], "__array_ufunc__", err_msg)
3496+ assert_equal(res[1], ufunc, err_msg)
3497+ assert_(type(res[-1]["out"]) is tuple, err_msg)
3498+ assert_(res[-1]["out"][0] is arr, err_msg)
3499+ else:
3500+ if (isinstance(obj, np.ndarray) and
3501+ (type(obj).__array_ufunc__ is
3502+ np.ndarray.__array_ufunc__)):
3503+ # __array__ gets ignored
3504+ assert_(arr_imethod(obj) is arr, err_msg)
3505+ else:
3506+ assert_raises((TypeError, Coerced),
3507+ arr_imethod, obj,
3508+ err_msg=err_msg)
3509+
3510+ op_fn = getattr(operator, op, None)
3511+ if op_fn is None:
3512+ op_fn = getattr(operator, op + "_", None)
3513+ if op_fn is None:
3514+ op_fn = getattr(builtins, op)
3515+ assert_equal(op_fn(obj, arr), "forward", err_msg)
3516+ if not isinstance(obj, np.ndarray):
3517+ if binop_override_expected:
3518+ assert_equal(op_fn(arr, obj), "reverse", err_msg)
3519+ elif ufunc_override_expected:
3520+ assert_equal(op_fn(arr, obj)[0], "__array_ufunc__",
3521+ err_msg)
3522+ if ufunc_override_expected:
3523+ assert_equal(ufunc(obj, arr)[0], "__array_ufunc__",
3524+ err_msg)
3525+
3526+ # No array priority, no array_ufunc -> nothing called
3527+ check(make_obj(object), False, False, False)
3528+ # Negative array priority, no array_ufunc -> nothing called
3529+ # (has to be very negative, because scalar priority is -1000000.0)
3530+ check(make_obj(object, array_priority=-2**30), False, False, False)
3531+ # Positive array priority, no array_ufunc -> binops and iops only
3532+ check(make_obj(object, array_priority=1), True, False, True)
3533+ # ndarray ignores array_priority for ndarray subclasses
3534+ check(make_obj(np.ndarray, array_priority=1), False, False, False,
3535+ check_scalar=False)
3536+ # Positive array_priority and array_ufunc -> array_ufunc only
3537+ check(make_obj(object, array_priority=1,
3538+ array_ufunc=array_ufunc_impl), False, True, False)
3539+ check(make_obj(np.ndarray, array_priority=1,
3540+ array_ufunc=array_ufunc_impl), False, True, False)
3541+ # array_ufunc set to None -> defer binops only
3542+ check(make_obj(object, array_ufunc=None), True, False, False)
3543+ check(make_obj(np.ndarray, array_ufunc=None), True, False, False,
3544+ check_scalar=False)
3545+
3546+ def test_ufunc_override_normalize_signature(self):
3547+ # gh-5674
3548+ class SomeClass:
3549+ def __array_ufunc__(self, ufunc, method, *inputs, **kw):
3550+ return kw
3551+
3552+ a = SomeClass()
3553+ kw = np.add(a, [1])
3554+ assert_('sig' not in kw and 'signature' not in kw)
3555+ kw = np.add(a, [1], sig='ii->i')
3556+ assert_('sig' not in kw and 'signature' in kw)
3557+ assert_equal(kw['signature'], 'ii->i')
3558+ kw = np.add(a, [1], signature='ii->i')
3559+ assert_('sig' not in kw and 'signature' in kw)
3560+ assert_equal(kw['signature'], 'ii->i')
3561+
3562+ def test_array_ufunc_index(self):
3563+ # Check that index is set appropriately, also if only an output
3564+ # is passed on (latter is another regression tests for github bug 4753)
3565+ # This also checks implicitly that 'out' is always a tuple.
3566+ class CheckIndex:
3567+ def __array_ufunc__(self, ufunc, method, *inputs, **kw):
3568+ for i, a in enumerate(inputs):
3569+ if a is self:
3570+ return i
3571+ # calls below mean we must be in an output.
3572+ for j, a in enumerate(kw['out']):
3573+ if a is self:
3574+ return (j,)
3575+
3576+ a = CheckIndex()
3577+ dummy = np.arange(2.)
3578+ # 1 input, 1 output
3579+ assert_equal(np.sin(a), 0)
3580+ assert_equal(np.sin(dummy, a), (0,))
3581+ assert_equal(np.sin(dummy, out=a), (0,))
3582+ assert_equal(np.sin(dummy, out=(a,)), (0,))
3583+ assert_equal(np.sin(a, a), 0)
3584+ assert_equal(np.sin(a, out=a), 0)
3585+ assert_equal(np.sin(a, out=(a,)), 0)
3586+ # 1 input, 2 outputs
3587+ assert_equal(np.modf(dummy, a), (0,))
3588+ assert_equal(np.modf(dummy, None, a), (1,))
3589+ assert_equal(np.modf(dummy, dummy, a), (1,))
3590+ assert_equal(np.modf(dummy, out=(a, None)), (0,))
3591+ assert_equal(np.modf(dummy, out=(a, dummy)), (0,))
3592+ assert_equal(np.modf(dummy, out=(None, a)), (1,))
3593+ assert_equal(np.modf(dummy, out=(dummy, a)), (1,))
3594+ assert_equal(np.modf(a, out=(dummy, a)), 0)
3595+ with assert_raises(TypeError):
3596+ # Out argument must be tuple, since there are multiple outputs
3597+ np.modf(dummy, out=a)
3598+
3599+ assert_raises(ValueError, np.modf, dummy, out=(a,))
3600+
3601+ # 2 inputs, 1 output
3602+ assert_equal(np.add(a, dummy), 0)
3603+ assert_equal(np.add(dummy, a), 1)
3604+ assert_equal(np.add(dummy, dummy, a), (0,))
3605+ assert_equal(np.add(dummy, a, a), 1)
3606+ assert_equal(np.add(dummy, dummy, out=a), (0,))
3607+ assert_equal(np.add(dummy, dummy, out=(a,)), (0,))
3608+ assert_equal(np.add(a, dummy, out=a), 0)
3609+
3610+ def test_out_override(self):
3611+ # regression test for github bug 4753
3612+ class OutClass(np.ndarray):
3613+ def __array_ufunc__(self, ufunc, method, *inputs, **kw):
3614+ if 'out' in kw:
3615+ tmp_kw = kw.copy()
3616+ tmp_kw.pop('out')
3617+ func = getattr(ufunc, method)
3618+ kw['out'][0][...] = func(*inputs, **tmp_kw)
3619+
3620+ A = np.array([0]).view(OutClass)
3621+ B = np.array([5])
3622+ C = np.array([6])
3623+ np.multiply(C, B, A)
3624+ assert_equal(A[0], 30)
3625+ assert_(isinstance(A, OutClass))
3626+ A[0] = 0
3627+ np.multiply(C, B, out=A)
3628+ assert_equal(A[0], 30)
3629+ assert_(isinstance(A, OutClass))
3630+
3631+ def test_pow_override_with_errors(self):
3632+ # regression test for gh-9112
3633+ class PowerOnly(np.ndarray):
3634+ def __array_ufunc__(self, ufunc, method, *inputs, **kw):
3635+ if ufunc is not np.power:
3636+ raise NotImplementedError
3637+ return "POWER!"
3638+ # explicit cast to float, to ensure the fast power path is taken.
3639+ a = np.array(5., dtype=np.float64).view(PowerOnly)
3640+ assert_equal(a ** 2.5, "POWER!")
3641+ with assert_raises(NotImplementedError):
3642+ a ** 0.5
3643+ with assert_raises(NotImplementedError):
3644+ a ** 0
3645+ with assert_raises(NotImplementedError):
3646+ a ** 1
3647+ with assert_raises(NotImplementedError):
3648+ a ** -1
3649+ with assert_raises(NotImplementedError):
3650+ a ** 2
3651+
3652+ def test_pow_array_object_dtype(self):
3653+ # test pow on arrays of object dtype
3654+ class SomeClass:
3655+ def __init__(self, num=None):
3656+ self.num = num
3657+
3658+ # want to ensure a fast pow path is not taken
3659+ def __mul__(self, other):
3660+ raise AssertionError('__mul__ should not be called')
3661+
3662+ def __div__(self, other):
3663+ raise AssertionError('__div__ should not be called')
3664+
3665+ def __pow__(self, exp):
3666+ return SomeClass(num=self.num ** exp)
3667+
3668+ def __eq__(self, other):
3669+ if isinstance(other, SomeClass):
3670+ return self.num == other.num
3671+
3672+ __rpow__ = __pow__
3673+
3674+ def pow_for(exp, arr):
3675+ return np.array([x ** exp for x in arr])
3676+
3677+ obj_arr = np.array([SomeClass(1), SomeClass(2), SomeClass(3)])
3678+
3679+ assert_equal(obj_arr ** 0.5, pow_for(0.5, obj_arr))
3680+ assert_equal(obj_arr ** 0, pow_for(0, obj_arr))
3681+ assert_equal(obj_arr ** 1, pow_for(1, obj_arr))
3682+ assert_equal(obj_arr ** -1, pow_for(-1, obj_arr))
3683+ assert_equal(obj_arr ** 2, pow_for(2, obj_arr))
3684+
3685+ def test_pos_array_ufunc_override(self):
3686+ class A(np.ndarray):
3687+ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
3688+ return getattr(ufunc, method)(*[i.view(np.ndarray) for
3689+ i in inputs], **kwargs)
3690+ tst = np.array('foo').view(A)
3691+ with assert_raises(TypeError):
3692+ +tst
3693+
3694+
3695+class TestTemporaryElide:
3696+ # elision is only triggered on relatively large arrays
3697+
3698+ def test_extension_incref_elide(self):
3699+ # test extension (e.g. cython) calling PyNumber_* slots without
3700+ # increasing the reference counts
3701+ #
3702+ # def incref_elide(a):
3703+ # d = input.copy() # refcount 1
3704+ # return d, d + d # PyNumber_Add without increasing refcount
3705+ from numpy.core._multiarray_tests import incref_elide
3706+ d = np.ones(100000)
3707+ orig, res = incref_elide(d)
3708+ d + d
3709+ # the return original should not be changed to an inplace operation
3710+ assert_array_equal(orig, d)
3711+ assert_array_equal(res, d + d)
3712+
3713+ def test_extension_incref_elide_stack(self):
3714+ # scanning if the refcount == 1 object is on the python stack to check
3715+ # that we are called directly from python is flawed as object may still
3716+ # be above the stack pointer and we have no access to the top of it
3717+ #
3718+ # def incref_elide_l(d):
3719+ # return l[4] + l[4] # PyNumber_Add without increasing refcount
3720+ from numpy.core._multiarray_tests import incref_elide_l
3721+ # padding with 1 makes sure the object on the stack is not overwritten
3722+ l = [1, 1, 1, 1, np.ones(100000)]
3723+ res = incref_elide_l(l)
3724+ # the return original should not be changed to an inplace operation
3725+ assert_array_equal(l[4], np.ones(100000))
3726+ assert_array_equal(res, l[4] + l[4])
3727+
3728+ def test_temporary_with_cast(self):
3729+ # check that we don't elide into a temporary which would need casting
3730+ d = np.ones(200000, dtype=np.int64)
3731+ assert_equal(((d + d) + 2**222).dtype, np.dtype('O'))
3732+
3733+ r = ((d + d) / 2)
3734+ assert_equal(r.dtype, np.dtype('f8'))
3735+
3736+ r = np.true_divide((d + d), 2)
3737+ assert_equal(r.dtype, np.dtype('f8'))
3738+
3739+ r = ((d + d) / 2.)
3740+ assert_equal(r.dtype, np.dtype('f8'))
3741+
3742+ r = ((d + d) // 2)
3743+ assert_equal(r.dtype, np.dtype(np.int64))
3744+
3745+ # commutative elision into the astype result
3746+ f = np.ones(100000, dtype=np.float32)
3747+ assert_equal(((f + f) + f.astype(np.float64)).dtype, np.dtype('f8'))
3748+
3749+ # no elision into lower type
3750+ d = f.astype(np.float64)
3751+ assert_equal(((f + f) + d).dtype, d.dtype)
3752+ l = np.ones(100000, dtype=np.longdouble)
3753+ assert_equal(((d + d) + l).dtype, l.dtype)
3754+
3755+ # test unary abs with different output dtype
3756+ for dt in (np.complex64, np.complex128, np.clongdouble):
3757+ c = np.ones(100000, dtype=dt)
3758+ r = abs(c * 2.0)
3759+ assert_equal(r.dtype, np.dtype('f%d' % (c.itemsize // 2)))
3760+
3761+ def test_elide_broadcast(self):
3762+ # test no elision on broadcast to higher dimension
3763+ # only triggers elision code path in debug mode as triggering it in
3764+ # normal mode needs 256kb large matching dimension, so a lot of memory
3765+ d = np.ones((2000, 1), dtype=int)
3766+ b = np.ones((2000), dtype=bool)
3767+ r = (1 - d) + b
3768+ assert_equal(r, 1)
3769+ assert_equal(r.shape, (2000, 2000))
3770+
3771+ def test_elide_scalar(self):
3772+ # check inplace op does not create ndarray from scalars
3773+ a = np.bool_()
3774+ assert_(type(~(a & a)) is np.bool_)
3775+
3776+ def test_elide_scalar_readonly(self):
3777+ # The imaginary part of a real array is readonly. This needs to go
3778+ # through fast_scalar_power which is only called for powers of
3779+ # +1, -1, 0, 0.5, and 2, so use 2. Also need valid refcount for
3780+ # elision which can be gotten for the imaginary part of a real
3781+ # array. Should not error.
3782+ a = np.empty(100000, dtype=np.float64)
3783+ a.imag ** 2
3784+
3785+ def test_elide_readonly(self):
3786+ # don't try to elide readonly temporaries
3787+ r = np.asarray(np.broadcast_to(np.zeros(1), 100000).flat) * 0.0
3788+ assert_equal(r, 0)
3789+
3790+ def test_elide_updateifcopy(self):
3791+ a = np.ones(2**20)[::2]
3792+ b = a.flat.__array__() + 1
3793+ del b
3794+ assert_equal(a, 1)
3795+
3796+
3797+class TestCAPI:
3798+ def test_IsPythonScalar(self):
3799+ from numpy.core._multiarray_tests import IsPythonScalar
3800+ assert_(IsPythonScalar(b'foobar'))
3801+ assert_(IsPythonScalar(1))
3802+ assert_(IsPythonScalar(2**80))
3803+ assert_(IsPythonScalar(2.))
3804+ assert_(IsPythonScalar("a"))
3805+
3806+
3807+class TestSubscripting:
3808+ def test_test_zero_rank(self):
3809+ x = np.array([1, 2, 3])
3810+ assert_(isinstance(x[0], np.int_))
3811+ assert_(type(x[0, ...]) is np.ndarray)
3812+
3813+
3814+class TestPickling:
3815+ @pytest.mark.skipif(pickle.HIGHEST_PROTOCOL >= 5,
3816+ reason=('this tests the error messages when trying to'
3817+ 'protocol 5 although it is not available'))
3818+ def test_correct_protocol5_error_message(self):
3819+ array = np.arange(10)
3820+
3821+ if sys.version_info[:2] in ((3, 6), (3, 7)):
3822+ # For the specific case of python3.6 and 3.7, raise a clear import
3823+ # error about the pickle5 backport when trying to use protocol=5
3824+ # without the pickle5 package
3825+ with pytest.raises(ImportError):
3826+ array.__reduce_ex__(5)
3827+
3828+ elif sys.version_info[:2] < (3, 6):
3829+ # when calling __reduce_ex__ explicitly with protocol=5 on python
3830+ # raise a ValueError saying that protocol 5 is not available for
3831+ # this python version
3832+ with pytest.raises(ValueError):
3833+ array.__reduce_ex__(5)
3834+
3835+ def test_record_array_with_object_dtype(self):
3836+ my_object = object()
3837+
3838+ arr_with_object = np.array(
3839+ [(my_object, 1, 2.0)],
3840+ dtype=[('a', object), ('b', int), ('c', float)])
3841+ arr_without_object = np.array(
3842+ [('xxx', 1, 2.0)],
3843+ dtype=[('a', str), ('b', int), ('c', float)])
3844+
3845+ for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
3846+ depickled_arr_with_object = pickle.loads(
3847+ pickle.dumps(arr_with_object, protocol=proto))
3848+ depickled_arr_without_object = pickle.loads(
3849+ pickle.dumps(arr_without_object, protocol=proto))
3850+
3851+ assert_equal(arr_with_object.dtype,
3852+ depickled_arr_with_object.dtype)
3853+ assert_equal(arr_without_object.dtype,
3854+ depickled_arr_without_object.dtype)
3855+
3856+ @pytest.mark.skipif(pickle.HIGHEST_PROTOCOL < 5,
3857+ reason="requires pickle protocol 5")
3858+ def test_f_contiguous_array(self):
3859+ f_contiguous_array = np.array([[1, 2, 3], [4, 5, 6]], order='F')
3860+ buffers = []
3861+
3862+ # When using pickle protocol 5, Fortran-contiguous arrays can be
3863+ # serialized using out-of-band buffers
3864+ bytes_string = pickle.dumps(f_contiguous_array, protocol=5,
3865+ buffer_callback=buffers.append)
3866+
3867+ assert len(buffers) > 0
3868+
3869+ depickled_f_contiguous_array = pickle.loads(bytes_string,
3870+ buffers=buffers)
3871+
3872+ assert_equal(f_contiguous_array, depickled_f_contiguous_array)
3873+
3874+ def test_non_contiguous_array(self):
3875+ non_contiguous_array = np.arange(12).reshape(3, 4)[:, :2]
3876+ assert not non_contiguous_array.flags.c_contiguous
3877+ assert not non_contiguous_array.flags.f_contiguous
3878+
3879+ # make sure non-contiguous arrays can be pickled-depickled
3880+ # using any protocol
3881+ for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
3882+ depickled_non_contiguous_array = pickle.loads(
3883+ pickle.dumps(non_contiguous_array, protocol=proto))
3884+
3885+ assert_equal(non_contiguous_array, depickled_non_contiguous_array)
3886+
3887+ def test_roundtrip(self):
3888+ for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
3889+ carray = np.array([[2, 9], [7, 0], [3, 8]])
3890+ DATA = [
3891+ carray,
3892+ np.transpose(carray),
3893+ np.array([('xxx', 1, 2.0)], dtype=[('a', (str, 3)), ('b', int),
3894+ ('c', float)])
3895+ ]
3896+
3897+ refs = [weakref.ref(a) for a in DATA]
3898+ for a in DATA:
3899+ assert_equal(
3900+ a, pickle.loads(pickle.dumps(a, protocol=proto)),
3901+ err_msg="%r" % a)
3902+ del a, DATA, carray
3903+ break_cycles()
3904+ # check for reference leaks (gh-12793)
3905+ for ref in refs:
3906+ assert ref() is None
3907+
3908+ def _loads(self, obj):
3909+ return pickle.loads(obj, encoding='latin1')
3910+
3911+ # version 0 pickles, using protocol=2 to pickle
3912+ # version 0 doesn't have a version field
3913+ def test_version0_int8(self):
3914+ s = b'\x80\x02cnumpy.core._internal\n_reconstruct\nq\x01cnumpy\nndarray\nq\x02K\x00\x85U\x01b\x87Rq\x03(K\x04\x85cnumpy\ndtype\nq\x04U\x02i1K\x00K\x01\x87Rq\x05(U\x01|NNJ\xff\xff\xff\xffJ\xff\xff\xff\xfftb\x89U\x04\x01\x02\x03\x04tb.'
3915+ a = np.array([1, 2, 3, 4], dtype=np.int8)
3916+ p = self._loads(s)
3917+ assert_equal(a, p)
3918+
3919+ def test_version0_float32(self):
3920+ s = b'\x80\x02cnumpy.core._internal\n_reconstruct\nq\x01cnumpy\nndarray\nq\x02K\x00\x85U\x01b\x87Rq\x03(K\x04\x85cnumpy\ndtype\nq\x04U\x02f4K\x00K\x01\x87Rq\x05(U\x01<NNJ\xff\xff\xff\xffJ\xff\xff\xff\xfftb\x89U\x10\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@tb.'
3921+ a = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32)
3922+ p = self._loads(s)
3923+ assert_equal(a, p)
3924+
3925+ def test_version0_object(self):
3926+ s = b'\x80\x02cnumpy.core._internal\n_reconstruct\nq\x01cnumpy\nndarray\nq\x02K\x00\x85U\x01b\x87Rq\x03(K\x02\x85cnumpy\ndtype\nq\x04U\x02O8K\x00K\x01\x87Rq\x05(U\x01|NNJ\xff\xff\xff\xffJ\xff\xff\xff\xfftb\x89]q\x06(}q\x07U\x01aK\x01s}q\x08U\x01bK\x02setb.'
3927+ a = np.array([{'a': 1}, {'b': 2}])
3928+ p = self._loads(s)
3929+ assert_equal(a, p)
3930+
3931+ # version 1 pickles, using protocol=2 to pickle
3932+ def test_version1_int8(self):
3933+ s = b'\x80\x02cnumpy.core._internal\n_reconstruct\nq\x01cnumpy\nndarray\nq\x02K\x00\x85U\x01b\x87Rq\x03(K\x01K\x04\x85cnumpy\ndtype\nq\x04U\x02i1K\x00K\x01\x87Rq\x05(K\x01U\x01|NNJ\xff\xff\xff\xffJ\xff\xff\xff\xfftb\x89U\x04\x01\x02\x03\x04tb.'
3934+ a = np.array([1, 2, 3, 4], dtype=np.int8)
3935+ p = self._loads(s)
3936+ assert_equal(a, p)
3937+
3938+ def test_version1_float32(self):
3939+ s = b'\x80\x02cnumpy.core._internal\n_reconstruct\nq\x01cnumpy\nndarray\nq\x02K\x00\x85U\x01b\x87Rq\x03(K\x01K\x04\x85cnumpy\ndtype\nq\x04U\x02f4K\x00K\x01\x87Rq\x05(K\x01U\x01<NNJ\xff\xff\xff\xffJ\xff\xff\xff\xfftb\x89U\x10\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@tb.'
3940+ a = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32)
3941+ p = self._loads(s)
3942+ assert_equal(a, p)
3943+
3944+ def test_version1_object(self):
3945+ s = b'\x80\x02cnumpy.core._internal\n_reconstruct\nq\x01cnumpy\nndarray\nq\x02K\x00\x85U\x01b\x87Rq\x03(K\x01K\x02\x85cnumpy\ndtype\nq\x04U\x02O8K\x00K\x01\x87Rq\x05(K\x01U\x01|NNJ\xff\xff\xff\xffJ\xff\xff\xff\xfftb\x89]q\x06(}q\x07U\x01aK\x01s}q\x08U\x01bK\x02setb.'
3946+ a = np.array([{'a': 1}, {'b': 2}])
3947+ p = self._loads(s)
3948+ assert_equal(a, p)
3949+
3950+ def test_subarray_int_shape(self):
3951+ s = b"cnumpy.core.multiarray\n_reconstruct\np0\n(cnumpy\nndarray\np1\n(I0\ntp2\nS'b'\np3\ntp4\nRp5\n(I1\n(I1\ntp6\ncnumpy\ndtype\np7\n(S'V6'\np8\nI0\nI1\ntp9\nRp10\n(I3\nS'|'\np11\nN(S'a'\np12\ng3\ntp13\n(dp14\ng12\n(g7\n(S'V4'\np15\nI0\nI1\ntp16\nRp17\n(I3\nS'|'\np18\n(g7\n(S'i1'\np19\nI0\nI1\ntp20\nRp21\n(I3\nS'|'\np22\nNNNI-1\nI-1\nI0\ntp23\nb(I2\nI2\ntp24\ntp25\nNNI4\nI1\nI0\ntp26\nbI0\ntp27\nsg3\n(g7\n(S'V2'\np28\nI0\nI1\ntp29\nRp30\n(I3\nS'|'\np31\n(g21\nI2\ntp32\nNNI2\nI1\nI0\ntp33\nbI4\ntp34\nsI6\nI1\nI0\ntp35\nbI00\nS'\\x01\\x01\\x01\\x01\\x01\\x02'\np36\ntp37\nb."
3952+ a = np.array([(1, (1, 2))], dtype=[('a', 'i1', (2, 2)), ('b', 'i1', 2)])
3953+ p = self._loads(s)
3954+ assert_equal(a, p)
3955+
3956+ def test_datetime64_byteorder(self):
3957+ original = np.array([['2015-02-24T00:00:00.000000000']], dtype='datetime64[ns]')
3958+
3959+ original_byte_reversed = original.copy(order='K')
3960+ original_byte_reversed.dtype = original_byte_reversed.dtype.newbyteorder('S')
3961+ original_byte_reversed.byteswap(inplace=True)
3962+
3963+ new = pickle.loads(pickle.dumps(original_byte_reversed))
3964+
3965+ assert_equal(original.dtype, new.dtype)
3966+
3967+
3968+class TestFancyIndexing:
3969+ def test_list(self):
3970+ x = np.ones((1, 1))
3971+ x[:, [0]] = 2.0
3972+ assert_array_equal(x, np.array([[2.0]]))
3973+
3974+ x = np.ones((1, 1, 1))
3975+ x[:, :, [0]] = 2.0
3976+ assert_array_equal(x, np.array([[[2.0]]]))
3977+
3978+ def test_tuple(self):
3979+ x = np.ones((1, 1))
3980+ x[:, (0,)] = 2.0
3981+ assert_array_equal(x, np.array([[2.0]]))
3982+ x = np.ones((1, 1, 1))
3983+ x[:, :, (0,)] = 2.0
3984+ assert_array_equal(x, np.array([[[2.0]]]))
3985+
3986+ def test_mask(self):
3987+ x = np.array([1, 2, 3, 4])
3988+ m = np.array([0, 1, 0, 0], bool)
3989+ assert_array_equal(x[m], np.array([2]))
3990+
3991+ def test_mask2(self):
3992+ x = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
3993+ m = np.array([0, 1], bool)
3994+ m2 = np.array([[0, 1, 0, 0], [1, 0, 0, 0]], bool)
3995+ m3 = np.array([[0, 1, 0, 0], [0, 0, 0, 0]], bool)
3996+ assert_array_equal(x[m], np.array([[5, 6, 7, 8]]))
3997+ assert_array_equal(x[m2], np.array([2, 5]))
3998+ assert_array_equal(x[m3], np.array([2]))
3999+
4000+ def test_assign_mask(self):
4001+ x = np.array([1, 2, 3, 4])
4002+ m = np.array([0, 1, 0, 0], bool)
4003+ x[m] = 5
4004+ assert_array_equal(x, np.array([1, 5, 3, 4]))
4005+
4006+ def test_assign_mask2(self):
4007+ xorig = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
4008+ m = np.array([0, 1], bool)
4009+ m2 = np.array([[0, 1, 0, 0], [1, 0, 0, 0]], bool)
4010+ m3 = np.array([[0, 1, 0, 0], [0, 0, 0, 0]], bool)
4011+ x = xorig.copy()
4012+ x[m] = 10
4013+ assert_array_equal(x, np.array([[1, 2, 3, 4], [10, 10, 10, 10]]))
4014+ x = xorig.copy()
4015+ x[m2] = 10
4016+ assert_array_equal(x, np.array([[1, 10, 3, 4], [10, 6, 7, 8]]))
4017+ x = xorig.copy()
4018+ x[m3] = 10
4019+ assert_array_equal(x, np.array([[1, 10, 3, 4], [5, 6, 7, 8]]))
4020+
4021+
4022+class TestStringCompare:
4023+ def test_string(self):
4024+ g1 = np.array(["This", "is", "example"])
4025+ g2 = np.array(["This", "was", "example"])
4026+ assert_array_equal(g1 == g2, [g1[i] == g2[i] for i in [0, 1, 2]])
4027+ assert_array_equal(g1 != g2, [g1[i] != g2[i] for i in [0, 1, 2]])
4028+ assert_array_equal(g1 <= g2, [g1[i] <= g2[i] for i in [0, 1, 2]])
4029+ assert_array_equal(g1 >= g2, [g1[i] >= g2[i] for i in [0, 1, 2]])
4030+ assert_array_equal(g1 < g2, [g1[i] < g2[i] for i in [0, 1, 2]])
4031+ assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0, 1, 2]])
4032+
4033+ def test_mixed(self):
4034+ g1 = np.array(["spam", "spa", "spammer", "and eggs"])
4035+ g2 = "spam"
4036+ assert_array_equal(g1 == g2, [x == g2 for x in g1])
4037+ assert_array_equal(g1 != g2, [x != g2 for x in g1])
4038+ assert_array_equal(g1 < g2, [x < g2 for x in g1])
4039+ assert_array_equal(g1 > g2, [x > g2 for x in g1])
4040+ assert_array_equal(g1 <= g2, [x <= g2 for x in g1])
4041+ assert_array_equal(g1 >= g2, [x >= g2 for x in g1])
4042+
4043+ def test_unicode(self):
4044+ g1 = np.array([u"This", u"is", u"example"])
4045+ g2 = np.array([u"This", u"was", u"example"])
4046+ assert_array_equal(g1 == g2, [g1[i] == g2[i] for i in [0, 1, 2]])
4047+ assert_array_equal(g1 != g2, [g1[i] != g2[i] for i in [0, 1, 2]])
4048+ assert_array_equal(g1 <= g2, [g1[i] <= g2[i] for i in [0, 1, 2]])
4049+ assert_array_equal(g1 >= g2, [g1[i] >= g2[i] for i in [0, 1, 2]])
4050+ assert_array_equal(g1 < g2, [g1[i] < g2[i] for i in [0, 1, 2]])
4051+ assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0, 1, 2]])
4052+
4053+
4054+class TestArgmax:
4055+
4056+ nan_arr = [
4057+ ([0, 1, 2, 3, np.nan], 4),
4058+ ([0, 1, 2, np.nan, 3], 3),
4059+ ([np.nan, 0, 1, 2, 3], 0),
4060+ ([np.nan, 0, np.nan, 2, 3], 0),
4061+ ([0, 1, 2, 3, complex(0, np.nan)], 4),
4062+ ([0, 1, 2, 3, complex(np.nan, 0)], 4),
4063+ ([0, 1, 2, complex(np.nan, 0), 3], 3),
4064+ ([0, 1, 2, complex(0, np.nan), 3], 3),
4065+ ([complex(0, np.nan), 0, 1, 2, 3], 0),
4066+ ([complex(np.nan, np.nan), 0, 1, 2, 3], 0),
4067+ ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, 1)], 0),
4068+ ([complex(np.nan, np.nan), complex(np.nan, 2), complex(np.nan, 1)], 0),
4069+ ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, np.nan)], 0),
4070+
4071+ ([complex(0, 0), complex(0, 2), complex(0, 1)], 1),
4072+ ([complex(1, 0), complex(0, 2), complex(0, 1)], 0),
4073+ ([complex(1, 0), complex(0, 2), complex(1, 1)], 2),
4074+
4075+ ([np.datetime64('1923-04-14T12:43:12'),
4076+ np.datetime64('1994-06-21T14:43:15'),
4077+ np.datetime64('2001-10-15T04:10:32'),
4078+ np.datetime64('1995-11-25T16:02:16'),
4079+ np.datetime64('2005-01-04T03:14:12'),
4080+ np.datetime64('2041-12-03T14:05:03')], 5),
4081+ ([np.datetime64('1935-09-14T04:40:11'),
4082+ np.datetime64('1949-10-12T12:32:11'),
4083+ np.datetime64('2010-01-03T05:14:12'),
4084+ np.datetime64('2015-11-20T12:20:59'),
4085+ np.datetime64('1932-09-23T10:10:13'),
4086+ np.datetime64('2014-10-10T03:50:30')], 3),
4087+ # Assorted tests with NaTs
4088+ ([np.datetime64('NaT'),
4089+ np.datetime64('NaT'),
4090+ np.datetime64('2010-01-03T05:14:12'),
4091+ np.datetime64('NaT'),
4092+ np.datetime64('2015-09-23T10:10:13'),
4093+ np.datetime64('1932-10-10T03:50:30')], 0),
4094+ ([np.datetime64('2059-03-14T12:43:12'),
4095+ np.datetime64('1996-09-21T14:43:15'),
4096+ np.datetime64('NaT'),
4097+ np.datetime64('2022-12-25T16:02:16'),
4098+ np.datetime64('1963-10-04T03:14:12'),
4099+ np.datetime64('2013-05-08T18:15:23')], 2),
4100+ ([np.timedelta64(2, 's'),
4101+ np.timedelta64(1, 's'),
4102+ np.timedelta64('NaT', 's'),
4103+ np.timedelta64(3, 's')], 2),
4104+ ([np.timedelta64('NaT', 's')] * 3, 0),
4105+
4106+ ([timedelta(days=5, seconds=14), timedelta(days=2, seconds=35),
4107+ timedelta(days=-1, seconds=23)], 0),
4108+ ([timedelta(days=1, seconds=43), timedelta(days=10, seconds=5),
4109+ timedelta(days=5, seconds=14)], 1),
4110+ ([timedelta(days=10, seconds=24), timedelta(days=10, seconds=5),
4111+ timedelta(days=10, seconds=43)], 2),
4112+
4113+ ([False, False, False, False, True], 4),
4114+ ([False, False, False, True, False], 3),
4115+ ([True, False, False, False, False], 0),
4116+ ([True, False, True, False, False], 0),
4117+ ]
4118+
4119+ def test_all(self):
4120+ a = np.random.normal(0, 1, (4, 5, 6, 7, 8))
4121+ for i in range(a.ndim):
4122+ amax = a.max(i)
4123+ aargmax = a.argmax(i)
4124+ axes = list(range(a.ndim))
4125+ axes.remove(i)
4126+ assert_(np.all(amax == aargmax.choose(*a.transpose(i,*axes))))
4127+
4128+ def test_combinations(self):
4129+ for arr, pos in self.nan_arr:
4130+ with suppress_warnings() as sup:
4131+ sup.filter(RuntimeWarning,
4132+ "invalid value encountered in reduce")
4133+ max_val = np.max(arr)
4134+
4135+ assert_equal(np.argmax(arr), pos, err_msg="%r" % arr)
4136+ assert_equal(arr[np.argmax(arr)], max_val, err_msg="%r" % arr)
4137+
4138+ def test_output_shape(self):
4139+ # see also gh-616
4140+ a = np.ones((10, 5))
4141+ # Check some simple shape mismatches
4142+ out = np.ones(11, dtype=np.int_)
4143+ assert_raises(ValueError, a.argmax, -1, out)
4144+
4145+ out = np.ones((2, 5), dtype=np.int_)
4146+ assert_raises(ValueError, a.argmax, -1, out)
4147+
4148+ # these could be relaxed possibly (used to allow even the previous)
4149+ out = np.ones((1, 10), dtype=np.int_)
4150+ assert_raises(ValueError, a.argmax, -1, out)
4151+
4152+ out = np.ones(10, dtype=np.int_)
4153+ a.argmax(-1, out=out)
4154+ assert_equal(out, a.argmax(-1))
4155+
4156+ def test_argmax_unicode(self):
4157+ d = np.zeros(6031, dtype='<U9')
4158+ d[5942] = "as"
4159+ assert_equal(d.argmax(), 5942)
4160+
4161+ def test_np_vs_ndarray(self):
4162+ # make sure both ndarray.argmax and numpy.argmax support out/axis args
4163+ a = np.random.normal(size=(2,3))
4164+
4165+ # check positional args
4166+ out1 = np.zeros(2, dtype=int)
4167+ out2 = np.zeros(2, dtype=int)
4168+ assert_equal(a.argmax(1, out1), np.argmax(a, 1, out2))
4169+ assert_equal(out1, out2)
4170+
4171+ # check keyword args
4172+ out1 = np.zeros(3, dtype=int)
4173+ out2 = np.zeros(3, dtype=int)
4174+ assert_equal(a.argmax(out=out1, axis=0), np.argmax(a, out=out2, axis=0))
4175+ assert_equal(out1, out2)
4176+
4177+ @pytest.mark.leaks_references(reason="replaces None with NULL.")
4178+ def test_object_argmax_with_NULLs(self):
4179+ # See gh-6032
4180+ a = np.empty(4, dtype='O')
4181+ ctypes.memset(a.ctypes.data, 0, a.nbytes)
4182+ assert_equal(a.argmax(), 0)
4183+ a[3] = 10
4184+ assert_equal(a.argmax(), 3)
4185+ a[1] = 30
4186+ assert_equal(a.argmax(), 1)
4187+
4188+
4189+class TestArgmin:
4190+
4191+ nan_arr = [
4192+ ([0, 1, 2, 3, np.nan], 4),
4193+ ([0, 1, 2, np.nan, 3], 3),
4194+ ([np.nan, 0, 1, 2, 3], 0),
4195+ ([np.nan, 0, np.nan, 2, 3], 0),
4196+ ([0, 1, 2, 3, complex(0, np.nan)], 4),
4197+ ([0, 1, 2, 3, complex(np.nan, 0)], 4),
4198+ ([0, 1, 2, complex(np.nan, 0), 3], 3),
4199+ ([0, 1, 2, complex(0, np.nan), 3], 3),
4200+ ([complex(0, np.nan), 0, 1, 2, 3], 0),
4201+ ([complex(np.nan, np.nan), 0, 1, 2, 3], 0),
4202+ ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, 1)], 0),
4203+ ([complex(np.nan, np.nan), complex(np.nan, 2), complex(np.nan, 1)], 0),
4204+ ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, np.nan)], 0),
4205+
4206+ ([complex(0, 0), complex(0, 2), complex(0, 1)], 0),
4207+ ([complex(1, 0), complex(0, 2), complex(0, 1)], 2),
4208+ ([complex(1, 0), complex(0, 2), complex(1, 1)], 1),
4209+
4210+ ([np.datetime64('1923-04-14T12:43:12'),
4211+ np.datetime64('1994-06-21T14:43:15'),
4212+ np.datetime64('2001-10-15T04:10:32'),
4213+ np.datetime64('1995-11-25T16:02:16'),
4214+ np.datetime64('2005-01-04T03:14:12'),
4215+ np.datetime64('2041-12-03T14:05:03')], 0),
4216+ ([np.datetime64('1935-09-14T04:40:11'),
4217+ np.datetime64('1949-10-12T12:32:11'),
4218+ np.datetime64('2010-01-03T05:14:12'),
4219+ np.datetime64('2014-11-20T12:20:59'),
4220+ np.datetime64('2015-09-23T10:10:13'),
4221+ np.datetime64('1932-10-10T03:50:30')], 5),
4222+ # Assorted tests with NaTs
4223+ ([np.datetime64('NaT'),
4224+ np.datetime64('NaT'),
4225+ np.datetime64('2010-01-03T05:14:12'),
4226+ np.datetime64('NaT'),
4227+ np.datetime64('2015-09-23T10:10:13'),
4228+ np.datetime64('1932-10-10T03:50:30')], 0),
4229+ ([np.datetime64('2059-03-14T12:43:12'),
4230+ np.datetime64('1996-09-21T14:43:15'),
4231+ np.datetime64('NaT'),
4232+ np.datetime64('2022-12-25T16:02:16'),
4233+ np.datetime64('1963-10-04T03:14:12'),
4234+ np.datetime64('2013-05-08T18:15:23')], 2),
4235+ ([np.timedelta64(2, 's'),
4236+ np.timedelta64(1, 's'),
4237+ np.timedelta64('NaT', 's'),
4238+ np.timedelta64(3, 's')], 2),
4239+ ([np.timedelta64('NaT', 's')] * 3, 0),
4240+
4241+ ([timedelta(days=5, seconds=14), timedelta(days=2, seconds=35),
4242+ timedelta(days=-1, seconds=23)], 2),
4243+ ([timedelta(days=1, seconds=43), timedelta(days=10, seconds=5),
4244+ timedelta(days=5, seconds=14)], 0),
4245+ ([timedelta(days=10, seconds=24), timedelta(days=10, seconds=5),
4246+ timedelta(days=10, seconds=43)], 1),
4247+
4248+ ([True, True, True, True, False], 4),
4249+ ([True, True, True, False, True], 3),
4250+ ([False, True, True, True, True], 0),
4251+ ([False, True, False, True, True], 0),
4252+ ]
4253+
4254+ def test_all(self):
4255+ a = np.random.normal(0, 1, (4, 5, 6, 7, 8))
4256+ for i in range(a.ndim):
4257+ amin = a.min(i)
4258+ aargmin = a.argmin(i)
4259+ axes = list(range(a.ndim))
4260+ axes.remove(i)
4261+ assert_(np.all(amin == aargmin.choose(*a.transpose(i,*axes))))
4262+
4263+ def test_combinations(self):
4264+ for arr, pos in self.nan_arr:
4265+ with suppress_warnings() as sup:
4266+ sup.filter(RuntimeWarning,
4267+ "invalid value encountered in reduce")
4268+ min_val = np.min(arr)
4269+
4270+ assert_equal(np.argmin(arr), pos, err_msg="%r" % arr)
4271+ assert_equal(arr[np.argmin(arr)], min_val, err_msg="%r" % arr)
4272+
4273+ def test_minimum_signed_integers(self):
4274+
4275+ a = np.array([1, -2**7, -2**7 + 1], dtype=np.int8)
4276+ assert_equal(np.argmin(a), 1)
4277+
4278+ a = np.array([1, -2**15, -2**15 + 1], dtype=np.int16)
4279+ assert_equal(np.argmin(a), 1)
4280+
4281+ a = np.array([1, -2**31, -2**31 + 1], dtype=np.int32)
4282+ assert_equal(np.argmin(a), 1)
4283+
4284+ a = np.array([1, -2**63, -2**63 + 1], dtype=np.int64)
4285+ assert_equal(np.argmin(a), 1)
4286+
4287+ def test_output_shape(self):
4288+ # see also gh-616
4289+ a = np.ones((10, 5))
4290+ # Check some simple shape mismatches
4291+ out = np.ones(11, dtype=np.int_)
4292+ assert_raises(ValueError, a.argmin, -1, out)
4293+
4294+ out = np.ones((2, 5), dtype=np.int_)
4295+ assert_raises(ValueError, a.argmin, -1, out)
4296+
4297+ # these could be relaxed possibly (used to allow even the previous)
4298+ out = np.ones((1, 10), dtype=np.int_)
4299+ assert_raises(ValueError, a.argmin, -1, out)
4300+
4301+ out = np.ones(10, dtype=np.int_)
4302+ a.argmin(-1, out=out)
4303+ assert_equal(out, a.argmin(-1))
4304+
4305+ def test_argmin_unicode(self):
4306+ d = np.ones(6031, dtype='<U9')
4307+ d[6001] = "0"
4308+ assert_equal(d.argmin(), 6001)
4309+
4310+ def test_np_vs_ndarray(self):
4311+ # make sure both ndarray.argmin and numpy.argmin support out/axis args
4312+ a = np.random.normal(size=(2, 3))
4313+
4314+ # check positional args
4315+ out1 = np.zeros(2, dtype=int)
4316+ out2 = np.ones(2, dtype=int)
4317+ assert_equal(a.argmin(1, out1), np.argmin(a, 1, out2))
4318+ assert_equal(out1, out2)
4319+
4320+ # check keyword args
4321+ out1 = np.zeros(3, dtype=int)
4322+ out2 = np.ones(3, dtype=int)
4323+ assert_equal(a.argmin(out=out1, axis=0), np.argmin(a, out=out2, axis=0))
4324+ assert_equal(out1, out2)
4325+
4326+ @pytest.mark.leaks_references(reason="replaces None with NULL.")
4327+ def test_object_argmin_with_NULLs(self):
4328+ # See gh-6032
4329+ a = np.empty(4, dtype='O')
4330+ ctypes.memset(a.ctypes.data, 0, a.nbytes)
4331+ assert_equal(a.argmin(), 0)
4332+ a[3] = 30
4333+ assert_equal(a.argmin(), 3)
4334+ a[1] = 10
4335+ assert_equal(a.argmin(), 1)
4336+
4337+
4338+class TestMinMax:
4339+
4340+ def test_scalar(self):
4341+ assert_raises(np.AxisError, np.amax, 1, 1)
4342+ assert_raises(np.AxisError, np.amin, 1, 1)
4343+
4344+ assert_equal(np.amax(1, axis=0), 1)
4345+ assert_equal(np.amin(1, axis=0), 1)
4346+ assert_equal(np.amax(1, axis=None), 1)
4347+ assert_equal(np.amin(1, axis=None), 1)
4348+
4349+ def test_axis(self):
4350+ assert_raises(np.AxisError, np.amax, [1, 2, 3], 1000)
4351+ assert_equal(np.amax([[1, 2, 3]], axis=1), 3)
4352+
4353+ def test_datetime(self):
4354+ # Do not ignore NaT
4355+ for dtype in ('m8[s]', 'm8[Y]'):
4356+ a = np.arange(10).astype(dtype)
4357+ assert_equal(np.amin(a), a[0])
4358+ assert_equal(np.amax(a), a[9])
4359+ a[3] = 'NaT'
4360+ assert_equal(np.amin(a), a[3])
4361+ assert_equal(np.amax(a), a[3])
4362+
4363+
4364+class TestNewaxis:
4365+ def test_basic(self):
4366+ sk = np.array([0, -0.1, 0.1])
4367+ res = 250*sk[:, np.newaxis]
4368+ assert_almost_equal(res.ravel(), 250*sk)
4369+
4370+
4371+class TestClip:
4372+ def _check_range(self, x, cmin, cmax):
4373+ assert_(np.all(x >= cmin))
4374+ assert_(np.all(x <= cmax))
4375+
4376+ def _clip_type(self, type_group, array_max,
4377+ clip_min, clip_max, inplace=False,
4378+ expected_min=None, expected_max=None):
4379+ if expected_min is None:
4380+ expected_min = clip_min
4381+ if expected_max is None:
4382+ expected_max = clip_max
4383+
4384+ for T in np.sctypes[type_group]:
4385+ if sys.byteorder == 'little':
4386+ byte_orders = ['=', '>']
4387+ else:
4388+ byte_orders = ['<', '=']
4389+
4390+ for byteorder in byte_orders:
4391+ dtype = np.dtype(T).newbyteorder(byteorder)
4392+
4393+ x = (np.random.random(1000) * array_max).astype(dtype)
4394+ if inplace:
4395+ # The tests that call us pass clip_min and clip_max that
4396+ # might not fit in the destination dtype. They were written
4397+ # assuming the previous unsafe casting, which now must be
4398+ # passed explicitly to avoid a warning.
4399+ x.clip(clip_min, clip_max, x, casting='unsafe')
4400+ else:
4401+ x = x.clip(clip_min, clip_max)
4402+ byteorder = '='
4403+
4404+ if x.dtype.byteorder == '|':
4405+ byteorder = '|'
4406+ assert_equal(x.dtype.byteorder, byteorder)
4407+ self._check_range(x, expected_min, expected_max)
4408+ return x
4409+
4410+ def test_basic(self):
4411+ for inplace in [False, True]:
4412+ self._clip_type(
4413+ 'float', 1024, -12.8, 100.2, inplace=inplace)
4414+ self._clip_type(
4415+ 'float', 1024, 0, 0, inplace=inplace)
4416+
4417+ self._clip_type(
4418+ 'int', 1024, -120, 100, inplace=inplace)
4419+ self._clip_type(
4420+ 'int', 1024, 0, 0, inplace=inplace)
4421+
4422+ self._clip_type(
4423+ 'uint', 1024, 0, 0, inplace=inplace)
4424+ self._clip_type(
4425+ 'uint', 1024, -120, 100, inplace=inplace, expected_min=0)
4426+
4427+ def test_record_array(self):
4428+ rec = np.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
4429+ dtype=[('x', '<f8'), ('y', '<f8'), ('z', '<f8')])
4430+ y = rec['x'].clip(-0.3, 0.5)
4431+ self._check_range(y, -0.3, 0.5)
4432+
4433+ def test_max_or_min(self):
4434+ val = np.array([0, 1, 2, 3, 4, 5, 6, 7])
4435+ x = val.clip(3)
4436+ assert_(np.all(x >= 3))
4437+ x = val.clip(min=3)
4438+ assert_(np.all(x >= 3))
4439+ x = val.clip(max=4)
4440+ assert_(np.all(x <= 4))
4441+
4442+ def test_nan(self):
4443+ input_arr = np.array([-2., np.nan, 0.5, 3., 0.25, np.nan])
4444+ result = input_arr.clip(-1, 1)
4445+ expected = np.array([-1., np.nan, 0.5, 1., 0.25, np.nan])
4446+ assert_array_equal(result, expected)
4447+
4448+
4449+class TestCompress:
4450+ def test_axis(self):
4451+ tgt = [[5, 6, 7, 8, 9]]
4452+ arr = np.arange(10).reshape(2, 5)
4453+ out = np.compress([0, 1], arr, axis=0)
4454+ assert_equal(out, tgt)
4455+
4456+ tgt = [[1, 3], [6, 8]]
4457+ out = np.compress([0, 1, 0, 1, 0], arr, axis=1)
4458+ assert_equal(out, tgt)
4459+
4460+ def test_truncate(self):
4461+ tgt = [[1], [6]]
4462+ arr = np.arange(10).reshape(2, 5)
4463+ out = np.compress([0, 1], arr, axis=1)
4464+ assert_equal(out, tgt)
4465+
4466+ def test_flatten(self):
4467+ arr = np.arange(10).reshape(2, 5)
4468+ out = np.compress([0, 1], arr)
4469+ assert_equal(out, 1)
4470+
4471+
4472+class TestPutmask:
4473+ def tst_basic(self, x, T, mask, val):
4474+ np.putmask(x, mask, val)
4475+ assert_equal(x[mask], np.array(val, T))
4476+
4477+ def test_ip_types(self):
4478+ unchecked_types = [bytes, str, np.void]
4479+
4480+ x = np.random.random(1000)*100
4481+ mask = x < 40
4482+
4483+ for val in [-100, 0, 15]:
4484+ for types in np.sctypes.values():
4485+ for T in types:
4486+ if T not in unchecked_types:
4487+ self.tst_basic(x.copy().astype(T), T, mask, val)
4488+
4489+ # Also test string of a length which uses an untypical length
4490+ dt = np.dtype("S3")
4491+ self.tst_basic(x.astype(dt), dt.type, mask, dt.type(val)[:3])
4492+
4493+ def test_mask_size(self):
4494+ assert_raises(ValueError, np.putmask, np.array([1, 2, 3]), [True], 5)
4495+
4496+ @pytest.mark.parametrize('dtype', ('>i4', '<i4'))
4497+ def test_byteorder(self, dtype):
4498+ x = np.array([1, 2, 3], dtype)
4499+ np.putmask(x, [True, False, True], -1)
4500+ assert_array_equal(x, [-1, 2, -1])
4501+
4502+ def test_record_array(self):
4503+ # Note mixed byteorder.
4504+ rec = np.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
4505+ dtype=[('x', '<f8'), ('y', '>f8'), ('z', '<f8')])
4506+ np.putmask(rec['x'], [True, False], 10)
4507+ assert_array_equal(rec['x'], [10, 5])
4508+ assert_array_equal(rec['y'], [2, 4])
4509+ assert_array_equal(rec['z'], [3, 3])
4510+ np.putmask(rec['y'], [True, False], 11)
4511+ assert_array_equal(rec['x'], [10, 5])
4512+ assert_array_equal(rec['y'], [11, 4])
4513+ assert_array_equal(rec['z'], [3, 3])
4514+
4515+ def test_overlaps(self):
4516+ # gh-6272 check overlap
4517+ x = np.array([True, False, True, False])
4518+ np.putmask(x[1:4], [True, True, True], x[:3])
4519+ assert_equal(x, np.array([True, True, False, True]))
4520+
4521+ x = np.array([True, False, True, False])
4522+ np.putmask(x[1:4], x[:3], [True, False, True])
4523+ assert_equal(x, np.array([True, True, True, True]))
4524+
4525+
4526+class TestTake:
4527+ def tst_basic(self, x):
4528+ ind = list(range(x.shape[0]))
4529+ assert_array_equal(x.take(ind, axis=0), x)
4530+
4531+ def test_ip_types(self):
4532+ unchecked_types = [bytes, str, np.void]
4533+
4534+ x = np.random.random(24)*100
4535+ x.shape = 2, 3, 4
4536+ for types in np.sctypes.values():
4537+ for T in types:
4538+ if T not in unchecked_types:
4539+ self.tst_basic(x.copy().astype(T))
4540+
4541+ # Also test string of a length which uses an untypical length
4542+ self.tst_basic(x.astype("S3"))
4543+
4544+ def test_raise(self):
4545+ x = np.random.random(24)*100
4546+ x.shape = 2, 3, 4
4547+ assert_raises(IndexError, x.take, [0, 1, 2], axis=0)
4548+ assert_raises(IndexError, x.take, [-3], axis=0)
4549+ assert_array_equal(x.take([-1], axis=0)[0], x[1])
4550+
4551+ def test_clip(self):
4552+ x = np.random.random(24)*100
4553+ x.shape = 2, 3, 4
4554+ assert_array_equal(x.take([-1], axis=0, mode='clip')[0], x[0])
4555+ assert_array_equal(x.take([2], axis=0, mode='clip')[0], x[1])
4556+
4557+ def test_wrap(self):
4558+ x = np.random.random(24)*100
4559+ x.shape = 2, 3, 4
4560+ assert_array_equal(x.take([-1], axis=0, mode='wrap')[0], x[1])
4561+ assert_array_equal(x.take([2], axis=0, mode='wrap')[0], x[0])
4562+ assert_array_equal(x.take([3], axis=0, mode='wrap')[0], x[1])
4563+
4564+ @pytest.mark.parametrize('dtype', ('>i4', '<i4'))
4565+ def test_byteorder(self, dtype):
4566+ x = np.array([1, 2, 3], dtype)
4567+ assert_array_equal(x.take([0, 2, 1]), [1, 3, 2])
4568+
4569+ def test_record_array(self):
4570+ # Note mixed byteorder.
4571+ rec = np.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
4572+ dtype=[('x', '<f8'), ('y', '>f8'), ('z', '<f8')])
4573+ rec1 = rec.take([1])
4574+ assert_(rec1['x'] == 5.0 and rec1['y'] == 4.0)
4575+
4576+ def test_out_overlap(self):
4577+ # gh-6272 check overlap on out
4578+ x = np.arange(5)
4579+ y = np.take(x, [1, 2, 3], out=x[2:5], mode='wrap')
4580+ assert_equal(y, np.array([1, 2, 3]))
4581+
4582+class TestLexsort:
4583+ @pytest.mark.parametrize('dtype',[
4584+ np.uint8, np.uint16, np.uint32, np.uint64,
4585+ np.int8, np.int16, np.int32, np.int64,
4586+ np.float16, np.float32, np.float64
4587+ ])
4588+ def test_basic(self, dtype):
4589+ a = np.array([1, 2, 1, 3, 1, 5], dtype=dtype)
4590+ b = np.array([0, 4, 5, 6, 2, 3], dtype=dtype)
4591+ idx = np.lexsort((b, a))
4592+ expected_idx = np.array([0, 4, 2, 1, 3, 5])
4593+ assert_array_equal(idx, expected_idx)
4594+ assert_array_equal(a[idx], np.sort(a))
4595+
4596+ def test_mixed(self):
4597+ a = np.array([1, 2, 1, 3, 1, 5])
4598+ b = np.array([0, 4, 5, 6, 2, 3], dtype='datetime64[D]')
4599+
4600+ idx = np.lexsort((b, a))
4601+ expected_idx = np.array([0, 4, 2, 1, 3, 5])
4602+ assert_array_equal(idx, expected_idx)
4603+
4604+ def test_datetime(self):
4605+ a = np.array([0,0,0], dtype='datetime64[D]')
4606+ b = np.array([2,1,0], dtype='datetime64[D]')
4607+ idx = np.lexsort((b, a))
4608+ expected_idx = np.array([2, 1, 0])
4609+ assert_array_equal(idx, expected_idx)
4610+
4611+ a = np.array([0,0,0], dtype='timedelta64[D]')
4612+ b = np.array([2,1,0], dtype='timedelta64[D]')
4613+ idx = np.lexsort((b, a))
4614+ expected_idx = np.array([2, 1, 0])
4615+ assert_array_equal(idx, expected_idx)
4616+
4617+ def test_object(self): # gh-6312
4618+ a = np.random.choice(10, 1000)
4619+ b = np.random.choice(['abc', 'xy', 'wz', 'efghi', 'qwst', 'x'], 1000)
4620+
4621+ for u in a, b:
4622+ left = np.lexsort((u.astype('O'),))
4623+ right = np.argsort(u, kind='mergesort')
4624+ assert_array_equal(left, right)
4625+
4626+ for u, v in (a, b), (b, a):
4627+ idx = np.lexsort((u, v))
4628+ assert_array_equal(idx, np.lexsort((u.astype('O'), v)))
4629+ assert_array_equal(idx, np.lexsort((u, v.astype('O'))))
4630+ u, v = np.array(u, dtype='object'), np.array(v, dtype='object')
4631+ assert_array_equal(idx, np.lexsort((u, v)))
4632+
4633+ def test_invalid_axis(self): # gh-7528
4634+ x = np.linspace(0., 1., 42*3).reshape(42, 3)
4635+ assert_raises(np.AxisError, np.lexsort, x, axis=2)
4636+
4637+class TestIO:
4638+ """Test tofile, fromfile, tobytes, and fromstring"""
4639+
4640+ def setup(self):
4641+ shape = (2, 4, 3)
4642+ rand = np.random.random
4643+ self.x = rand(shape) + rand(shape).astype(complex)*1j
4644+ self.x[0,:, 1] = [np.nan, np.inf, -np.inf, np.nan]
4645+ self.dtype = self.x.dtype
4646+ self.tempdir = tempfile.mkdtemp()
4647+ self.filename = tempfile.mktemp(dir=self.tempdir)
4648+
4649+ def teardown(self):
4650+ shutil.rmtree(self.tempdir)
4651+
4652+ def test_nofile(self):
4653+ # this should probably be supported as a file
4654+ # but for now test for proper errors
4655+ b = io.BytesIO()
4656+ assert_raises(IOError, np.fromfile, b, np.uint8, 80)
4657+ d = np.ones(7)
4658+ assert_raises(IOError, lambda x: x.tofile(b), d)
4659+
4660+ def test_bool_fromstring(self):
4661+ v = np.array([True, False, True, False], dtype=np.bool_)
4662+ y = np.fromstring('1 0 -2.3 0.0', sep=' ', dtype=np.bool_)
4663+ assert_array_equal(v, y)
4664+
4665+ def test_uint64_fromstring(self):
4666+ d = np.fromstring("9923372036854775807 104783749223640",
4667+ dtype=np.uint64, sep=' ')
4668+ e = np.array([9923372036854775807, 104783749223640], dtype=np.uint64)
4669+ assert_array_equal(d, e)
4670+
4671+ def test_int64_fromstring(self):
4672+ d = np.fromstring("-25041670086757 104783749223640",
4673+ dtype=np.int64, sep=' ')
4674+ e = np.array([-25041670086757, 104783749223640], dtype=np.int64)
4675+ assert_array_equal(d, e)
4676+
4677+ def test_empty_files_binary(self):
4678+ with open(self.filename, 'w') as f:
4679+ pass
4680+ y = np.fromfile(self.filename)
4681+ assert_(y.size == 0, "Array not empty")
4682+
4683+ def test_empty_files_text(self):
4684+ with open(self.filename, 'wb') as f:
4685+ pass
4686+ y = np.fromfile(self.filename, sep=" ")
4687+ assert_(y.size == 0, "Array not empty")
4688+
4689+ def test_roundtrip_file(self):
4690+ with open(self.filename, 'wb') as f:
4691+ self.x.tofile(f)
4692+ # NB. doesn't work with flush+seek, due to use of C stdio
4693+ with open(self.filename, 'rb') as f:
4694+ y = np.fromfile(f, dtype=self.dtype)
4695+ assert_array_equal(y, self.x.flat)
4696+
4697+ def test_roundtrip_filename(self):
4698+ self.x.tofile(self.filename)
4699+ y = np.fromfile(self.filename, dtype=self.dtype)
4700+ assert_array_equal(y, self.x.flat)
4701+
4702+ def test_roundtrip_pathlib(self):
4703+ p = pathlib.Path(self.filename)
4704+ self.x.tofile(p)
4705+ y = np.fromfile(p, dtype=self.dtype)
4706+ assert_array_equal(y, self.x.flat)
4707+
4708+ def test_roundtrip_dump_pathlib(self):
4709+ p = pathlib.Path(self.filename)
4710+ self.x.dump(p)
4711+ y = np.load(p, allow_pickle=True)
4712+ assert_array_equal(y, self.x)
4713+
4714+ def test_roundtrip_binary_str(self):
4715+ s = self.x.tobytes()
4716+ y = np.frombuffer(s, dtype=self.dtype)
4717+ assert_array_equal(y, self.x.flat)
4718+
4719+ s = self.x.tobytes('F')
4720+ y = np.frombuffer(s, dtype=self.dtype)
4721+ assert_array_equal(y, self.x.flatten('F'))
4722+
4723+ def test_roundtrip_str(self):
4724+ x = self.x.real.ravel()
4725+ s = "@".join(map(str, x))
4726+ y = np.fromstring(s, sep="@")
4727+ # NB. str imbues less precision
4728+ nan_mask = ~np.isfinite(x)
4729+ assert_array_equal(x[nan_mask], y[nan_mask])
4730+ assert_array_almost_equal(x[~nan_mask], y[~nan_mask], decimal=5)
4731+
4732+ def test_roundtrip_repr(self):
4733+ x = self.x.real.ravel()
4734+ s = "@".join(map(repr, x))
4735+ y = np.fromstring(s, sep="@")
4736+ assert_array_equal(x, y)
4737+
4738+ def test_unseekable_fromfile(self):
4739+ # gh-6246
4740+ self.x.tofile(self.filename)
4741+
4742+ def fail(*args, **kwargs):
4743+ raise IOError('Can not tell or seek')
4744+
4745+ with io.open(self.filename, 'rb', buffering=0) as f:
4746+ f.seek = fail
4747+ f.tell = fail
4748+ assert_raises(IOError, np.fromfile, f, dtype=self.dtype)
4749+
4750+ def test_io_open_unbuffered_fromfile(self):
4751+ # gh-6632
4752+ self.x.tofile(self.filename)
4753+ with io.open(self.filename, 'rb', buffering=0) as f:
4754+ y = np.fromfile(f, dtype=self.dtype)
4755+ assert_array_equal(y, self.x.flat)
4756+
4757+ def test_largish_file(self):
4758+ # check the fallocate path on files > 16MB
4759+ d = np.zeros(4 * 1024 ** 2)
4760+ d.tofile(self.filename)
4761+ assert_equal(os.path.getsize(self.filename), d.nbytes)
4762+ assert_array_equal(d, np.fromfile(self.filename))
4763+ # check offset
4764+ with open(self.filename, "r+b") as f:
4765+ f.seek(d.nbytes)
4766+ d.tofile(f)
4767+ assert_equal(os.path.getsize(self.filename), d.nbytes * 2)
4768+ # check append mode (gh-8329)
4769+ open(self.filename, "w").close() # delete file contents
4770+ with open(self.filename, "ab") as f:
4771+ d.tofile(f)
4772+ assert_array_equal(d, np.fromfile(self.filename))
4773+ with open(self.filename, "ab") as f:
4774+ d.tofile(f)
4775+ assert_equal(os.path.getsize(self.filename), d.nbytes * 2)
4776+
4777+ def test_io_open_buffered_fromfile(self):
4778+ # gh-6632
4779+ self.x.tofile(self.filename)
4780+ with io.open(self.filename, 'rb', buffering=-1) as f:
4781+ y = np.fromfile(f, dtype=self.dtype)
4782+ assert_array_equal(y, self.x.flat)
4783+
4784+ def test_file_position_after_fromfile(self):
4785+ # gh-4118
4786+ sizes = [io.DEFAULT_BUFFER_SIZE//8,
4787+ io.DEFAULT_BUFFER_SIZE,
4788+ io.DEFAULT_BUFFER_SIZE*8]
4789+
4790+ for size in sizes:
4791+ with open(self.filename, 'wb') as f:
4792+ f.seek(size-1)
4793+ f.write(b'\0')
4794+
4795+ for mode in ['rb', 'r+b']:
4796+ err_msg = "%d %s" % (size, mode)
4797+
4798+ with open(self.filename, mode) as f:
4799+ f.read(2)
4800+ np.fromfile(f, dtype=np.float64, count=1)
4801+ pos = f.tell()
4802+ assert_equal(pos, 10, err_msg=err_msg)
4803+
4804+ def test_file_position_after_tofile(self):
4805+ # gh-4118
4806+ sizes = [io.DEFAULT_BUFFER_SIZE//8,
4807+ io.DEFAULT_BUFFER_SIZE,
4808+ io.DEFAULT_BUFFER_SIZE*8]
4809+
4810+ for size in sizes:
4811+ err_msg = "%d" % (size,)
4812+
4813+ with open(self.filename, 'wb') as f:
4814+ f.seek(size-1)
4815+ f.write(b'\0')
4816+ f.seek(10)
4817+ f.write(b'12')
4818+ np.array([0], dtype=np.float64).tofile(f)
4819+ pos = f.tell()
4820+ assert_equal(pos, 10 + 2 + 8, err_msg=err_msg)
4821+
4822+ with open(self.filename, 'r+b') as f:
4823+ f.read(2)
4824+ f.seek(0, 1) # seek between read&write required by ANSI C
4825+ np.array([0], dtype=np.float64).tofile(f)
4826+ pos = f.tell()
4827+ assert_equal(pos, 10, err_msg=err_msg)
4828+
4829+ def test_load_object_array_fromfile(self):
4830+ # gh-12300
4831+ with open(self.filename, 'w') as f:
4832+ # Ensure we have a file with consistent contents
4833+ pass
4834+
4835+ with open(self.filename, 'rb') as f:
4836+ assert_raises_regex(ValueError, "Cannot read into object array",
4837+ np.fromfile, f, dtype=object)
4838+
4839+ assert_raises_regex(ValueError, "Cannot read into object array",
4840+ np.fromfile, self.filename, dtype=object)
4841+
4842+ def test_fromfile_offset(self):
4843+ with open(self.filename, 'wb') as f:
4844+ self.x.tofile(f)
4845+
4846+ with open(self.filename, 'rb') as f:
4847+ y = np.fromfile(f, dtype=self.dtype, offset=0)
4848+ assert_array_equal(y, self.x.flat)
4849+
4850+ with open(self.filename, 'rb') as f:
4851+ count_items = len(self.x.flat) // 8
4852+ offset_items = len(self.x.flat) // 4
4853+ offset_bytes = self.dtype.itemsize * offset_items
4854+ y = np.fromfile(f, dtype=self.dtype, count=count_items, offset=offset_bytes)
4855+ assert_array_equal(y, self.x.flat[offset_items:offset_items+count_items])
4856+
4857+ # subsequent seeks should stack
4858+ offset_bytes = self.dtype.itemsize
4859+ z = np.fromfile(f, dtype=self.dtype, offset=offset_bytes)
4860+ assert_array_equal(z, self.x.flat[offset_items+count_items+1:])
4861+
4862+ with open(self.filename, 'wb') as f:
4863+ self.x.tofile(f, sep=",")
4864+
4865+ with open(self.filename, 'rb') as f:
4866+ assert_raises_regex(
4867+ TypeError,
4868+ "'offset' argument only permitted for binary files",
4869+ np.fromfile, self.filename, dtype=self.dtype,
4870+ sep=",", offset=1)
4871+
4872+ def _check_from(self, s, value, **kw):
4873+ if 'sep' not in kw:
4874+ y = np.frombuffer(s, **kw)
4875+ else:
4876+ y = np.fromstring(s, **kw)
4877+ assert_array_equal(y, value)
4878+
4879+ with open(self.filename, 'wb') as f:
4880+ f.write(s)
4881+ y = np.fromfile(self.filename, **kw)
4882+ assert_array_equal(y, value)
4883+
4884+ def test_nan(self):
4885+ self._check_from(
4886+ b"nan +nan -nan NaN nan(foo) +NaN(BAR) -NAN(q_u_u_x_)",
4887+ [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
4888+ sep=' ')
4889+
4890+ def test_inf(self):
4891+ self._check_from(
4892+ b"inf +inf -inf infinity -Infinity iNfInItY -inF",
4893+ [np.inf, np.inf, -np.inf, np.inf, -np.inf, np.inf, -np.inf],
4894+ sep=' ')
4895+
4896+ def test_numbers(self):
4897+ self._check_from(b"1.234 -1.234 .3 .3e55 -123133.1231e+133",
4898+ [1.234, -1.234, .3, .3e55, -123133.1231e+133], sep=' ')
4899+
4900+ def test_binary(self):
4901+ self._check_from(b'\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@',
4902+ np.array([1, 2, 3, 4]),
4903+ dtype='<f4')
4904+
4905+ @pytest.mark.slow # takes > 1 minute on mechanical hard drive
4906+ def test_big_binary(self):
4907+ """Test workarounds for 32-bit limited fwrite, fseek, and ftell
4908+ calls in windows. These normally would hang doing something like this.
4909+ See http://projects.scipy.org/numpy/ticket/1660"""
4910+ if sys.platform != 'win32':
4911+ return
4912+ try:
4913+ # before workarounds, only up to 2**32-1 worked
4914+ fourgbplus = 2**32 + 2**16
4915+ testbytes = np.arange(8, dtype=np.int8)
4916+ n = len(testbytes)
4917+ flike = tempfile.NamedTemporaryFile()
4918+ f = flike.file
4919+ np.tile(testbytes, fourgbplus // testbytes.nbytes).tofile(f)
4920+ flike.seek(0)
4921+ a = np.fromfile(f, dtype=np.int8)
4922+ flike.close()
4923+ assert_(len(a) == fourgbplus)
4924+ # check only start and end for speed:
4925+ assert_((a[:n] == testbytes).all())
4926+ assert_((a[-n:] == testbytes).all())
4927+ except (MemoryError, ValueError):
4928+ pass
4929+
4930+ def test_string(self):
4931+ self._check_from(b'1,2,3,4', [1., 2., 3., 4.], sep=',')
4932+
4933+ def test_counted_string(self):
4934+ self._check_from(b'1,2,3,4', [1., 2., 3., 4.], count=4, sep=',')
4935+ self._check_from(b'1,2,3,4', [1., 2., 3.], count=3, sep=',')
4936+ self._check_from(b'1,2,3,4', [1., 2., 3., 4.], count=-1, sep=',')
4937+
4938+ def test_string_with_ws(self):
4939+ self._check_from(b'1 2 3 4 ', [1, 2, 3, 4], dtype=int, sep=' ')
4940+
4941+ def test_counted_string_with_ws(self):
4942+ self._check_from(b'1 2 3 4 ', [1, 2, 3], count=3, dtype=int,
4943+ sep=' ')
4944+
4945+ def test_ascii(self):
4946+ self._check_from(b'1 , 2 , 3 , 4', [1., 2., 3., 4.], sep=',')
4947+ self._check_from(b'1,2,3,4', [1., 2., 3., 4.], dtype=float, sep=',')
4948+
4949+ def test_malformed(self):
4950+ with assert_warns(DeprecationWarning):
4951+ self._check_from(b'1.234 1,234', [1.234, 1.], sep=' ')
4952+
4953+ def test_long_sep(self):
4954+ self._check_from(b'1_x_3_x_4_x_5', [1, 3, 4, 5], sep='_x_')
4955+
4956+ def test_dtype(self):
4957+ v = np.array([1, 2, 3, 4], dtype=np.int_)
4958+ self._check_from(b'1,2,3,4', v, sep=',', dtype=np.int_)
4959+
4960+ def test_dtype_bool(self):
4961+ # can't use _check_from because fromstring can't handle True/False
4962+ v = np.array([True, False, True, False], dtype=np.bool_)
4963+ s = b'1,0,-2.3,0'
4964+ with open(self.filename, 'wb') as f:
4965+ f.write(s)
4966+ y = np.fromfile(self.filename, sep=',', dtype=np.bool_)
4967+ assert_(y.dtype == '?')
4968+ assert_array_equal(y, v)
4969+
4970+ def test_tofile_sep(self):
4971+ x = np.array([1.51, 2, 3.51, 4], dtype=float)
4972+ with open(self.filename, 'w') as f:
4973+ x.tofile(f, sep=',')
4974+ with open(self.filename, 'r') as f:
4975+ s = f.read()
4976+ #assert_equal(s, '1.51,2.0,3.51,4.0')
4977+ y = np.array([float(p) for p in s.split(',')])
4978+ assert_array_equal(x,y)
4979+
4980+ def test_tofile_format(self):
4981+ x = np.array([1.51, 2, 3.51, 4], dtype=float)
4982+ with open(self.filename, 'w') as f:
4983+ x.tofile(f, sep=',', format='%.2f')
4984+ with open(self.filename, 'r') as f:
4985+ s = f.read()
4986+ assert_equal(s, '1.51,2.00,3.51,4.00')
4987+
4988+ def test_locale(self):
4989+ with CommaDecimalPointLocale():
4990+ self.test_numbers()
4991+ self.test_nan()
4992+ self.test_inf()
4993+ self.test_counted_string()
4994+ self.test_ascii()
4995+ self.test_malformed()
4996+ self.test_tofile_sep()
4997+ self.test_tofile_format()
4998+
4999+ def test_fromfile_subarray_binary(self):
5000+ # Test subarray dtypes which are absorbed into the shape
5001+ x = np.arange(24, dtype="i4").reshape(2, 3, 4)
5002+ x.tofile(self.filename)
5003+ res = np.fromfile(self.filename, dtype="(3,4)i4")
5004+ assert_array_equal(x, res)
5005+
5006+ x_str = x.tobytes()
5007+ with assert_warns(DeprecationWarning):
5008+ # binary fromstring is deprecated
5009+ res = np.fromstring(x_str, dtype="(3,4)i4")
5010+ assert_array_equal(x, res)
5011+
5012+
5013+class TestFromBuffer:
5014+ @pytest.mark.parametrize('byteorder', ['<', '>'])
5015+ @pytest.mark.parametrize('dtype', [float, int, complex])
5016+ def test_basic(self, byteorder, dtype):
5017+ dt = np.dtype(dtype).newbyteorder(byteorder)
5018+ x = (np.random.random((4, 7)) * 5).astype(dt)
5019+ buf = x.tobytes()
5020+ assert_array_equal(np.frombuffer(buf, dtype=dt), x.flat)
5021+
5022+ def test_empty(self):
5023+ assert_array_equal(np.frombuffer(b''), np.array([]))
5024+
5025+
5026+class TestFlat:
5027+ def setup(self):
5028+ a0 = np.arange(20.0)
5029+ a = a0.reshape(4, 5)
5030+ a0.shape = (4, 5)
5031+ a.flags.writeable = False
5032+ self.a = a
5033+ self.b = a[::2, ::2]
5034+ self.a0 = a0
5035+ self.b0 = a0[::2, ::2]
5036+
5037+ def test_contiguous(self):
5038+ testpassed = False
5039+ try:
5040+ self.a.flat[12] = 100.0
5041+ except ValueError:
5042+ testpassed = True
5043+ assert_(testpassed)
5044+ assert_(self.a.flat[12] == 12.0)
5045+
5046+ def test_discontiguous(self):
5047+ testpassed = False
5048+ try:
5049+ self.b.flat[4] = 100.0
5050+ except ValueError:
5051+ testpassed = True
5052+ assert_(testpassed)
5053+ assert_(self.b.flat[4] == 12.0)
5054+
5055+ def test___array__(self):
5056+ c = self.a.flat.__array__()
5057+ d = self.b.flat.__array__()
5058+ e = self.a0.flat.__array__()
5059+ f = self.b0.flat.__array__()
5060+
5061+ assert_(c.flags.writeable is False)
5062+ assert_(d.flags.writeable is False)
5063+ # for 1.14 all are set to non-writeable on the way to replacing the
5064+ # UPDATEIFCOPY array returned for non-contiguous arrays.
5065+ assert_(e.flags.writeable is True)
5066+ assert_(f.flags.writeable is False)
5067+ with assert_warns(DeprecationWarning):
5068+ assert_(c.flags.updateifcopy is False)
5069+ with assert_warns(DeprecationWarning):
5070+ assert_(d.flags.updateifcopy is False)
5071+ with assert_warns(DeprecationWarning):
5072+ assert_(e.flags.updateifcopy is False)
5073+ with assert_warns(DeprecationWarning):
5074+ # UPDATEIFCOPY is removed.
5075+ assert_(f.flags.updateifcopy is False)
5076+ assert_(c.flags.writebackifcopy is False)
5077+ assert_(d.flags.writebackifcopy is False)
5078+ assert_(e.flags.writebackifcopy is False)
5079+ assert_(f.flags.writebackifcopy is False)
5080+
5081+ @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
5082+ def test_refcount(self):
5083+ # includes regression test for reference count error gh-13165
5084+ inds = [np.intp(0), np.array([True]*self.a.size), np.array([0]), None]
5085+ indtype = np.dtype(np.intp)
5086+ rc_indtype = sys.getrefcount(indtype)
5087+ for ind in inds:
5088+ rc_ind = sys.getrefcount(ind)
5089+ for _ in range(100):
5090+ try:
5091+ self.a.flat[ind]
5092+ except IndexError:
5093+ pass
5094+ assert_(abs(sys.getrefcount(ind) - rc_ind) < 50)
5095+ assert_(abs(sys.getrefcount(indtype) - rc_indtype) < 50)
5096+
5097+
5098+class TestResize:
5099+
5100+ @_no_tracing
5101+ def test_basic(self):
5102+ x = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
5103+ if IS_PYPY:
5104+ x.resize((5, 5), refcheck=False)
5105+ else:
5106+ x.resize((5, 5))
5107+ assert_array_equal(x.flat[:9],
5108+ np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]).flat)
5109+ assert_array_equal(x[9:].flat, 0)
5110+
5111+ def test_check_reference(self):
5112+ x = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
5113+ y = x
5114+ assert_raises(ValueError, x.resize, (5, 1))
5115+ del y # avoid pyflakes unused variable warning.
5116+
5117+ @_no_tracing
5118+ def test_int_shape(self):
5119+ x = np.eye(3)
5120+ if IS_PYPY:
5121+ x.resize(3, refcheck=False)
5122+ else:
5123+ x.resize(3)
5124+ assert_array_equal(x, np.eye(3)[0,:])
5125+
5126+ def test_none_shape(self):
5127+ x = np.eye(3)
5128+ x.resize(None)
5129+ assert_array_equal(x, np.eye(3))
5130+ x.resize()
5131+ assert_array_equal(x, np.eye(3))
5132+
5133+ def test_0d_shape(self):
5134+ # to it multiple times to test it does not break alloc cache gh-9216
5135+ for i in range(10):
5136+ x = np.empty((1,))
5137+ x.resize(())
5138+ assert_equal(x.shape, ())
5139+ assert_equal(x.size, 1)
5140+ x = np.empty(())
5141+ x.resize((1,))
5142+ assert_equal(x.shape, (1,))
5143+ assert_equal(x.size, 1)
5144+
5145+ def test_invalid_arguments(self):
5146+ assert_raises(TypeError, np.eye(3).resize, 'hi')
5147+ assert_raises(ValueError, np.eye(3).resize, -1)
5148+ assert_raises(TypeError, np.eye(3).resize, order=1)
5149+ assert_raises(TypeError, np.eye(3).resize, refcheck='hi')
5150+
5151+ @_no_tracing
5152+ def test_freeform_shape(self):
5153+ x = np.eye(3)
5154+ if IS_PYPY:
5155+ x.resize(3, 2, 1, refcheck=False)
5156+ else:
5157+ x.resize(3, 2, 1)
5158+ assert_(x.shape == (3, 2, 1))
5159+
5160+ @_no_tracing
5161+ def test_zeros_appended(self):
5162+ x = np.eye(3)
5163+ if IS_PYPY:
5164+ x.resize(2, 3, 3, refcheck=False)
5165+ else:
5166+ x.resize(2, 3, 3)
5167+ assert_array_equal(x[0], np.eye(3))
5168+ assert_array_equal(x[1], np.zeros((3, 3)))
5169+
5170+ @_no_tracing
5171+ def test_obj_obj(self):
5172+ # check memory is initialized on resize, gh-4857
5173+ a = np.ones(10, dtype=[('k', object, 2)])
5174+ if IS_PYPY:
5175+ a.resize(15, refcheck=False)
5176+ else:
5177+ a.resize(15,)
5178+ assert_equal(a.shape, (15,))
5179+ assert_array_equal(a['k'][-5:], 0)
5180+ assert_array_equal(a['k'][:-5], 1)
5181+
5182+ def test_empty_view(self):
5183+ # check that sizes containing a zero don't trigger a reallocate for
5184+ # already empty arrays
5185+ x = np.zeros((10, 0), int)
5186+ x_view = x[...]
5187+ x_view.resize((0, 10))
5188+ x_view.resize((0, 100))
5189+
5190+ def test_check_weakref(self):
5191+ x = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
5192+ xref = weakref.ref(x)
5193+ assert_raises(ValueError, x.resize, (5, 1))
5194+ del xref # avoid pyflakes unused variable warning.
5195+
5196+
5197+class TestRecord:
5198+ def test_field_rename(self):
5199+ dt = np.dtype([('f', float), ('i', int)])
5200+ dt.names = ['p', 'q']
5201+ assert_equal(dt.names, ['p', 'q'])
5202+
5203+ def test_multiple_field_name_occurrence(self):
5204+ def test_dtype_init():
5205+ np.dtype([("A", "f8"), ("B", "f8"), ("A", "f8")])
5206+
5207+ # Error raised when multiple fields have the same name
5208+ assert_raises(ValueError, test_dtype_init)
5209+
5210+ def test_bytes_fields(self):
5211+ # Bytes are not allowed in field names and not recognized in titles
5212+ # on Py3
5213+ assert_raises(TypeError, np.dtype, [(b'a', int)])
5214+ assert_raises(TypeError, np.dtype, [(('b', b'a'), int)])
5215+
5216+ dt = np.dtype([((b'a', 'b'), int)])
5217+ assert_raises(TypeError, dt.__getitem__, b'a')
5218+
5219+ x = np.array([(1,), (2,), (3,)], dtype=dt)
5220+ assert_raises(IndexError, x.__getitem__, b'a')
5221+
5222+ y = x[0]
5223+ assert_raises(IndexError, y.__getitem__, b'a')
5224+
5225+ def test_multiple_field_name_unicode(self):
5226+ def test_dtype_unicode():
5227+ np.dtype([("\u20B9", "f8"), ("B", "f8"), ("\u20B9", "f8")])
5228+
5229+ # Error raised when multiple fields have the same name(unicode included)
5230+ assert_raises(ValueError, test_dtype_unicode)
5231+
5232+ def test_fromarrays_unicode(self):
5233+ # A single name string provided to fromarrays() is allowed to be unicode
5234+ # on both Python 2 and 3:
5235+ x = np.core.records.fromarrays([[0], [1]], names=u'a,b', formats=u'i4,i4')
5236+ assert_equal(x['a'][0], 0)
5237+ assert_equal(x['b'][0], 1)
5238+
5239+ def test_unicode_order(self):
5240+ # Test that we can sort with order as a unicode field name in both Python 2 and
5241+ # 3:
5242+ name = u'b'
5243+ x = np.array([1, 3, 2], dtype=[(name, int)])
5244+ x.sort(order=name)
5245+ assert_equal(x[u'b'], np.array([1, 2, 3]))
5246+
5247+ def test_field_names(self):
5248+ # Test unicode and 8-bit / byte strings can be used
5249+ a = np.zeros((1,), dtype=[('f1', 'i4'),
5250+ ('f2', 'i4'),
5251+ ('f3', [('sf1', 'i4')])])
5252+ # byte string indexing fails gracefully
5253+ assert_raises(IndexError, a.__setitem__, b'f1', 1)
5254+ assert_raises(IndexError, a.__getitem__, b'f1')
5255+ assert_raises(IndexError, a['f1'].__setitem__, b'sf1', 1)
5256+ assert_raises(IndexError, a['f1'].__getitem__, b'sf1')
5257+ b = a.copy()
5258+ fn1 = str('f1')
5259+ b[fn1] = 1
5260+ assert_equal(b[fn1], 1)
5261+ fnn = str('not at all')
5262+ assert_raises(ValueError, b.__setitem__, fnn, 1)
5263+ assert_raises(ValueError, b.__getitem__, fnn)
5264+ b[0][fn1] = 2
5265+ assert_equal(b[fn1], 2)
5266+ # Subfield
5267+ assert_raises(ValueError, b[0].__setitem__, fnn, 1)
5268+ assert_raises(ValueError, b[0].__getitem__, fnn)
5269+ # Subfield
5270+ fn3 = str('f3')
5271+ sfn1 = str('sf1')
5272+ b[fn3][sfn1] = 1
5273+ assert_equal(b[fn3][sfn1], 1)
5274+ assert_raises(ValueError, b[fn3].__setitem__, fnn, 1)
5275+ assert_raises(ValueError, b[fn3].__getitem__, fnn)
5276+ # multiple subfields
5277+ fn2 = str('f2')
5278+ b[fn2] = 3
5279+
5280+ assert_equal(b[['f1', 'f2']][0].tolist(), (2, 3))
5281+ assert_equal(b[['f2', 'f1']][0].tolist(), (3, 2))
5282+ assert_equal(b[['f1', 'f3']][0].tolist(), (2, (1,)))
5283+
5284+ # non-ascii unicode field indexing is well behaved
5285+ assert_raises(ValueError, a.__setitem__, u'\u03e0', 1)
5286+ assert_raises(ValueError, a.__getitem__, u'\u03e0')
5287+
5288+ def test_record_hash(self):
5289+ a = np.array([(1, 2), (1, 2)], dtype='i1,i2')
5290+ a.flags.writeable = False
5291+ b = np.array([(1, 2), (3, 4)], dtype=[('num1', 'i1'), ('num2', 'i2')])
5292+ b.flags.writeable = False
5293+ c = np.array([(1, 2), (3, 4)], dtype='i1,i2')
5294+ c.flags.writeable = False
5295+ assert_(hash(a[0]) == hash(a[1]))
5296+ assert_(hash(a[0]) == hash(b[0]))
5297+ assert_(hash(a[0]) != hash(b[1]))
5298+ assert_(hash(c[0]) == hash(a[0]) and c[0] == a[0])
5299+
5300+ def test_record_no_hash(self):
5301+ a = np.array([(1, 2), (1, 2)], dtype='i1,i2')
5302+ assert_raises(TypeError, hash, a[0])
5303+
5304+ def test_empty_structure_creation(self):
5305+ # make sure these do not raise errors (gh-5631)
5306+ np.array([()], dtype={'names': [], 'formats': [],
5307+ 'offsets': [], 'itemsize': 12})
5308+ np.array([(), (), (), (), ()], dtype={'names': [], 'formats': [],
5309+ 'offsets': [], 'itemsize': 12})
5310+
5311+ def test_multifield_indexing_view(self):
5312+ a = np.ones(3, dtype=[('a', 'i4'), ('b', 'f4'), ('c', 'u4')])
5313+ v = a[['a', 'c']]
5314+ assert_(v.base is a)
5315+ assert_(v.dtype == np.dtype({'names': ['a', 'c'],
5316+ 'formats': ['i4', 'u4'],
5317+ 'offsets': [0, 8]}))
5318+ v[:] = (4,5)
5319+ assert_equal(a[0].item(), (4, 1, 5))
5320+
5321+class TestView:
5322+ def test_basic(self):
5323+ x = np.array([(1, 2, 3, 4), (5, 6, 7, 8)],
5324+ dtype=[('r', np.int8), ('g', np.int8),
5325+ ('b', np.int8), ('a', np.int8)])
5326+ # We must be specific about the endianness here:
5327+ y = x.view(dtype='<i4')
5328+ # ... and again without the keyword.
5329+ z = x.view('<i4')
5330+ assert_array_equal(y, z)
5331+ assert_array_equal(y, [67305985, 134678021])
5332+
5333+
5334+def _mean(a, **args):
5335+ return a.mean(**args)
5336+
5337+
5338+def _var(a, **args):
5339+ return a.var(**args)
5340+
5341+
5342+def _std(a, **args):
5343+ return a.std(**args)
5344+
5345+
5346+class TestStats:
5347+
5348+ funcs = [_mean, _var, _std]
5349+
5350+ def setup(self):
5351+ np.random.seed(range(3))
5352+ self.rmat = np.random.random((4, 5))
5353+ self.cmat = self.rmat + 1j * self.rmat
5354+ self.omat = np.array([Decimal(repr(r)) for r in self.rmat.flat])
5355+ self.omat = self.omat.reshape(4, 5)
5356+
5357+ def test_python_type(self):
5358+ for x in (np.float16(1.), 1, 1., 1+0j):
5359+ assert_equal(np.mean([x]), 1.)
5360+ assert_equal(np.std([x]), 0.)
5361+ assert_equal(np.var([x]), 0.)
5362+
5363+ def test_keepdims(self):
5364+ mat = np.eye(3)
5365+ for f in self.funcs:
5366+ for axis in [0, 1]:
5367+ res = f(mat, axis=axis, keepdims=True)
5368+ assert_(res.ndim == mat.ndim)
5369+ assert_(res.shape[axis] == 1)
5370+ for axis in [None]:
5371+ res = f(mat, axis=axis, keepdims=True)
5372+ assert_(res.shape == (1, 1))
5373+
5374+ def test_out(self):
5375+ mat = np.eye(3)
5376+ for f in self.funcs:
5377+ out = np.zeros(3)
5378+ tgt = f(mat, axis=1)
5379+ res = f(mat, axis=1, out=out)
5380+ assert_almost_equal(res, out)
5381+ assert_almost_equal(res, tgt)
5382+ out = np.empty(2)
5383+ assert_raises(ValueError, f, mat, axis=1, out=out)
5384+ out = np.empty((2, 2))
5385+ assert_raises(ValueError, f, mat, axis=1, out=out)
5386+
5387+ def test_dtype_from_input(self):
5388+
5389+ icodes = np.typecodes['AllInteger']
5390+ fcodes = np.typecodes['AllFloat']
5391+
5392+ # object type
5393+ for f in self.funcs:
5394+ mat = np.array([[Decimal(1)]*3]*3)
5395+ tgt = mat.dtype.type
5396+ res = f(mat, axis=1).dtype.type
5397+ assert_(res is tgt)
5398+ # scalar case
5399+ res = type(f(mat, axis=None))
5400+ assert_(res is Decimal)
5401+
5402+ # integer types
5403+ for f in self.funcs:
5404+ for c in icodes:
5405+ mat = np.eye(3, dtype=c)
5406+ tgt = np.float64
5407+ res = f(mat, axis=1).dtype.type
5408+ assert_(res is tgt)
5409+ # scalar case
5410+ res = f(mat, axis=None).dtype.type
5411+ assert_(res is tgt)
5412+
5413+ # mean for float types
5414+ for f in [_mean]:
5415+ for c in fcodes:
5416+ mat = np.eye(3, dtype=c)
5417+ tgt = mat.dtype.type
5418+ res = f(mat, axis=1).dtype.type
5419+ assert_(res is tgt)
5420+ # scalar case
5421+ res = f(mat, axis=None).dtype.type
5422+ assert_(res is tgt)
5423+
5424+ # var, std for float types
5425+ for f in [_var, _std]:
5426+ for c in fcodes:
5427+ mat = np.eye(3, dtype=c)
5428+ # deal with complex types
5429+ tgt = mat.real.dtype.type
5430+ res = f(mat, axis=1).dtype.type
5431+ assert_(res is tgt)
5432+ # scalar case
5433+ res = f(mat, axis=None).dtype.type
5434+ assert_(res is tgt)
5435+
5436+ def test_dtype_from_dtype(self):
5437+ mat = np.eye(3)
5438+
5439+ # stats for integer types
5440+ # FIXME:
5441+ # this needs definition as there are lots places along the line
5442+ # where type casting may take place.
5443+
5444+ # for f in self.funcs:
5445+ # for c in np.typecodes['AllInteger']:
5446+ # tgt = np.dtype(c).type
5447+ # res = f(mat, axis=1, dtype=c).dtype.type
5448+ # assert_(res is tgt)
5449+ # # scalar case
5450+ # res = f(mat, axis=None, dtype=c).dtype.type
5451+ # assert_(res is tgt)
5452+
5453+ # stats for float types
5454+ for f in self.funcs:
5455+ for c in np.typecodes['AllFloat']:
5456+ tgt = np.dtype(c).type
5457+ res = f(mat, axis=1, dtype=c).dtype.type
5458+ assert_(res is tgt)
5459+ # scalar case
5460+ res = f(mat, axis=None, dtype=c).dtype.type
5461+ assert_(res is tgt)
5462+
5463+ def test_ddof(self):
5464+ for f in [_var]:
5465+ for ddof in range(3):
5466+ dim = self.rmat.shape[1]
5467+ tgt = f(self.rmat, axis=1) * dim
5468+ res = f(self.rmat, axis=1, ddof=ddof) * (dim - ddof)
5469+ for f in [_std]:
5470+ for ddof in range(3):
5471+ dim = self.rmat.shape[1]
5472+ tgt = f(self.rmat, axis=1) * np.sqrt(dim)
5473+ res = f(self.rmat, axis=1, ddof=ddof) * np.sqrt(dim - ddof)
5474+ assert_almost_equal(res, tgt)
5475+ assert_almost_equal(res, tgt)
5476+
5477+ def test_ddof_too_big(self):
5478+ dim = self.rmat.shape[1]
5479+ for f in [_var, _std]:
5480+ for ddof in range(dim, dim + 2):
5481+ with warnings.catch_warnings(record=True) as w:
5482+ warnings.simplefilter('always')
5483+ res = f(self.rmat, axis=1, ddof=ddof)
5484+ assert_(not (res < 0).any())
5485+ assert_(len(w) > 0)
5486+ assert_(issubclass(w[0].category, RuntimeWarning))
5487+
5488+ def test_empty(self):
5489+ A = np.zeros((0, 3))
5490+ for f in self.funcs:
5491+ for axis in [0, None]:
5492+ with warnings.catch_warnings(record=True) as w:
5493+ warnings.simplefilter('always')
5494+ assert_(np.isnan(f(A, axis=axis)).all())
5495+ assert_(len(w) > 0)
5496+ assert_(issubclass(w[0].category, RuntimeWarning))
5497+ for axis in [1]:
5498+ with warnings.catch_warnings(record=True) as w:
5499+ warnings.simplefilter('always')
5500+ assert_equal(f(A, axis=axis), np.zeros([]))
5501+
5502+ def test_mean_values(self):
5503+ for mat in [self.rmat, self.cmat, self.omat]:
5504+ for axis in [0, 1]:
5505+ tgt = mat.sum(axis=axis)
5506+ res = _mean(mat, axis=axis) * mat.shape[axis]
5507+ assert_almost_equal(res, tgt)
5508+ for axis in [None]:
5509+ tgt = mat.sum(axis=axis)
5510+ res = _mean(mat, axis=axis) * np.prod(mat.shape)
5511+ assert_almost_equal(res, tgt)
5512+
5513+ def test_mean_float16(self):
5514+ # This fail if the sum inside mean is done in float16 instead
5515+ # of float32.
5516+ assert_(_mean(np.ones(100000, dtype='float16')) == 1)
5517+
5518+ def test_mean_axis_error(self):
5519+ # Ensure that AxisError is raised instead of IndexError when axis is
5520+ # out of bounds, see gh-15817.
5521+ with assert_raises(np.core._exceptions.AxisError):
5522+ np.arange(10).mean(axis=2)
5523+
5524+ def test_var_values(self):
5525+ for mat in [self.rmat, self.cmat, self.omat]:
5526+ for axis in [0, 1, None]:
5527+ msqr = _mean(mat * mat.conj(), axis=axis)
5528+ mean = _mean(mat, axis=axis)
5529+ tgt = msqr - mean * mean.conjugate()
5530+ res = _var(mat, axis=axis)
5531+ assert_almost_equal(res, tgt)
5532+
5533+ @pytest.mark.parametrize(('complex_dtype', 'ndec'), (
5534+ ('complex64', 6),
5535+ ('complex128', 7),
5536+ ('clongdouble', 7),
5537+ ))
5538+ def test_var_complex_values(self, complex_dtype, ndec):
5539+ # Test fast-paths for every builtin complex type
5540+ for axis in [0, 1, None]:
5541+ mat = self.cmat.copy().astype(complex_dtype)
5542+ msqr = _mean(mat * mat.conj(), axis=axis)
5543+ mean = _mean(mat, axis=axis)
5544+ tgt = msqr - mean * mean.conjugate()
5545+ res = _var(mat, axis=axis)
5546+ assert_almost_equal(res, tgt, decimal=ndec)
5547+
5548+ def test_var_dimensions(self):
5549+ # _var paths for complex number introduce additions on views that
5550+ # increase dimensions. Ensure this generalizes to higher dims
5551+ mat = np.stack([self.cmat]*3)
5552+ for axis in [0, 1, 2, -1, None]:
5553+ msqr = _mean(mat * mat.conj(), axis=axis)
5554+ mean = _mean(mat, axis=axis)
5555+ tgt = msqr - mean * mean.conjugate()
5556+ res = _var(mat, axis=axis)
5557+ assert_almost_equal(res, tgt)
5558+
5559+ def test_var_complex_byteorder(self):
5560+ # Test that var fast-path does not cause failures for complex arrays
5561+ # with non-native byteorder
5562+ cmat = self.cmat.copy().astype('complex128')
5563+ cmat_swapped = cmat.astype(cmat.dtype.newbyteorder())
5564+ assert_almost_equal(cmat.var(), cmat_swapped.var())
5565+
5566+ def test_var_axis_error(self):
5567+ # Ensure that AxisError is raised instead of IndexError when axis is
5568+ # out of bounds, see gh-15817.
5569+ with assert_raises(np.core._exceptions.AxisError):
5570+ np.arange(10).var(axis=2)
5571+
5572+ def test_std_values(self):
5573+ for mat in [self.rmat, self.cmat, self.omat]:
5574+ for axis in [0, 1, None]:
5575+ tgt = np.sqrt(_var(mat, axis=axis))
5576+ res = _std(mat, axis=axis)
5577+ assert_almost_equal(res, tgt)
5578+
5579+ def test_subclass(self):
5580+ class TestArray(np.ndarray):
5581+ def __new__(cls, data, info):
5582+ result = np.array(data)
5583+ result = result.view(cls)
5584+ result.info = info
5585+ return result
5586+
5587+ def __array_finalize__(self, obj):
5588+ self.info = getattr(obj, "info", '')
5589+
5590+ dat = TestArray([[1, 2, 3, 4], [5, 6, 7, 8]], 'jubba')
5591+ res = dat.mean(1)
5592+ assert_(res.info == dat.info)
5593+ res = dat.std(1)
5594+ assert_(res.info == dat.info)
5595+ res = dat.var(1)
5596+ assert_(res.info == dat.info)
5597+
5598+class TestVdot:
5599+ def test_basic(self):
5600+ dt_numeric = np.typecodes['AllFloat'] + np.typecodes['AllInteger']
5601+ dt_complex = np.typecodes['Complex']
5602+
5603+ # test real
5604+ a = np.eye(3)
5605+ for dt in dt_numeric + 'O':
5606+ b = a.astype(dt)
5607+ res = np.vdot(b, b)
5608+ assert_(np.isscalar(res))
5609+ assert_equal(np.vdot(b, b), 3)
5610+
5611+ # test complex
5612+ a = np.eye(3) * 1j
5613+ for dt in dt_complex + 'O':
5614+ b = a.astype(dt)
5615+ res = np.vdot(b, b)
5616+ assert_(np.isscalar(res))
5617+ assert_equal(np.vdot(b, b), 3)
5618+
5619+ # test boolean
5620+ b = np.eye(3, dtype=bool)
5621+ res = np.vdot(b, b)
5622+ assert_(np.isscalar(res))
5623+ assert_equal(np.vdot(b, b), True)
5624+
5625+ def test_vdot_array_order(self):
5626+ a = np.array([[1, 2], [3, 4]], order='C')
5627+ b = np.array([[1, 2], [3, 4]], order='F')
5628+ res = np.vdot(a, a)
5629+
5630+ # integer arrays are exact
5631+ assert_equal(np.vdot(a, b), res)
5632+ assert_equal(np.vdot(b, a), res)
5633+ assert_equal(np.vdot(b, b), res)
5634+
5635+ def test_vdot_uncontiguous(self):
5636+ for size in [2, 1000]:
5637+ # Different sizes match different branches in vdot.
5638+ a = np.zeros((size, 2, 2))
5639+ b = np.zeros((size, 2, 2))
5640+ a[:, 0, 0] = np.arange(size)
5641+ b[:, 0, 0] = np.arange(size) + 1
5642+ # Make a and b uncontiguous:
5643+ a = a[..., 0]
5644+ b = b[..., 0]
5645+
5646+ assert_equal(np.vdot(a, b),
5647+ np.vdot(a.flatten(), b.flatten()))
5648+ assert_equal(np.vdot(a, b.copy()),
5649+ np.vdot(a.flatten(), b.flatten()))
5650+ assert_equal(np.vdot(a.copy(), b),
5651+ np.vdot(a.flatten(), b.flatten()))
5652+ assert_equal(np.vdot(a.copy('F'), b),
5653+ np.vdot(a.flatten(), b.flatten()))
5654+ assert_equal(np.vdot(a, b.copy('F')),
5655+ np.vdot(a.flatten(), b.flatten()))
5656+
5657+
5658+class TestDot:
5659+ def setup(self):
5660+ np.random.seed(128)
5661+ self.A = np.random.rand(4, 2)
5662+ self.b1 = np.random.rand(2, 1)
5663+ self.b2 = np.random.rand(2)
5664+ self.b3 = np.random.rand(1, 2)
5665+ self.b4 = np.random.rand(4)
5666+ self.N = 7
5667+
5668+ def test_dotmatmat(self):
5669+ A = self.A
5670+ res = np.dot(A.transpose(), A)
5671+ tgt = np.array([[1.45046013, 0.86323640],
5672+ [0.86323640, 0.84934569]])
5673+ assert_almost_equal(res, tgt, decimal=self.N)
5674+
5675+ def test_dotmatvec(self):
5676+ A, b1 = self.A, self.b1
5677+ res = np.dot(A, b1)
5678+ tgt = np.array([[0.32114320], [0.04889721],
5679+ [0.15696029], [0.33612621]])
5680+ assert_almost_equal(res, tgt, decimal=self.N)
5681+
5682+ def test_dotmatvec2(self):
5683+ A, b2 = self.A, self.b2
5684+ res = np.dot(A, b2)
5685+ tgt = np.array([0.29677940, 0.04518649, 0.14468333, 0.31039293])
5686+ assert_almost_equal(res, tgt, decimal=self.N)
5687+
5688+ def test_dotvecmat(self):
5689+ A, b4 = self.A, self.b4
5690+ res = np.dot(b4, A)
5691+ tgt = np.array([1.23495091, 1.12222648])
5692+ assert_almost_equal(res, tgt, decimal=self.N)
5693+
5694+ def test_dotvecmat2(self):
5695+ b3, A = self.b3, self.A
5696+ res = np.dot(b3, A.transpose())
5697+ tgt = np.array([[0.58793804, 0.08957460, 0.30605758, 0.62716383]])
5698+ assert_almost_equal(res, tgt, decimal=self.N)
5699+
5700+ def test_dotvecmat3(self):
5701+ A, b4 = self.A, self.b4
5702+ res = np.dot(A.transpose(), b4)
5703+ tgt = np.array([1.23495091, 1.12222648])
5704+ assert_almost_equal(res, tgt, decimal=self.N)
5705+
5706+ def test_dotvecvecouter(self):
5707+ b1, b3 = self.b1, self.b3
5708+ res = np.dot(b1, b3)
5709+ tgt = np.array([[0.20128610, 0.08400440], [0.07190947, 0.03001058]])
5710+ assert_almost_equal(res, tgt, decimal=self.N)
5711+
5712+ def test_dotvecvecinner(self):
5713+ b1, b3 = self.b1, self.b3
5714+ res = np.dot(b3, b1)
5715+ tgt = np.array([[ 0.23129668]])
5716+ assert_almost_equal(res, tgt, decimal=self.N)
5717+
5718+ def test_dotcolumnvect1(self):
5719+ b1 = np.ones((3, 1))
5720+ b2 = [5.3]
5721+ res = np.dot(b1, b2)
5722+ tgt = np.array([5.3, 5.3, 5.3])
5723+ assert_almost_equal(res, tgt, decimal=self.N)
5724+
5725+ def test_dotcolumnvect2(self):
5726+ b1 = np.ones((3, 1)).transpose()
5727+ b2 = [6.2]
5728+ res = np.dot(b2, b1)
5729+ tgt = np.array([6.2, 6.2, 6.2])
5730+ assert_almost_equal(res, tgt, decimal=self.N)
5731+
5732+ def test_dotvecscalar(self):
5733+ np.random.seed(100)
5734+ b1 = np.random.rand(1, 1)
5735+ b2 = np.random.rand(1, 4)
5736+ res = np.dot(b1, b2)
5737+ tgt = np.array([[0.15126730, 0.23068496, 0.45905553, 0.00256425]])
5738+ assert_almost_equal(res, tgt, decimal=self.N)
5739+
5740+ def test_dotvecscalar2(self):
5741+ np.random.seed(100)
5742+ b1 = np.random.rand(4, 1)
5743+ b2 = np.random.rand(1, 1)
5744+ res = np.dot(b1, b2)
5745+ tgt = np.array([[0.00256425],[0.00131359],[0.00200324],[ 0.00398638]])
5746+ assert_almost_equal(res, tgt, decimal=self.N)
5747+
5748+ def test_all(self):
5749+ dims = [(), (1,), (1, 1)]
5750+ dout = [(), (1,), (1, 1), (1,), (), (1,), (1, 1), (1,), (1, 1)]
5751+ for dim, (dim1, dim2) in zip(dout, itertools.product(dims, dims)):
5752+ b1 = np.zeros(dim1)
5753+ b2 = np.zeros(dim2)
5754+ res = np.dot(b1, b2)
5755+ tgt = np.zeros(dim)
5756+ assert_(res.shape == tgt.shape)
5757+ assert_almost_equal(res, tgt, decimal=self.N)
5758+
5759+ def test_vecobject(self):
5760+ class Vec:
5761+ def __init__(self, sequence=None):
5762+ if sequence is None:
5763+ sequence = []
5764+ self.array = np.array(sequence)
5765+
5766+ def __add__(self, other):
5767+ out = Vec()
5768+ out.array = self.array + other.array
5769+ return out
5770+
5771+ def __sub__(self, other):
5772+ out = Vec()
5773+ out.array = self.array - other.array
5774+ return out
5775+
5776+ def __mul__(self, other): # with scalar
5777+ out = Vec(self.array.copy())
5778+ out.array *= other
5779+ return out
5780+
5781+ def __rmul__(self, other):
5782+ return self*other
5783+
5784+ U_non_cont = np.transpose([[1., 1.], [1., 2.]])
5785+ U_cont = np.ascontiguousarray(U_non_cont)
5786+ x = np.array([Vec([1., 0.]), Vec([0., 1.])])
5787+ zeros = np.array([Vec([0., 0.]), Vec([0., 0.])])
5788+ zeros_test = np.dot(U_cont, x) - np.dot(U_non_cont, x)
5789+ assert_equal(zeros[0].array, zeros_test[0].array)
5790+ assert_equal(zeros[1].array, zeros_test[1].array)
5791+
5792+ def test_dot_2args(self):
5793+ from numpy.core.multiarray import dot
5794+
5795+ a = np.array([[1, 2], [3, 4]], dtype=float)
5796+ b = np.array([[1, 0], [1, 1]], dtype=float)
5797+ c = np.array([[3, 2], [7, 4]], dtype=float)
5798+
5799+ d = dot(a, b)
5800+ assert_allclose(c, d)
5801+
5802+ def test_dot_3args(self):
5803+ from numpy.core.multiarray import dot
5804+
5805+ np.random.seed(22)
5806+ f = np.random.random_sample((1024, 16))
5807+ v = np.random.random_sample((16, 32))
5808+
5809+ r = np.empty((1024, 32))
5810+ for i in range(12):
5811+ dot(f, v, r)
5812+ if HAS_REFCOUNT:
5813+ assert_equal(sys.getrefcount(r), 2)
5814+ r2 = dot(f, v, out=None)
5815+ assert_array_equal(r2, r)
5816+ assert_(r is dot(f, v, out=r))
5817+
5818+ v = v[:, 0].copy() # v.shape == (16,)
5819+ r = r[:, 0].copy() # r.shape == (1024,)
5820+ r2 = dot(f, v)
5821+ assert_(r is dot(f, v, r))
5822+ assert_array_equal(r2, r)
5823+
5824+ def test_dot_3args_errors(self):
5825+ from numpy.core.multiarray import dot
5826+
5827+ np.random.seed(22)
5828+ f = np.random.random_sample((1024, 16))
5829+ v = np.random.random_sample((16, 32))
5830+
5831+ r = np.empty((1024, 31))
5832+ assert_raises(ValueError, dot, f, v, r)
5833+
5834+ r = np.empty((1024,))
5835+ assert_raises(ValueError, dot, f, v, r)
5836+
5837+ r = np.empty((32,))
5838+ assert_raises(ValueError, dot, f, v, r)
5839+
5840+ r = np.empty((32, 1024))
5841+ assert_raises(ValueError, dot, f, v, r)
5842+ assert_raises(ValueError, dot, f, v, r.T)
5843+
5844+ r = np.empty((1024, 64))
5845+ assert_raises(ValueError, dot, f, v, r[:, ::2])
5846+ assert_raises(ValueError, dot, f, v, r[:, :32])
5847+
5848+ r = np.empty((1024, 32), dtype=np.float32)
5849+ assert_raises(ValueError, dot, f, v, r)
5850+
5851+ r = np.empty((1024, 32), dtype=int)
5852+ assert_raises(ValueError, dot, f, v, r)
5853+
5854+ def test_dot_array_order(self):
5855+ a = np.array([[1, 2], [3, 4]], order='C')
5856+ b = np.array([[1, 2], [3, 4]], order='F')
5857+ res = np.dot(a, a)
5858+
5859+ # integer arrays are exact
5860+ assert_equal(np.dot(a, b), res)
5861+ assert_equal(np.dot(b, a), res)
5862+ assert_equal(np.dot(b, b), res)
5863+
5864+ def test_accelerate_framework_sgemv_fix(self):
5865+
5866+ def aligned_array(shape, align, dtype, order='C'):
5867+ d = dtype(0)
5868+ N = np.prod(shape)
5869+ tmp = np.zeros(N * d.nbytes + align, dtype=np.uint8)
5870+ address = tmp.__array_interface__["data"][0]
5871+ for offset in range(align):
5872+ if (address + offset) % align == 0:
5873+ break
5874+ tmp = tmp[offset:offset+N*d.nbytes].view(dtype=dtype)
5875+ return tmp.reshape(shape, order=order)
5876+
5877+ def as_aligned(arr, align, dtype, order='C'):
5878+ aligned = aligned_array(arr.shape, align, dtype, order)
5879+ aligned[:] = arr[:]
5880+ return aligned
5881+
5882+ def assert_dot_close(A, X, desired):
5883+ assert_allclose(np.dot(A, X), desired, rtol=1e-5, atol=1e-7)
5884+
5885+ m = aligned_array(100, 15, np.float32)
5886+ s = aligned_array((100, 100), 15, np.float32)
5887+ np.dot(s, m) # this will always segfault if the bug is present
5888+
5889+ testdata = itertools.product((15,32), (10000,), (200,89), ('C','F'))
5890+ for align, m, n, a_order in testdata:
5891+ # Calculation in double precision
5892+ A_d = np.random.rand(m, n)
5893+ X_d = np.random.rand(n)
5894+ desired = np.dot(A_d, X_d)
5895+ # Calculation with aligned single precision
5896+ A_f = as_aligned(A_d, align, np.float32, order=a_order)
5897+ X_f = as_aligned(X_d, align, np.float32)
5898+ assert_dot_close(A_f, X_f, desired)
5899+ # Strided A rows
5900+ A_d_2 = A_d[::2]
5901+ desired = np.dot(A_d_2, X_d)
5902+ A_f_2 = A_f[::2]
5903+ assert_dot_close(A_f_2, X_f, desired)
5904+ # Strided A columns, strided X vector
5905+ A_d_22 = A_d_2[:, ::2]
5906+ X_d_2 = X_d[::2]
5907+ desired = np.dot(A_d_22, X_d_2)
5908+ A_f_22 = A_f_2[:, ::2]
5909+ X_f_2 = X_f[::2]
5910+ assert_dot_close(A_f_22, X_f_2, desired)
5911+ # Check the strides are as expected
5912+ if a_order == 'F':
5913+ assert_equal(A_f_22.strides, (8, 8 * m))
5914+ else:
5915+ assert_equal(A_f_22.strides, (8 * n, 8))
5916+ assert_equal(X_f_2.strides, (8,))
5917+ # Strides in A rows + cols only
5918+ X_f_2c = as_aligned(X_f_2, align, np.float32)
5919+ assert_dot_close(A_f_22, X_f_2c, desired)
5920+ # Strides just in A cols
5921+ A_d_12 = A_d[:, ::2]
5922+ desired = np.dot(A_d_12, X_d_2)
5923+ A_f_12 = A_f[:, ::2]
5924+ assert_dot_close(A_f_12, X_f_2c, desired)
5925+ # Strides in A cols and X
5926+ assert_dot_close(A_f_12, X_f_2, desired)
5927+
5928+
5929+class MatmulCommon:
5930+ """Common tests for '@' operator and numpy.matmul.
5931+
5932+ """
5933+ # Should work with these types. Will want to add
5934+ # "O" at some point
5935+ types = "?bhilqBHILQefdgFDGO"
5936+
5937+ def test_exceptions(self):
5938+ dims = [
5939+ ((1,), (2,)), # mismatched vector vector
5940+ ((2, 1,), (2,)), # mismatched matrix vector
5941+ ((2,), (1, 2)), # mismatched vector matrix
5942+ ((1, 2), (3, 1)), # mismatched matrix matrix
5943+ ((1,), ()), # vector scalar
5944+ ((), (1)), # scalar vector
5945+ ((1, 1), ()), # matrix scalar
5946+ ((), (1, 1)), # scalar matrix
5947+ ((2, 2, 1), (3, 1, 2)), # cannot broadcast
5948+ ]
5949+
5950+ for dt, (dm1, dm2) in itertools.product(self.types, dims):
5951+ a = np.ones(dm1, dtype=dt)
5952+ b = np.ones(dm2, dtype=dt)
5953+ assert_raises(ValueError, self.matmul, a, b)
5954+
5955+ def test_shapes(self):
5956+ dims = [
5957+ ((1, 1), (2, 1, 1)), # broadcast first argument
5958+ ((2, 1, 1), (1, 1)), # broadcast second argument
5959+ ((2, 1, 1), (2, 1, 1)), # matrix stack sizes match
5960+ ]
5961+
5962+ for dt, (dm1, dm2) in itertools.product(self.types, dims):
5963+ a = np.ones(dm1, dtype=dt)
5964+ b = np.ones(dm2, dtype=dt)
5965+ res = self.matmul(a, b)
5966+ assert_(res.shape == (2, 1, 1))
5967+
5968+ # vector vector returns scalars.
5969+ for dt in self.types:
5970+ a = np.ones((2,), dtype=dt)
5971+ b = np.ones((2,), dtype=dt)
5972+ c = self.matmul(a, b)
5973+ assert_(np.array(c).shape == ())
5974+
5975+ def test_result_types(self):
5976+ mat = np.ones((1,1))
5977+ vec = np.ones((1,))
5978+ for dt in self.types:
5979+ m = mat.astype(dt)
5980+ v = vec.astype(dt)
5981+ for arg in [(m, v), (v, m), (m, m)]:
5982+ res = self.matmul(*arg)
5983+ assert_(res.dtype == dt)
5984+
5985+ # vector vector returns scalars
5986+ if dt != "O":
5987+ res = self.matmul(v, v)
5988+ assert_(type(res) is np.dtype(dt).type)
5989+
5990+ def test_scalar_output(self):
5991+ vec1 = np.array([2])
5992+ vec2 = np.array([3, 4]).reshape(1, -1)
5993+ tgt = np.array([6, 8])
5994+ for dt in self.types[1:]:
5995+ v1 = vec1.astype(dt)
5996+ v2 = vec2.astype(dt)
5997+ res = self.matmul(v1, v2)
5998+ assert_equal(res, tgt)
5999+ res = self.matmul(v2.T, v1)
6000+ assert_equal(res, tgt)
6001+
6002+ # boolean type
6003+ vec = np.array([True, True], dtype='?').reshape(1, -1)
6004+ res = self.matmul(vec[:, 0], vec)
6005+ assert_equal(res, True)
6006+
6007+ def test_vector_vector_values(self):
6008+ vec1 = np.array([1, 2])
6009+ vec2 = np.array([3, 4]).reshape(-1, 1)
6010+ tgt1 = np.array([11])
6011+ tgt2 = np.array([[3, 6], [4, 8]])
6012+ for dt in self.types[1:]:
6013+ v1 = vec1.astype(dt)
6014+ v2 = vec2.astype(dt)
6015+ res = self.matmul(v1, v2)
6016+ assert_equal(res, tgt1)
6017+ # no broadcast, we must make v1 into a 2d ndarray
6018+ res = self.matmul(v2, v1.reshape(1, -1))
6019+ assert_equal(res, tgt2)
6020+
6021+ # boolean type
6022+ vec = np.array([True, True], dtype='?')
6023+ res = self.matmul(vec, vec)
6024+ assert_equal(res, True)
6025+
6026+ def test_vector_matrix_values(self):
6027+ vec = np.array([1, 2])
6028+ mat1 = np.array([[1, 2], [3, 4]])
6029+ mat2 = np.stack([mat1]*2, axis=0)
6030+ tgt1 = np.array([7, 10])
6031+ tgt2 = np.stack([tgt1]*2, axis=0)
6032+ for dt in self.types[1:]:
6033+ v = vec.astype(dt)
6034+ m1 = mat1.astype(dt)
6035+ m2 = mat2.astype(dt)
6036+ res = self.matmul(v, m1)
6037+ assert_equal(res, tgt1)
6038+ res = self.matmul(v, m2)
6039+ assert_equal(res, tgt2)
6040+
6041+ # boolean type
6042+ vec = np.array([True, False])
6043+ mat1 = np.array([[True, False], [False, True]])
6044+ mat2 = np.stack([mat1]*2, axis=0)
6045+ tgt1 = np.array([True, False])
6046+ tgt2 = np.stack([tgt1]*2, axis=0)
6047+
6048+ res = self.matmul(vec, mat1)
6049+ assert_equal(res, tgt1)
6050+ res = self.matmul(vec, mat2)
6051+ assert_equal(res, tgt2)
6052+
6053+ def test_matrix_vector_values(self):
6054+ vec = np.array([1, 2])
6055+ mat1 = np.array([[1, 2], [3, 4]])
6056+ mat2 = np.stack([mat1]*2, axis=0)
6057+ tgt1 = np.array([5, 11])
6058+ tgt2 = np.stack([tgt1]*2, axis=0)
6059+ for dt in self.types[1:]:
6060+ v = vec.astype(dt)
6061+ m1 = mat1.astype(dt)
6062+ m2 = mat2.astype(dt)
6063+ res = self.matmul(m1, v)
6064+ assert_equal(res, tgt1)
6065+ res = self.matmul(m2, v)
6066+ assert_equal(res, tgt2)
6067+
6068+ # boolean type
6069+ vec = np.array([True, False])
6070+ mat1 = np.array([[True, False], [False, True]])
6071+ mat2 = np.stack([mat1]*2, axis=0)
6072+ tgt1 = np.array([True, False])
6073+ tgt2 = np.stack([tgt1]*2, axis=0)
6074+
6075+ res = self.matmul(vec, mat1)
6076+ assert_equal(res, tgt1)
6077+ res = self.matmul(vec, mat2)
6078+ assert_equal(res, tgt2)
6079+
6080+ def test_matrix_matrix_values(self):
6081+ mat1 = np.array([[1, 2], [3, 4]])
6082+ mat2 = np.array([[1, 0], [1, 1]])
6083+ mat12 = np.stack([mat1, mat2], axis=0)
6084+ mat21 = np.stack([mat2, mat1], axis=0)
6085+ tgt11 = np.array([[7, 10], [15, 22]])
6086+ tgt12 = np.array([[3, 2], [7, 4]])
6087+ tgt21 = np.array([[1, 2], [4, 6]])
6088+ tgt12_21 = np.stack([tgt12, tgt21], axis=0)
6089+ tgt11_12 = np.stack((tgt11, tgt12), axis=0)
6090+ tgt11_21 = np.stack((tgt11, tgt21), axis=0)
6091+ for dt in self.types[1:]:
6092+ m1 = mat1.astype(dt)
6093+ m2 = mat2.astype(dt)
6094+ m12 = mat12.astype(dt)
6095+ m21 = mat21.astype(dt)
6096+
6097+ # matrix @ matrix
6098+ res = self.matmul(m1, m2)
6099+ assert_equal(res, tgt12)
6100+ res = self.matmul(m2, m1)
6101+ assert_equal(res, tgt21)
6102+
6103+ # stacked @ matrix
6104+ res = self.matmul(m12, m1)
6105+ assert_equal(res, tgt11_21)
6106+
6107+ # matrix @ stacked
6108+ res = self.matmul(m1, m12)
6109+ assert_equal(res, tgt11_12)
6110+
6111+ # stacked @ stacked
6112+ res = self.matmul(m12, m21)
6113+ assert_equal(res, tgt12_21)
6114+
6115+ # boolean type
6116+ m1 = np.array([[1, 1], [0, 0]], dtype=np.bool_)
6117+ m2 = np.array([[1, 0], [1, 1]], dtype=np.bool_)
6118+ m12 = np.stack([m1, m2], axis=0)
6119+ m21 = np.stack([m2, m1], axis=0)
6120+ tgt11 = m1
6121+ tgt12 = m1
6122+ tgt21 = np.array([[1, 1], [1, 1]], dtype=np.bool_)
6123+ tgt12_21 = np.stack([tgt12, tgt21], axis=0)
6124+ tgt11_12 = np.stack((tgt11, tgt12), axis=0)
6125+ tgt11_21 = np.stack((tgt11, tgt21), axis=0)
6126+
6127+ # matrix @ matrix
6128+ res = self.matmul(m1, m2)
6129+ assert_equal(res, tgt12)
6130+ res = self.matmul(m2, m1)
6131+ assert_equal(res, tgt21)
6132+
6133+ # stacked @ matrix
6134+ res = self.matmul(m12, m1)
6135+ assert_equal(res, tgt11_21)
6136+
6137+ # matrix @ stacked
6138+ res = self.matmul(m1, m12)
6139+ assert_equal(res, tgt11_12)
6140+
6141+ # stacked @ stacked
6142+ res = self.matmul(m12, m21)
6143+ assert_equal(res, tgt12_21)
6144+
6145+
6146+class TestMatmul(MatmulCommon):
6147+ matmul = np.matmul
6148+
6149+ def test_out_arg(self):
6150+ a = np.ones((5, 2), dtype=float)
6151+ b = np.array([[1, 3], [5, 7]], dtype=float)
6152+ tgt = np.dot(a, b)
6153+
6154+ # test as positional argument
6155+ msg = "out positional argument"
6156+ out = np.zeros((5, 2), dtype=float)
6157+ self.matmul(a, b, out)
6158+ assert_array_equal(out, tgt, err_msg=msg)
6159+
6160+ # test as keyword argument
6161+ msg = "out keyword argument"
6162+ out = np.zeros((5, 2), dtype=float)
6163+ self.matmul(a, b, out=out)
6164+ assert_array_equal(out, tgt, err_msg=msg)
6165+
6166+ # test out with not allowed type cast (safe casting)
6167+ msg = "Cannot cast ufunc .* output"
6168+ out = np.zeros((5, 2), dtype=np.int32)
6169+ assert_raises_regex(TypeError, msg, self.matmul, a, b, out=out)
6170+
6171+ # test out with type upcast to complex
6172+ out = np.zeros((5, 2), dtype=np.complex128)
6173+ c = self.matmul(a, b, out=out)
6174+ assert_(c is out)
6175+ with suppress_warnings() as sup:
6176+ sup.filter(np.ComplexWarning, '')
6177+ c = c.astype(tgt.dtype)
6178+ assert_array_equal(c, tgt)
6179+
6180+ def test_out_contiguous(self):
6181+ a = np.ones((5, 2), dtype=float)
6182+ b = np.array([[1, 3], [5, 7]], dtype=float)
6183+ v = np.array([1, 3], dtype=float)
6184+ tgt = np.dot(a, b)
6185+ tgt_mv = np.dot(a, v)
6186+
6187+ # test out non-contiguous
6188+ out = np.ones((5, 2, 2), dtype=float)
6189+ c = self.matmul(a, b, out=out[..., 0])
6190+ assert c.base is out
6191+ assert_array_equal(c, tgt)
6192+ c = self.matmul(a, v, out=out[:, 0, 0])
6193+ assert_array_equal(c, tgt_mv)
6194+ c = self.matmul(v, a.T, out=out[:, 0, 0])
6195+ assert_array_equal(c, tgt_mv)
6196+
6197+ # test out contiguous in only last dim
6198+ out = np.ones((10, 2), dtype=float)
6199+ c = self.matmul(a, b, out=out[::2, :])
6200+ assert_array_equal(c, tgt)
6201+
6202+ # test transposes of out, args
6203+ out = np.ones((5, 2), dtype=float)
6204+ c = self.matmul(b.T, a.T, out=out.T)
6205+ assert_array_equal(out, tgt)
6206+
6207+ m1 = np.arange(15.).reshape(5, 3)
6208+ m2 = np.arange(21.).reshape(3, 7)
6209+ m3 = np.arange(30.).reshape(5, 6)[:, ::2] # non-contiguous
6210+ vc = np.arange(10.)
6211+ vr = np.arange(6.)
6212+ m0 = np.zeros((3, 0))
6213+ @pytest.mark.parametrize('args', (
6214+ # matrix-matrix
6215+ (m1, m2), (m2.T, m1.T), (m2.T.copy(), m1.T), (m2.T, m1.T.copy()),
6216+ # matrix-matrix-transpose, contiguous and non
6217+ (m1, m1.T), (m1.T, m1), (m1, m3.T), (m3, m1.T),
6218+ (m3, m3.T), (m3.T, m3),
6219+ # matrix-matrix non-contiguous
6220+ (m3, m2), (m2.T, m3.T), (m2.T.copy(), m3.T),
6221+ # vector-matrix, matrix-vector, contiguous
6222+ (m1, vr[:3]), (vc[:5], m1), (m1.T, vc[:5]), (vr[:3], m1.T),
6223+ # vector-matrix, matrix-vector, vector non-contiguous
6224+ (m1, vr[::2]), (vc[::2], m1), (m1.T, vc[::2]), (vr[::2], m1.T),
6225+ # vector-matrix, matrix-vector, matrix non-contiguous
6226+ (m3, vr[:3]), (vc[:5], m3), (m3.T, vc[:5]), (vr[:3], m3.T),
6227+ # vector-matrix, matrix-vector, both non-contiguous
6228+ (m3, vr[::2]), (vc[::2], m3), (m3.T, vc[::2]), (vr[::2], m3.T),
6229+ # size == 0
6230+ (m0, m0.T), (m0.T, m0), (m1, m0), (m0.T, m1.T),
6231+ ))
6232+ def test_dot_equivalent(self, args):
6233+ r1 = np.matmul(*args)
6234+ r2 = np.dot(*args)
6235+ assert_equal(r1, r2)
6236+
6237+ r3 = np.matmul(args[0].copy(), args[1].copy())
6238+ assert_equal(r1, r3)
6239+
6240+ def test_matmul_object(self):
6241+ import fractions
6242+
6243+ f = np.vectorize(fractions.Fraction)
6244+ def random_ints():
6245+ return np.random.randint(1, 1000, size=(10, 3, 3))
6246+ M1 = f(random_ints(), random_ints())
6247+ M2 = f(random_ints(), random_ints())
6248+
6249+ M3 = self.matmul(M1, M2)
6250+
6251+ [N1, N2, N3] = [a.astype(float) for a in [M1, M2, M3]]
6252+
6253+ assert_allclose(N3, self.matmul(N1, N2))
6254+
6255+ def test_matmul_object_type_scalar(self):
6256+ from fractions import Fraction as F
6257+ v = np.array([F(2,3), F(5,7)])
6258+ res = self.matmul(v, v)
6259+ assert_(type(res) is F)
6260+
6261+ def test_matmul_empty(self):
6262+ a = np.empty((3, 0), dtype=object)
6263+ b = np.empty((0, 3), dtype=object)
6264+ c = np.zeros((3, 3))
6265+ assert_array_equal(np.matmul(a, b), c)
6266+
6267+ def test_matmul_exception_multiply(self):
6268+ # test that matmul fails if `__mul__` is missing
6269+ class add_not_multiply():
6270+ def __add__(self, other):
6271+ return self
6272+ a = np.full((3,3), add_not_multiply())
6273+ with assert_raises(TypeError):
6274+ b = np.matmul(a, a)
6275+
6276+ def test_matmul_exception_add(self):
6277+ # test that matmul fails if `__add__` is missing
6278+ class multiply_not_add():
6279+ def __mul__(self, other):
6280+ return self
6281+ a = np.full((3,3), multiply_not_add())
6282+ with assert_raises(TypeError):
6283+ b = np.matmul(a, a)
6284+
6285+ def test_matmul_bool(self):
6286+ # gh-14439
6287+ a = np.array([[1, 0],[1, 1]], dtype=bool)
6288+ assert np.max(a.view(np.uint8)) == 1
6289+ b = np.matmul(a, a)
6290+ # matmul with boolean output should always be 0, 1
6291+ assert np.max(b.view(np.uint8)) == 1
6292+
6293+ rg = np.random.default_rng(np.random.PCG64(43))
6294+ d = rg.integers(2, size=4*5, dtype=np.int8)
6295+ d = d.reshape(4, 5) > 0
6296+ out1 = np.matmul(d, d.reshape(5, 4))
6297+ out2 = np.dot(d, d.reshape(5, 4))
6298+ assert_equal(out1, out2)
6299+
6300+ c = np.matmul(np.zeros((2, 0), dtype=bool), np.zeros(0, dtype=bool))
6301+ assert not np.any(c)
6302+
6303+
6304+class TestMatmulOperator(MatmulCommon):
6305+ import operator
6306+ matmul = operator.matmul
6307+
6308+ def test_array_priority_override(self):
6309+
6310+ class A:
6311+ __array_priority__ = 1000
6312+
6313+ def __matmul__(self, other):
6314+ return "A"
6315+
6316+ def __rmatmul__(self, other):
6317+ return "A"
6318+
6319+ a = A()
6320+ b = np.ones(2)
6321+ assert_equal(self.matmul(a, b), "A")
6322+ assert_equal(self.matmul(b, a), "A")
6323+
6324+ def test_matmul_raises(self):
6325+ assert_raises(TypeError, self.matmul, np.int8(5), np.int8(5))
6326+ assert_raises(TypeError, self.matmul, np.void(b'abc'), np.void(b'abc'))
6327+ assert_raises(ValueError, self.matmul, np.arange(10), np.void(b'abc'))
6328+
6329+def test_matmul_inplace():
6330+ # It would be nice to support in-place matmul eventually, but for now
6331+ # we don't have a working implementation, so better just to error out
6332+ # and nudge people to writing "a = a @ b".
6333+ a = np.eye(3)
6334+ b = np.eye(3)
6335+ assert_raises(TypeError, a.__imatmul__, b)
6336+ import operator
6337+ assert_raises(TypeError, operator.imatmul, a, b)
6338+ assert_raises(TypeError, exec, "a @= b", globals(), locals())
6339+
6340+def test_matmul_axes():
6341+ a = np.arange(3*4*5).reshape(3, 4, 5)
6342+ c = np.matmul(a, a, axes=[(-2, -1), (-1, -2), (1, 2)])
6343+ assert c.shape == (3, 4, 4)
6344+ d = np.matmul(a, a, axes=[(-2, -1), (-1, -2), (0, 1)])
6345+ assert d.shape == (4, 4, 3)
6346+ e = np.swapaxes(d, 0, 2)
6347+ assert_array_equal(e, c)
6348+ f = np.matmul(a, np.arange(3), axes=[(1, 0), (0), (0)])
6349+ assert f.shape == (4, 5)
6350+
6351+
6352+class TestInner:
6353+
6354+ def test_inner_type_mismatch(self):
6355+ c = 1.
6356+ A = np.array((1,1), dtype='i,i')
6357+
6358+ assert_raises(TypeError, np.inner, c, A)
6359+ assert_raises(TypeError, np.inner, A, c)
6360+
6361+ def test_inner_scalar_and_vector(self):
6362+ for dt in np.typecodes['AllInteger'] + np.typecodes['AllFloat'] + '?':
6363+ sca = np.array(3, dtype=dt)[()]
6364+ vec = np.array([1, 2], dtype=dt)
6365+ desired = np.array([3, 6], dtype=dt)
6366+ assert_equal(np.inner(vec, sca), desired)
6367+ assert_equal(np.inner(sca, vec), desired)
6368+
6369+ def test_vecself(self):
6370+ # Ticket 844.
6371+ # Inner product of a vector with itself segfaults or give
6372+ # meaningless result
6373+ a = np.zeros(shape=(1, 80), dtype=np.float64)
6374+ p = np.inner(a, a)
6375+ assert_almost_equal(p, 0, decimal=14)
6376+
6377+ def test_inner_product_with_various_contiguities(self):
6378+ # github issue 6532
6379+ for dt in np.typecodes['AllInteger'] + np.typecodes['AllFloat'] + '?':
6380+ # check an inner product involving a matrix transpose
6381+ A = np.array([[1, 2], [3, 4]], dtype=dt)
6382+ B = np.array([[1, 3], [2, 4]], dtype=dt)
6383+ C = np.array([1, 1], dtype=dt)
6384+ desired = np.array([4, 6], dtype=dt)
6385+ assert_equal(np.inner(A.T, C), desired)
6386+ assert_equal(np.inner(C, A.T), desired)
6387+ assert_equal(np.inner(B, C), desired)
6388+ assert_equal(np.inner(C, B), desired)
6389+ # check a matrix product
6390+ desired = np.array([[7, 10], [15, 22]], dtype=dt)
6391+ assert_equal(np.inner(A, B), desired)
6392+ # check the syrk vs. gemm paths
6393+ desired = np.array([[5, 11], [11, 25]], dtype=dt)
6394+ assert_equal(np.inner(A, A), desired)
6395+ assert_equal(np.inner(A, A.copy()), desired)
6396+ # check an inner product involving an aliased and reversed view
6397+ a = np.arange(5).astype(dt)
6398+ b = a[::-1]
6399+ desired = np.array(10, dtype=dt).item()
6400+ assert_equal(np.inner(b, a), desired)
6401+
6402+ def test_3d_tensor(self):
6403+ for dt in np.typecodes['AllInteger'] + np.typecodes['AllFloat'] + '?':
6404+ a = np.arange(24).reshape(2,3,4).astype(dt)
6405+ b = np.arange(24, 48).reshape(2,3,4).astype(dt)
6406+ desired = np.array(
6407+ [[[[ 158, 182, 206],
6408+ [ 230, 254, 278]],
6409+
6410+ [[ 566, 654, 742],
6411+ [ 830, 918, 1006]],
6412+
6413+ [[ 974, 1126, 1278],
6414+ [1430, 1582, 1734]]],
6415+
6416+ [[[1382, 1598, 1814],
6417+ [2030, 2246, 2462]],
6418+
6419+ [[1790, 2070, 2350],
6420+ [2630, 2910, 3190]],
6421+
6422+ [[2198, 2542, 2886],
6423+ [3230, 3574, 3918]]]],
6424+ dtype=dt
6425+ )
6426+ assert_equal(np.inner(a, b), desired)
6427+ assert_equal(np.inner(b, a).transpose(2,3,0,1), desired)
6428+
6429+
6430+class TestAlen:
6431+ def test_basic(self):
6432+ with pytest.warns(DeprecationWarning):
6433+ m = np.array([1, 2, 3])
6434+ assert_equal(np.alen(m), 3)
6435+
6436+ m = np.array([[1, 2, 3], [4, 5, 7]])
6437+ assert_equal(np.alen(m), 2)
6438+
6439+ m = [1, 2, 3]
6440+ assert_equal(np.alen(m), 3)
6441+
6442+ m = [[1, 2, 3], [4, 5, 7]]
6443+ assert_equal(np.alen(m), 2)
6444+
6445+ def test_singleton(self):
6446+ with pytest.warns(DeprecationWarning):
6447+ assert_equal(np.alen(5), 1)
6448+
6449+
6450+class TestChoose:
6451+ def setup(self):
6452+ self.x = 2*np.ones((3,), dtype=int)
6453+ self.y = 3*np.ones((3,), dtype=int)
6454+ self.x2 = 2*np.ones((2, 3), dtype=int)
6455+ self.y2 = 3*np.ones((2, 3), dtype=int)
6456+ self.ind = [0, 0, 1]
6457+
6458+ def test_basic(self):
6459+ A = np.choose(self.ind, (self.x, self.y))
6460+ assert_equal(A, [2, 2, 3])
6461+
6462+ def test_broadcast1(self):
6463+ A = np.choose(self.ind, (self.x2, self.y2))
6464+ assert_equal(A, [[2, 2, 3], [2, 2, 3]])
6465+
6466+ def test_broadcast2(self):
6467+ A = np.choose(self.ind, (self.x, self.y2))
6468+ assert_equal(A, [[2, 2, 3], [2, 2, 3]])
6469+
6470+ @pytest.mark.parametrize("ops",
6471+ [(1000, np.array([1], dtype=np.uint8)),
6472+ (-1, np.array([1], dtype=np.uint8)),
6473+ (1., np.float32(3)),
6474+ (1., np.array([3], dtype=np.float32))],)
6475+ def test_output_dtype(self, ops):
6476+ expected_dt = np.result_type(*ops)
6477+ assert(np.choose([0], ops).dtype == expected_dt)
6478+
6479+
6480+class TestRepeat:
6481+ def setup(self):
6482+ self.m = np.array([1, 2, 3, 4, 5, 6])
6483+ self.m_rect = self.m.reshape((2, 3))
6484+
6485+ def test_basic(self):
6486+ A = np.repeat(self.m, [1, 3, 2, 1, 1, 2])
6487+ assert_equal(A, [1, 2, 2, 2, 3,
6488+ 3, 4, 5, 6, 6])
6489+
6490+ def test_broadcast1(self):
6491+ A = np.repeat(self.m, 2)
6492+ assert_equal(A, [1, 1, 2, 2, 3, 3,
6493+ 4, 4, 5, 5, 6, 6])
6494+
6495+ def test_axis_spec(self):
6496+ A = np.repeat(self.m_rect, [2, 1], axis=0)
6497+ assert_equal(A, [[1, 2, 3],
6498+ [1, 2, 3],
6499+ [4, 5, 6]])
6500+
6501+ A = np.repeat(self.m_rect, [1, 3, 2], axis=1)
6502+ assert_equal(A, [[1, 2, 2, 2, 3, 3],
6503+ [4, 5, 5, 5, 6, 6]])
6504+
6505+ def test_broadcast2(self):
6506+ A = np.repeat(self.m_rect, 2, axis=0)
6507+ assert_equal(A, [[1, 2, 3],
6508+ [1, 2, 3],
6509+ [4, 5, 6],
6510+ [4, 5, 6]])
6511+
6512+ A = np.repeat(self.m_rect, 2, axis=1)
6513+ assert_equal(A, [[1, 1, 2, 2, 3, 3],
6514+ [4, 4, 5, 5, 6, 6]])
6515+
6516+
6517+# TODO: test for multidimensional
6518+NEIGH_MODE = {'zero': 0, 'one': 1, 'constant': 2, 'circular': 3, 'mirror': 4}
6519+
6520+
6521+@pytest.mark.parametrize('dt', [float, Decimal], ids=['float', 'object'])
6522+class TestNeighborhoodIter:
6523+ # Simple, 2d tests
6524+ def test_simple2d(self, dt):
6525+ # Test zero and one padding for simple data type
6526+ x = np.array([[0, 1], [2, 3]], dtype=dt)
6527+ r = [np.array([[0, 0, 0], [0, 0, 1]], dtype=dt),
6528+ np.array([[0, 0, 0], [0, 1, 0]], dtype=dt),
6529+ np.array([[0, 0, 1], [0, 2, 3]], dtype=dt),
6530+ np.array([[0, 1, 0], [2, 3, 0]], dtype=dt)]
6531+ l = _multiarray_tests.test_neighborhood_iterator(
6532+ x, [-1, 0, -1, 1], x[0], NEIGH_MODE['zero'])
6533+ assert_array_equal(l, r)
6534+
6535+ r = [np.array([[1, 1, 1], [1, 0, 1]], dtype=dt),
6536+ np.array([[1, 1, 1], [0, 1, 1]], dtype=dt),
6537+ np.array([[1, 0, 1], [1, 2, 3]], dtype=dt),
6538+ np.array([[0, 1, 1], [2, 3, 1]], dtype=dt)]
6539+ l = _multiarray_tests.test_neighborhood_iterator(
6540+ x, [-1, 0, -1, 1], x[0], NEIGH_MODE['one'])
6541+ assert_array_equal(l, r)
6542+
6543+ r = [np.array([[4, 4, 4], [4, 0, 1]], dtype=dt),
6544+ np.array([[4, 4, 4], [0, 1, 4]], dtype=dt),
6545+ np.array([[4, 0, 1], [4, 2, 3]], dtype=dt),
6546+ np.array([[0, 1, 4], [2, 3, 4]], dtype=dt)]
6547+ l = _multiarray_tests.test_neighborhood_iterator(
6548+ x, [-1, 0, -1, 1], 4, NEIGH_MODE['constant'])
6549+ assert_array_equal(l, r)
6550+
6551+ def test_mirror2d(self, dt):
6552+ x = np.array([[0, 1], [2, 3]], dtype=dt)
6553+ r = [np.array([[0, 0, 1], [0, 0, 1]], dtype=dt),
6554+ np.array([[0, 1, 1], [0, 1, 1]], dtype=dt),
6555+ np.array([[0, 0, 1], [2, 2, 3]], dtype=dt),
6556+ np.array([[0, 1, 1], [2, 3, 3]], dtype=dt)]
6557+ l = _multiarray_tests.test_neighborhood_iterator(
6558+ x, [-1, 0, -1, 1], x[0], NEIGH_MODE['mirror'])
6559+ assert_array_equal(l, r)
6560+
6561+ # Simple, 1d tests
6562+ def test_simple(self, dt):
6563+ # Test padding with constant values
6564+ x = np.linspace(1, 5, 5).astype(dt)
6565+ r = [[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 0]]
6566+ l = _multiarray_tests.test_neighborhood_iterator(
6567+ x, [-1, 1], x[0], NEIGH_MODE['zero'])
6568+ assert_array_equal(l, r)
6569+
6570+ r = [[1, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 1]]
6571+ l = _multiarray_tests.test_neighborhood_iterator(
6572+ x, [-1, 1], x[0], NEIGH_MODE['one'])
6573+ assert_array_equal(l, r)
6574+
6575+ r = [[x[4], 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, x[4]]]
6576+ l = _multiarray_tests.test_neighborhood_iterator(
6577+ x, [-1, 1], x[4], NEIGH_MODE['constant'])
6578+ assert_array_equal(l, r)
6579+
6580+ # Test mirror modes
6581+ def test_mirror(self, dt):
6582+ x = np.linspace(1, 5, 5).astype(dt)
6583+ r = np.array([[2, 1, 1, 2, 3], [1, 1, 2, 3, 4], [1, 2, 3, 4, 5],
6584+ [2, 3, 4, 5, 5], [3, 4, 5, 5, 4]], dtype=dt)
6585+ l = _multiarray_tests.test_neighborhood_iterator(
6586+ x, [-2, 2], x[1], NEIGH_MODE['mirror'])
6587+ assert_([i.dtype == dt for i in l])
6588+ assert_array_equal(l, r)
6589+
6590+ # Circular mode
6591+ def test_circular(self, dt):
6592+ x = np.linspace(1, 5, 5).astype(dt)
6593+ r = np.array([[4, 5, 1, 2, 3], [5, 1, 2, 3, 4], [1, 2, 3, 4, 5],
6594+ [2, 3, 4, 5, 1], [3, 4, 5, 1, 2]], dtype=dt)
6595+ l = _multiarray_tests.test_neighborhood_iterator(
6596+ x, [-2, 2], x[0], NEIGH_MODE['circular'])
6597+ assert_array_equal(l, r)
6598+
6599+
6600+# Test stacking neighborhood iterators
6601+class TestStackedNeighborhoodIter:
6602+ # Simple, 1d test: stacking 2 constant-padded neigh iterators
6603+ def test_simple_const(self):
6604+ dt = np.float64
6605+ # Test zero and one padding for simple data type
6606+ x = np.array([1, 2, 3], dtype=dt)
6607+ r = [np.array([0], dtype=dt),
6608+ np.array([0], dtype=dt),
6609+ np.array([1], dtype=dt),
6610+ np.array([2], dtype=dt),
6611+ np.array([3], dtype=dt),
6612+ np.array([0], dtype=dt),
6613+ np.array([0], dtype=dt)]
6614+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6615+ x, [-2, 4], NEIGH_MODE['zero'], [0, 0], NEIGH_MODE['zero'])
6616+ assert_array_equal(l, r)
6617+
6618+ r = [np.array([1, 0, 1], dtype=dt),
6619+ np.array([0, 1, 2], dtype=dt),
6620+ np.array([1, 2, 3], dtype=dt),
6621+ np.array([2, 3, 0], dtype=dt),
6622+ np.array([3, 0, 1], dtype=dt)]
6623+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6624+ x, [-1, 3], NEIGH_MODE['zero'], [-1, 1], NEIGH_MODE['one'])
6625+ assert_array_equal(l, r)
6626+
6627+ # 2nd simple, 1d test: stacking 2 neigh iterators, mixing const padding and
6628+ # mirror padding
6629+ def test_simple_mirror(self):
6630+ dt = np.float64
6631+ # Stacking zero on top of mirror
6632+ x = np.array([1, 2, 3], dtype=dt)
6633+ r = [np.array([0, 1, 1], dtype=dt),
6634+ np.array([1, 1, 2], dtype=dt),
6635+ np.array([1, 2, 3], dtype=dt),
6636+ np.array([2, 3, 3], dtype=dt),
6637+ np.array([3, 3, 0], dtype=dt)]
6638+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6639+ x, [-1, 3], NEIGH_MODE['mirror'], [-1, 1], NEIGH_MODE['zero'])
6640+ assert_array_equal(l, r)
6641+
6642+ # Stacking mirror on top of zero
6643+ x = np.array([1, 2, 3], dtype=dt)
6644+ r = [np.array([1, 0, 0], dtype=dt),
6645+ np.array([0, 0, 1], dtype=dt),
6646+ np.array([0, 1, 2], dtype=dt),
6647+ np.array([1, 2, 3], dtype=dt),
6648+ np.array([2, 3, 0], dtype=dt)]
6649+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6650+ x, [-1, 3], NEIGH_MODE['zero'], [-2, 0], NEIGH_MODE['mirror'])
6651+ assert_array_equal(l, r)
6652+
6653+ # Stacking mirror on top of zero: 2nd
6654+ x = np.array([1, 2, 3], dtype=dt)
6655+ r = [np.array([0, 1, 2], dtype=dt),
6656+ np.array([1, 2, 3], dtype=dt),
6657+ np.array([2, 3, 0], dtype=dt),
6658+ np.array([3, 0, 0], dtype=dt),
6659+ np.array([0, 0, 3], dtype=dt)]
6660+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6661+ x, [-1, 3], NEIGH_MODE['zero'], [0, 2], NEIGH_MODE['mirror'])
6662+ assert_array_equal(l, r)
6663+
6664+ # Stacking mirror on top of zero: 3rd
6665+ x = np.array([1, 2, 3], dtype=dt)
6666+ r = [np.array([1, 0, 0, 1, 2], dtype=dt),
6667+ np.array([0, 0, 1, 2, 3], dtype=dt),
6668+ np.array([0, 1, 2, 3, 0], dtype=dt),
6669+ np.array([1, 2, 3, 0, 0], dtype=dt),
6670+ np.array([2, 3, 0, 0, 3], dtype=dt)]
6671+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6672+ x, [-1, 3], NEIGH_MODE['zero'], [-2, 2], NEIGH_MODE['mirror'])
6673+ assert_array_equal(l, r)
6674+
6675+ # 3rd simple, 1d test: stacking 2 neigh iterators, mixing const padding and
6676+ # circular padding
6677+ def test_simple_circular(self):
6678+ dt = np.float64
6679+ # Stacking zero on top of mirror
6680+ x = np.array([1, 2, 3], dtype=dt)
6681+ r = [np.array([0, 3, 1], dtype=dt),
6682+ np.array([3, 1, 2], dtype=dt),
6683+ np.array([1, 2, 3], dtype=dt),
6684+ np.array([2, 3, 1], dtype=dt),
6685+ np.array([3, 1, 0], dtype=dt)]
6686+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6687+ x, [-1, 3], NEIGH_MODE['circular'], [-1, 1], NEIGH_MODE['zero'])
6688+ assert_array_equal(l, r)
6689+
6690+ # Stacking mirror on top of zero
6691+ x = np.array([1, 2, 3], dtype=dt)
6692+ r = [np.array([3, 0, 0], dtype=dt),
6693+ np.array([0, 0, 1], dtype=dt),
6694+ np.array([0, 1, 2], dtype=dt),
6695+ np.array([1, 2, 3], dtype=dt),
6696+ np.array([2, 3, 0], dtype=dt)]
6697+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6698+ x, [-1, 3], NEIGH_MODE['zero'], [-2, 0], NEIGH_MODE['circular'])
6699+ assert_array_equal(l, r)
6700+
6701+ # Stacking mirror on top of zero: 2nd
6702+ x = np.array([1, 2, 3], dtype=dt)
6703+ r = [np.array([0, 1, 2], dtype=dt),
6704+ np.array([1, 2, 3], dtype=dt),
6705+ np.array([2, 3, 0], dtype=dt),
6706+ np.array([3, 0, 0], dtype=dt),
6707+ np.array([0, 0, 1], dtype=dt)]
6708+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6709+ x, [-1, 3], NEIGH_MODE['zero'], [0, 2], NEIGH_MODE['circular'])
6710+ assert_array_equal(l, r)
6711+
6712+ # Stacking mirror on top of zero: 3rd
6713+ x = np.array([1, 2, 3], dtype=dt)
6714+ r = [np.array([3, 0, 0, 1, 2], dtype=dt),
6715+ np.array([0, 0, 1, 2, 3], dtype=dt),
6716+ np.array([0, 1, 2, 3, 0], dtype=dt),
6717+ np.array([1, 2, 3, 0, 0], dtype=dt),
6718+ np.array([2, 3, 0, 0, 1], dtype=dt)]
6719+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6720+ x, [-1, 3], NEIGH_MODE['zero'], [-2, 2], NEIGH_MODE['circular'])
6721+ assert_array_equal(l, r)
6722+
6723+ # 4th simple, 1d test: stacking 2 neigh iterators, but with lower iterator
6724+ # being strictly within the array
6725+ def test_simple_strict_within(self):
6726+ dt = np.float64
6727+ # Stacking zero on top of zero, first neighborhood strictly inside the
6728+ # array
6729+ x = np.array([1, 2, 3], dtype=dt)
6730+ r = [np.array([1, 2, 3, 0], dtype=dt)]
6731+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6732+ x, [1, 1], NEIGH_MODE['zero'], [-1, 2], NEIGH_MODE['zero'])
6733+ assert_array_equal(l, r)
6734+
6735+ # Stacking mirror on top of zero, first neighborhood strictly inside the
6736+ # array
6737+ x = np.array([1, 2, 3], dtype=dt)
6738+ r = [np.array([1, 2, 3, 3], dtype=dt)]
6739+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6740+ x, [1, 1], NEIGH_MODE['zero'], [-1, 2], NEIGH_MODE['mirror'])
6741+ assert_array_equal(l, r)
6742+
6743+ # Stacking mirror on top of zero, first neighborhood strictly inside the
6744+ # array
6745+ x = np.array([1, 2, 3], dtype=dt)
6746+ r = [np.array([1, 2, 3, 1], dtype=dt)]
6747+ l = _multiarray_tests.test_neighborhood_iterator_oob(
6748+ x, [1, 1], NEIGH_MODE['zero'], [-1, 2], NEIGH_MODE['circular'])
6749+ assert_array_equal(l, r)
6750+
6751+class TestWarnings:
6752+
6753+ def test_complex_warning(self):
6754+ x = np.array([1, 2])
6755+ y = np.array([1-2j, 1+2j])
6756+
6757+ with warnings.catch_warnings():
6758+ warnings.simplefilter("error", np.ComplexWarning)
6759+ assert_raises(np.ComplexWarning, x.__setitem__, slice(None), y)
6760+ assert_equal(x, [1, 2])
6761+
6762+
6763+class TestMinScalarType:
6764+
6765+ def test_usigned_shortshort(self):
6766+ dt = np.min_scalar_type(2**8-1)
6767+ wanted = np.dtype('uint8')
6768+ assert_equal(wanted, dt)
6769+
6770+ def test_usigned_short(self):
6771+ dt = np.min_scalar_type(2**16-1)
6772+ wanted = np.dtype('uint16')
6773+ assert_equal(wanted, dt)
6774+
6775+ def test_usigned_int(self):
6776+ dt = np.min_scalar_type(2**32-1)
6777+ wanted = np.dtype('uint32')
6778+ assert_equal(wanted, dt)
6779+
6780+ def test_usigned_longlong(self):
6781+ dt = np.min_scalar_type(2**63-1)
6782+ wanted = np.dtype('uint64')
6783+ assert_equal(wanted, dt)
6784+
6785+ def test_object(self):
6786+ dt = np.min_scalar_type(2**64)
6787+ wanted = np.dtype('O')
6788+ assert_equal(wanted, dt)
6789+
6790+
6791+from numpy.core._internal import _dtype_from_pep3118
6792+
6793+
6794+class TestPEP3118Dtype:
6795+ def _check(self, spec, wanted):
6796+ dt = np.dtype(wanted)
6797+ actual = _dtype_from_pep3118(spec)
6798+ assert_equal(actual, dt,
6799+ err_msg="spec %r != dtype %r" % (spec, wanted))
6800+
6801+ def test_native_padding(self):
6802+ align = np.dtype('i').alignment
6803+ for j in range(8):
6804+ if j == 0:
6805+ s = 'bi'
6806+ else:
6807+ s = 'b%dxi' % j
6808+ self._check('@'+s, {'f0': ('i1', 0),
6809+ 'f1': ('i', align*(1 + j//align))})
6810+ self._check('='+s, {'f0': ('i1', 0),
6811+ 'f1': ('i', 1+j)})
6812+
6813+ def test_native_padding_2(self):
6814+ # Native padding should work also for structs and sub-arrays
6815+ self._check('x3T{xi}', {'f0': (({'f0': ('i', 4)}, (3,)), 4)})
6816+ self._check('^x3T{xi}', {'f0': (({'f0': ('i', 1)}, (3,)), 1)})
6817+
6818+ def test_trailing_padding(self):
6819+ # Trailing padding should be included, *and*, the item size
6820+ # should match the alignment if in aligned mode
6821+ align = np.dtype('i').alignment
6822+ size = np.dtype('i').itemsize
6823+
6824+ def aligned(n):
6825+ return align*(1 + (n-1)//align)
6826+
6827+ base = dict(formats=['i'], names=['f0'])
6828+
6829+ self._check('ix', dict(itemsize=aligned(size + 1), **base))
6830+ self._check('ixx', dict(itemsize=aligned(size + 2), **base))
6831+ self._check('ixxx', dict(itemsize=aligned(size + 3), **base))
6832+ self._check('ixxxx', dict(itemsize=aligned(size + 4), **base))
6833+ self._check('i7x', dict(itemsize=aligned(size + 7), **base))
6834+
6835+ self._check('^ix', dict(itemsize=size + 1, **base))
6836+ self._check('^ixx', dict(itemsize=size + 2, **base))
6837+ self._check('^ixxx', dict(itemsize=size + 3, **base))
6838+ self._check('^ixxxx', dict(itemsize=size + 4, **base))
6839+ self._check('^i7x', dict(itemsize=size + 7, **base))
6840+
6841+ def test_native_padding_3(self):
6842+ dt = np.dtype(
6843+ [('a', 'b'), ('b', 'i'),
6844+ ('sub', np.dtype('b,i')), ('c', 'i')],
6845+ align=True)
6846+ self._check("T{b:a:xxxi:b:T{b:f0:=i:f1:}:sub:xxxi:c:}", dt)
6847+
6848+ dt = np.dtype(
6849+ [('a', 'b'), ('b', 'i'), ('c', 'b'), ('d', 'b'),
6850+ ('e', 'b'), ('sub', np.dtype('b,i', align=True))])
6851+ self._check("T{b:a:=i:b:b:c:b:d:b:e:T{b:f0:xxxi:f1:}:sub:}", dt)
6852+
6853+ def test_padding_with_array_inside_struct(self):
6854+ dt = np.dtype(
6855+ [('a', 'b'), ('b', 'i'), ('c', 'b', (3,)),
6856+ ('d', 'i')],
6857+ align=True)
6858+ self._check("T{b:a:xxxi:b:3b:c:xi:d:}", dt)
6859+
6860+ def test_byteorder_inside_struct(self):
6861+ # The byte order after @T{=i} should be '=', not '@'.
6862+ # Check this by noting the absence of native alignment.
6863+ self._check('@T{^i}xi', {'f0': ({'f0': ('i', 0)}, 0),
6864+ 'f1': ('i', 5)})
6865+
6866+ def test_intra_padding(self):
6867+ # Natively aligned sub-arrays may require some internal padding
6868+ align = np.dtype('i').alignment
6869+ size = np.dtype('i').itemsize
6870+
6871+ def aligned(n):
6872+ return (align*(1 + (n-1)//align))
6873+
6874+ self._check('(3)T{ix}', (dict(
6875+ names=['f0'],
6876+ formats=['i'],
6877+ offsets=[0],
6878+ itemsize=aligned(size + 1)
6879+ ), (3,)))
6880+
6881+ def test_char_vs_string(self):
6882+ dt = np.dtype('c')
6883+ self._check('c', dt)
6884+
6885+ dt = np.dtype([('f0', 'S1', (4,)), ('f1', 'S4')])
6886+ self._check('4c4s', dt)
6887+
6888+ def test_field_order(self):
6889+ # gh-9053 - previously, we relied on dictionary key order
6890+ self._check("(0)I:a:f:b:", [('a', 'I', (0,)), ('b', 'f')])
6891+ self._check("(0)I:b:f:a:", [('b', 'I', (0,)), ('a', 'f')])
6892+
6893+ def test_unnamed_fields(self):
6894+ self._check('ii', [('f0', 'i'), ('f1', 'i')])
6895+ self._check('ii:f0:', [('f1', 'i'), ('f0', 'i')])
6896+
6897+ self._check('i', 'i')
6898+ self._check('i:f0:', [('f0', 'i')])
6899+
6900+
6901+class TestNewBufferProtocol:
6902+ """ Test PEP3118 buffers """
6903+
6904+ def _check_roundtrip(self, obj):
6905+ obj = np.asarray(obj)
6906+ x = memoryview(obj)
6907+ y = np.asarray(x)
6908+ y2 = np.array(x)
6909+ assert_(not y.flags.owndata)
6910+ assert_(y2.flags.owndata)
6911+
6912+ assert_equal(y.dtype, obj.dtype)
6913+ assert_equal(y.shape, obj.shape)
6914+ assert_array_equal(obj, y)
6915+
6916+ assert_equal(y2.dtype, obj.dtype)
6917+ assert_equal(y2.shape, obj.shape)
6918+ assert_array_equal(obj, y2)
6919+
6920+ def test_roundtrip(self):
6921+ x = np.array([1, 2, 3, 4, 5], dtype='i4')
6922+ self._check_roundtrip(x)
6923+
6924+ x = np.array([[1, 2], [3, 4]], dtype=np.float64)
6925+ self._check_roundtrip(x)
6926+
6927+ x = np.zeros((3, 3, 3), dtype=np.float32)[:, 0,:]
6928+ self._check_roundtrip(x)
6929+
6930+ dt = [('a', 'b'),
6931+ ('b', 'h'),
6932+ ('c', 'i'),
6933+ ('d', 'l'),
6934+ ('dx', 'q'),
6935+ ('e', 'B'),
6936+ ('f', 'H'),
6937+ ('g', 'I'),
6938+ ('h', 'L'),
6939+ ('hx', 'Q'),
6940+ ('i', np.single),
6941+ ('j', np.double),
6942+ ('k', np.longdouble),
6943+ ('ix', np.csingle),
6944+ ('jx', np.cdouble),
6945+ ('kx', np.clongdouble),
6946+ ('l', 'S4'),
6947+ ('m', 'U4'),
6948+ ('n', 'V3'),
6949+ ('o', '?'),
6950+ ('p', np.half),
6951+ ]
6952+ x = np.array(
6953+ [(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6954+ b'aaaa', 'bbbb', b'xxx', True, 1.0)],
6955+ dtype=dt)
6956+ self._check_roundtrip(x)
6957+
6958+ x = np.array(([[1, 2], [3, 4]],), dtype=[('a', (int, (2, 2)))])
6959+ self._check_roundtrip(x)
6960+
6961+ x = np.array([1, 2, 3], dtype='>i2')
6962+ self._check_roundtrip(x)
6963+
6964+ x = np.array([1, 2, 3], dtype='<i2')
6965+ self._check_roundtrip(x)
6966+
6967+ x = np.array([1, 2, 3], dtype='>i4')
6968+ self._check_roundtrip(x)
6969+
6970+ x = np.array([1, 2, 3], dtype='<i4')
6971+ self._check_roundtrip(x)
6972+
6973+ # check long long can be represented as non-native
6974+ x = np.array([1, 2, 3], dtype='>q')
6975+ self._check_roundtrip(x)
6976+
6977+ # Native-only data types can be passed through the buffer interface
6978+ # only in native byte order
6979+ if sys.byteorder == 'little':
6980+ x = np.array([1, 2, 3], dtype='>g')
6981+ assert_raises(ValueError, self._check_roundtrip, x)
6982+ x = np.array([1, 2, 3], dtype='<g')
6983+ self._check_roundtrip(x)
6984+ else:
6985+ x = np.array([1, 2, 3], dtype='>g')
6986+ self._check_roundtrip(x)
6987+ x = np.array([1, 2, 3], dtype='<g')
6988+ assert_raises(ValueError, self._check_roundtrip, x)
6989+
6990+ def test_roundtrip_half(self):
6991+ half_list = [
6992+ 1.0,
6993+ -2.0,
6994+ 6.5504 * 10**4, # (max half precision)
6995+ 2**-14, # ~= 6.10352 * 10**-5 (minimum positive normal)
6996+ 2**-24, # ~= 5.96046 * 10**-8 (minimum strictly positive subnormal)
6997+ 0.0,
6998+ -0.0,
6999+ float('+inf'),
7000+ float('-inf'),
7001+ 0.333251953125, # ~= 1/3
7002+ ]
7003+
7004+ x = np.array(half_list, dtype='>e')
7005+ self._check_roundtrip(x)
7006+ x = np.array(half_list, dtype='<e')
7007+ self._check_roundtrip(x)
7008+
7009+ def test_roundtrip_single_types(self):
7010+ for typ in np.typeDict.values():
7011+ dtype = np.dtype(typ)
7012+
7013+ if dtype.char in 'Mm':
7014+ # datetimes cannot be used in buffers
7015+ continue
7016+ if dtype.char == 'V':
7017+ # skip void
7018+ continue
7019+
7020+ x = np.zeros(4, dtype=dtype)
7021+ self._check_roundtrip(x)
7022+
7023+ if dtype.char not in 'qQgG':
7024+ dt = dtype.newbyteorder('<')
7025+ x = np.zeros(4, dtype=dt)
7026+ self._check_roundtrip(x)
7027+
7028+ dt = dtype.newbyteorder('>')
7029+ x = np.zeros(4, dtype=dt)
7030+ self._check_roundtrip(x)
7031+
7032+ def test_roundtrip_scalar(self):
7033+ # Issue #4015.
7034+ self._check_roundtrip(0)
7035+
7036+ def test_invalid_buffer_format(self):
7037+ # datetime64 cannot be used fully in a buffer yet
7038+ # Should be fixed in the next Numpy major release
7039+ dt = np.dtype([('a', 'uint16'), ('b', 'M8[s]')])
7040+ a = np.empty(3, dt)
7041+ assert_raises((ValueError, BufferError), memoryview, a)
7042+ assert_raises((ValueError, BufferError), memoryview, np.array((3), 'M8[D]'))
7043+
7044+ def test_export_simple_1d(self):
7045+ x = np.array([1, 2, 3, 4, 5], dtype='i')
7046+ y = memoryview(x)
7047+ assert_equal(y.format, 'i')
7048+ assert_equal(y.shape, (5,))
7049+ assert_equal(y.ndim, 1)
7050+ assert_equal(y.strides, (4,))
7051+ assert_equal(y.suboffsets, ())
7052+ assert_equal(y.itemsize, 4)
7053+
7054+ def test_export_simple_nd(self):
7055+ x = np.array([[1, 2], [3, 4]], dtype=np.float64)
7056+ y = memoryview(x)
7057+ assert_equal(y.format, 'd')
7058+ assert_equal(y.shape, (2, 2))
7059+ assert_equal(y.ndim, 2)
7060+ assert_equal(y.strides, (16, 8))
7061+ assert_equal(y.suboffsets, ())
7062+ assert_equal(y.itemsize, 8)
7063+
7064+ def test_export_discontiguous(self):
7065+ x = np.zeros((3, 3, 3), dtype=np.float32)[:, 0,:]
7066+ y = memoryview(x)
7067+ assert_equal(y.format, 'f')
7068+ assert_equal(y.shape, (3, 3))
7069+ assert_equal(y.ndim, 2)
7070+ assert_equal(y.strides, (36, 4))
7071+ assert_equal(y.suboffsets, ())
7072+ assert_equal(y.itemsize, 4)
7073+
7074+ def test_export_record(self):
7075+ dt = [('a', 'b'),
7076+ ('b', 'h'),
7077+ ('c', 'i'),
7078+ ('d', 'l'),
7079+ ('dx', 'q'),
7080+ ('e', 'B'),
7081+ ('f', 'H'),
7082+ ('g', 'I'),
7083+ ('h', 'L'),
7084+ ('hx', 'Q'),
7085+ ('i', np.single),
7086+ ('j', np.double),
7087+ ('k', np.longdouble),
7088+ ('ix', np.csingle),
7089+ ('jx', np.cdouble),
7090+ ('kx', np.clongdouble),
7091+ ('l', 'S4'),
7092+ ('m', 'U4'),
7093+ ('n', 'V3'),
7094+ ('o', '?'),
7095+ ('p', np.half),
7096+ ]
7097+ x = np.array(
7098+ [(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7099+ b'aaaa', 'bbbb', b' ', True, 1.0)],
7100+ dtype=dt)
7101+ y = memoryview(x)
7102+ assert_equal(y.shape, (1,))
7103+ assert_equal(y.ndim, 1)
7104+ assert_equal(y.suboffsets, ())
7105+
7106+ sz = sum([np.dtype(b).itemsize for a, b in dt])
7107+ if np.dtype('l').itemsize == 4:
7108+ assert_equal(y.format, 'T{b:a:=h:b:i:c:l:d:q:dx:B:e:@H:f:=I:g:L:h:Q:hx:f:i:d:j:^g:k:=Zf:ix:Zd:jx:^Zg:kx:4s:l:=4w:m:3x:n:?:o:@e:p:}')
7109+ else:
7110+ assert_equal(y.format, 'T{b:a:=h:b:i:c:q:d:q:dx:B:e:@H:f:=I:g:Q:h:Q:hx:f:i:d:j:^g:k:=Zf:ix:Zd:jx:^Zg:kx:4s:l:=4w:m:3x:n:?:o:@e:p:}')
7111+ # Cannot test if NPY_RELAXED_STRIDES_CHECKING changes the strides
7112+ if not (np.ones(1).strides[0] == np.iinfo(np.intp).max):
7113+ assert_equal(y.strides, (sz,))
7114+ assert_equal(y.itemsize, sz)
7115+
7116+ def test_export_subarray(self):
7117+ x = np.array(([[1, 2], [3, 4]],), dtype=[('a', ('i', (2, 2)))])
7118+ y = memoryview(x)
7119+ assert_equal(y.format, 'T{(2,2)i:a:}')
7120+ assert_equal(y.shape, ())
7121+ assert_equal(y.ndim, 0)
7122+ assert_equal(y.strides, ())
7123+ assert_equal(y.suboffsets, ())
7124+ assert_equal(y.itemsize, 16)
7125+
7126+ def test_export_endian(self):
7127+ x = np.array([1, 2, 3], dtype='>i')
7128+ y = memoryview(x)
7129+ if sys.byteorder == 'little':
7130+ assert_equal(y.format, '>i')
7131+ else:
7132+ assert_equal(y.format, 'i')
7133+
7134+ x = np.array([1, 2, 3], dtype='<i')
7135+ y = memoryview(x)
7136+ if sys.byteorder == 'little':
7137+ assert_equal(y.format, 'i')
7138+ else:
7139+ assert_equal(y.format, '<i')
7140+
7141+ def test_export_flags(self):
7142+ # Check SIMPLE flag, see also gh-3613 (exception should be BufferError)
7143+ assert_raises(ValueError,
7144+ _multiarray_tests.get_buffer_info,
7145+ np.arange(5)[::2], ('SIMPLE',))
7146+
7147+ def test_padding(self):
7148+ for j in range(8):
7149+ x = np.array([(1,), (2,)], dtype={'f0': (int, j)})
7150+ self._check_roundtrip(x)
7151+
7152+ def test_reference_leak(self):
7153+ if HAS_REFCOUNT:
7154+ count_1 = sys.getrefcount(np.core._internal)
7155+ a = np.zeros(4)
7156+ b = memoryview(a)
7157+ c = np.asarray(b)
7158+ if HAS_REFCOUNT:
7159+ count_2 = sys.getrefcount(np.core._internal)
7160+ assert_equal(count_1, count_2)
7161+ del c # avoid pyflakes unused variable warning.
7162+
7163+ def test_padded_struct_array(self):
7164+ dt1 = np.dtype(
7165+ [('a', 'b'), ('b', 'i'), ('sub', np.dtype('b,i')), ('c', 'i')],
7166+ align=True)
7167+ x1 = np.arange(dt1.itemsize, dtype=np.int8).view(dt1)
7168+ self._check_roundtrip(x1)
7169+
7170+ dt2 = np.dtype(
7171+ [('a', 'b'), ('b', 'i'), ('c', 'b', (3,)), ('d', 'i')],
7172+ align=True)
7173+ x2 = np.arange(dt2.itemsize, dtype=np.int8).view(dt2)
7174+ self._check_roundtrip(x2)
7175+
7176+ dt3 = np.dtype(
7177+ [('a', 'b'), ('b', 'i'), ('c', 'b'), ('d', 'b'),
7178+ ('e', 'b'), ('sub', np.dtype('b,i', align=True))])
7179+ x3 = np.arange(dt3.itemsize, dtype=np.int8).view(dt3)
7180+ self._check_roundtrip(x3)
7181+
7182+ @pytest.mark.valgrind_error(reason="leaks buffer info cache temporarily.")
7183+ def test_relaxed_strides(self, c=np.ones((1, 10, 10), dtype='i8')):
7184+ # Note: c defined as parameter so that it is persistent and leak
7185+ # checks will notice gh-16934 (buffer info cache leak).
7186+
7187+ # Check for NPY_RELAXED_STRIDES_CHECKING:
7188+ if np.ones((10, 1), order="C").flags.f_contiguous:
7189+ c.strides = (-1, 80, 8)
7190+
7191+ assert_(memoryview(c).strides == (800, 80, 8))
7192+
7193+ # Writing C-contiguous data to a BytesIO buffer should work
7194+ fd = io.BytesIO()
7195+ fd.write(c.data)
7196+
7197+ fortran = c.T
7198+ assert_(memoryview(fortran).strides == (8, 80, 800))
7199+
7200+ arr = np.ones((1, 10))
7201+ if arr.flags.f_contiguous:
7202+ shape, strides = _multiarray_tests.get_buffer_info(
7203+ arr, ['F_CONTIGUOUS'])
7204+ assert_(strides[0] == 8)
7205+ arr = np.ones((10, 1), order='F')
7206+ shape, strides = _multiarray_tests.get_buffer_info(
7207+ arr, ['C_CONTIGUOUS'])
7208+ assert_(strides[-1] == 8)
7209+
7210+ @pytest.mark.valgrind_error(reason="leaks buffer info cache temporarily.")
7211+ @pytest.mark.skipif(not np.ones((10, 1), order="C").flags.f_contiguous,
7212+ reason="Test is unnecessary (but fails) without relaxed strides.")
7213+ def test_relaxed_strides_buffer_info_leak(self, arr=np.ones((1, 10))):
7214+ """Test that alternating export of C- and F-order buffers from
7215+ an array which is both C- and F-order when relaxed strides is
7216+ active works.
7217+ This test defines array in the signature to ensure leaking more
7218+ references every time the test is run (catching the leak with
7219+ pytest-leaks).
7220+ """
7221+ for i in range(10):
7222+ _, s = _multiarray_tests.get_buffer_info(arr, ['F_CONTIGUOUS'])
7223+ assert s == (8, 8)
7224+ _, s = _multiarray_tests.get_buffer_info(arr, ['C_CONTIGUOUS'])
7225+ assert s == (80, 8)
7226+
7227+ def test_out_of_order_fields(self):
7228+ dt = np.dtype(dict(
7229+ formats=['<i4', '<i4'],
7230+ names=['one', 'two'],
7231+ offsets=[4, 0],
7232+ itemsize=8
7233+ ))
7234+
7235+ # overlapping fields cannot be represented by PEP3118
7236+ arr = np.empty(1, dt)
7237+ with assert_raises(ValueError):
7238+ memoryview(arr)
7239+
7240+ def test_max_dims(self):
7241+ a = np.empty((1,) * 32)
7242+ self._check_roundtrip(a)
7243+
7244+ @pytest.mark.slow
7245+ def test_error_too_many_dims(self):
7246+ def make_ctype(shape, scalar_type):
7247+ t = scalar_type
7248+ for dim in shape[::-1]:
7249+ t = dim * t
7250+ return t
7251+
7252+ # construct a memoryview with 33 dimensions
7253+ c_u8_33d = make_ctype((1,)*33, ctypes.c_uint8)
7254+ m = memoryview(c_u8_33d())
7255+ assert_equal(m.ndim, 33)
7256+
7257+ assert_raises_regex(
7258+ RuntimeError, "ndim",
7259+ np.array, m)
7260+
7261+ # The above seems to create some deep cycles, clean them up for
7262+ # easier reference count debugging:
7263+ del c_u8_33d, m
7264+ for i in range(33):
7265+ if gc.collect() == 0:
7266+ break
7267+
7268+ def test_error_pointer_type(self):
7269+ # gh-6741
7270+ m = memoryview(ctypes.pointer(ctypes.c_uint8()))
7271+ assert_('&' in m.format)
7272+
7273+ assert_raises_regex(
7274+ ValueError, "format string",
7275+ np.array, m)
7276+
7277+ def test_error_message_unsupported(self):
7278+ # wchar has no corresponding numpy type - if this changes in future, we
7279+ # need a better way to construct an invalid memoryview format.
7280+ t = ctypes.c_wchar * 4
7281+ with assert_raises(ValueError) as cm:
7282+ np.array(t())
7283+
7284+ exc = cm.exception
7285+ with assert_raises_regex(
7286+ NotImplementedError,
7287+ r"Unrepresentable .* 'u' \(UCS-2 strings\)"
7288+ ):
7289+ raise exc.__cause__
7290+
7291+ def test_ctypes_integer_via_memoryview(self):
7292+ # gh-11150, due to bpo-10746
7293+ for c_integer in {ctypes.c_int, ctypes.c_long, ctypes.c_longlong}:
7294+ value = c_integer(42)
7295+ with warnings.catch_warnings(record=True):
7296+ warnings.filterwarnings('always', r'.*\bctypes\b', RuntimeWarning)
7297+ np.asarray(value)
7298+
7299+ def test_ctypes_struct_via_memoryview(self):
7300+ # gh-10528
7301+ class foo(ctypes.Structure):
7302+ _fields_ = [('a', ctypes.c_uint8), ('b', ctypes.c_uint32)]
7303+ f = foo(a=1, b=2)
7304+
7305+ with warnings.catch_warnings(record=True):
7306+ warnings.filterwarnings('always', r'.*\bctypes\b', RuntimeWarning)
7307+ arr = np.asarray(f)
7308+
7309+ assert_equal(arr['a'], 1)
7310+ assert_equal(arr['b'], 2)
7311+ f.a = 3
7312+ assert_equal(arr['a'], 3)
7313+
7314+
7315+class TestArrayAttributeDeletion:
7316+
7317+ def test_multiarray_writable_attributes_deletion(self):
7318+ # ticket #2046, should not seqfault, raise AttributeError
7319+ a = np.ones(2)
7320+ attr = ['shape', 'strides', 'data', 'dtype', 'real', 'imag', 'flat']
7321+ with suppress_warnings() as sup:
7322+ sup.filter(DeprecationWarning, "Assigning the 'data' attribute")
7323+ for s in attr:
7324+ assert_raises(AttributeError, delattr, a, s)
7325+
7326+ def test_multiarray_not_writable_attributes_deletion(self):
7327+ a = np.ones(2)
7328+ attr = ["ndim", "flags", "itemsize", "size", "nbytes", "base",
7329+ "ctypes", "T", "__array_interface__", "__array_struct__",
7330+ "__array_priority__", "__array_finalize__"]
7331+ for s in attr:
7332+ assert_raises(AttributeError, delattr, a, s)
7333+
7334+ def test_multiarray_flags_writable_attribute_deletion(self):
7335+ a = np.ones(2).flags
7336+ attr = ['writebackifcopy', 'updateifcopy', 'aligned', 'writeable']
7337+ for s in attr:
7338+ assert_raises(AttributeError, delattr, a, s)
7339+
7340+ def test_multiarray_flags_not_writable_attribute_deletion(self):
7341+ a = np.ones(2).flags
7342+ attr = ["contiguous", "c_contiguous", "f_contiguous", "fortran",
7343+ "owndata", "fnc", "forc", "behaved", "carray", "farray",
7344+ "num"]
7345+ for s in attr:
7346+ assert_raises(AttributeError, delattr, a, s)
7347+
7348+
7349+class TestArrayInterface():
7350+ class Foo:
7351+ def __init__(self, value):
7352+ self.value = value
7353+ self.iface = {'typestr': 'f8'}
7354+
7355+ def __float__(self):
7356+ return float(self.value)
7357+
7358+ @property
7359+ def __array_interface__(self):
7360+ return self.iface
7361+
7362+
7363+ f = Foo(0.5)
7364+
7365+ @pytest.mark.parametrize('val, iface, expected', [
7366+ (f, {}, 0.5),
7367+ ([f], {}, [0.5]),
7368+ ([f, f], {}, [0.5, 0.5]),
7369+ (f, {'shape': ()}, 0.5),
7370+ (f, {'shape': None}, TypeError),
7371+ (f, {'shape': (1, 1)}, [[0.5]]),
7372+ (f, {'shape': (2,)}, ValueError),
7373+ (f, {'strides': ()}, 0.5),
7374+ (f, {'strides': (2,)}, ValueError),
7375+ (f, {'strides': 16}, TypeError),
7376+ ])
7377+ def test_scalar_interface(self, val, iface, expected):
7378+ # Test scalar coercion within the array interface
7379+ self.f.iface = {'typestr': 'f8'}
7380+ self.f.iface.update(iface)
7381+ if HAS_REFCOUNT:
7382+ pre_cnt = sys.getrefcount(np.dtype('f8'))
7383+ if isinstance(expected, type):
7384+ assert_raises(expected, np.array, val)
7385+ else:
7386+ result = np.array(val)
7387+ assert_equal(np.array(val), expected)
7388+ assert result.dtype == 'f8'
7389+ del result
7390+ if HAS_REFCOUNT:
7391+ post_cnt = sys.getrefcount(np.dtype('f8'))
7392+ assert_equal(pre_cnt, post_cnt)
7393+
7394+def test_interface_no_shape():
7395+ class ArrayLike:
7396+ array = np.array(1)
7397+ __array_interface__ = array.__array_interface__
7398+ assert_equal(np.array(ArrayLike()), 1)
7399+
7400+
7401+def test_array_interface_itemsize():
7402+ # See gh-6361
7403+ my_dtype = np.dtype({'names': ['A', 'B'], 'formats': ['f4', 'f4'],
7404+ 'offsets': [0, 8], 'itemsize': 16})
7405+ a = np.ones(10, dtype=my_dtype)
7406+ descr_t = np.dtype(a.__array_interface__['descr'])
7407+ typestr_t = np.dtype(a.__array_interface__['typestr'])
7408+ assert_equal(descr_t.itemsize, typestr_t.itemsize)
7409+
7410+
7411+def test_array_interface_empty_shape():
7412+ # See gh-7994
7413+ arr = np.array([1, 2, 3])
7414+ interface1 = dict(arr.__array_interface__)
7415+ interface1['shape'] = ()
7416+
7417+ class DummyArray1:
7418+ __array_interface__ = interface1
7419+
7420+ # NOTE: Because Py2 str/Py3 bytes supports the buffer interface, setting
7421+ # the interface data to bytes would invoke the bug this tests for, that
7422+ # __array_interface__ with shape=() is not allowed if the data is an object
7423+ # exposing the buffer interface
7424+ interface2 = dict(interface1)
7425+ interface2['data'] = arr[0].tobytes()
7426+
7427+ class DummyArray2:
7428+ __array_interface__ = interface2
7429+
7430+ arr1 = np.asarray(DummyArray1())
7431+ arr2 = np.asarray(DummyArray2())
7432+ arr3 = arr[:1].reshape(())
7433+ assert_equal(arr1, arr2)
7434+ assert_equal(arr1, arr3)
7435+
7436+def test_array_interface_offset():
7437+ arr = np.array([1, 2, 3], dtype='int32')
7438+ interface = dict(arr.__array_interface__)
7439+ interface['data'] = memoryview(arr)
7440+ interface['shape'] = (2,)
7441+ interface['offset'] = 4
7442+
7443+
7444+ class DummyArray:
7445+ __array_interface__ = interface
7446+
7447+ arr1 = np.asarray(DummyArray())
7448+ assert_equal(arr1, arr[1:])
7449+
7450+def test_flat_element_deletion():
7451+ it = np.ones(3).flat
7452+ try:
7453+ del it[1]
7454+ del it[1:2]
7455+ except TypeError:
7456+ pass
7457+ except Exception:
7458+ raise AssertionError
7459+
7460+
7461+def test_scalar_element_deletion():
7462+ a = np.zeros(2, dtype=[('x', 'int'), ('y', 'int')])
7463+ assert_raises(ValueError, a[0].__delitem__, 'x')
7464+
7465+
7466+class TestMemEventHook:
7467+ def test_mem_seteventhook(self):
7468+ # The actual tests are within the C code in
7469+ # multiarray/_multiarray_tests.c.src
7470+ _multiarray_tests.test_pydatamem_seteventhook_start()
7471+ # force an allocation and free of a numpy array
7472+ # needs to be larger then limit of small memory cacher in ctors.c
7473+ a = np.zeros(1000)
7474+ del a
7475+ break_cycles()
7476+ _multiarray_tests.test_pydatamem_seteventhook_end()
7477+
7478+class TestMapIter:
7479+ def test_mapiter(self):
7480+ # The actual tests are within the C code in
7481+ # multiarray/_multiarray_tests.c.src
7482+
7483+ a = np.arange(12).reshape((3, 4)).astype(float)
7484+ index = ([1, 1, 2, 0],
7485+ [0, 0, 2, 3])
7486+ vals = [50, 50, 30, 16]
7487+
7488+ _multiarray_tests.test_inplace_increment(a, index, vals)
7489+ assert_equal(a, [[0.00, 1., 2.0, 19.],
7490+ [104., 5., 6.0, 7.0],
7491+ [8.00, 9., 40., 11.]])
7492+
7493+ b = np.arange(6).astype(float)
7494+ index = (np.array([1, 2, 0]),)
7495+ vals = [50, 4, 100.1]
7496+ _multiarray_tests.test_inplace_increment(b, index, vals)
7497+ assert_equal(b, [100.1, 51., 6., 3., 4., 5.])
7498+
7499+
7500+class TestAsCArray:
7501+ def test_1darray(self):
7502+ array = np.arange(24, dtype=np.double)
7503+ from_c = _multiarray_tests.test_as_c_array(array, 3)
7504+ assert_equal(array[3], from_c)
7505+
7506+ def test_2darray(self):
7507+ array = np.arange(24, dtype=np.double).reshape(3, 8)
7508+ from_c = _multiarray_tests.test_as_c_array(array, 2, 4)
7509+ assert_equal(array[2, 4], from_c)
7510+
7511+ def test_3darray(self):
7512+ array = np.arange(24, dtype=np.double).reshape(2, 3, 4)
7513+ from_c = _multiarray_tests.test_as_c_array(array, 1, 2, 3)
7514+ assert_equal(array[1, 2, 3], from_c)
7515+
7516+
7517+class TestConversion:
7518+ def test_array_scalar_relational_operation(self):
7519+ # All integer
7520+ for dt1 in np.typecodes['AllInteger']:
7521+ assert_(1 > np.array(0, dtype=dt1), "type %s failed" % (dt1,))
7522+ assert_(not 1 < np.array(0, dtype=dt1), "type %s failed" % (dt1,))
7523+
7524+ for dt2 in np.typecodes['AllInteger']:
7525+ assert_(np.array(1, dtype=dt1) > np.array(0, dtype=dt2),
7526+ "type %s and %s failed" % (dt1, dt2))
7527+ assert_(not np.array(1, dtype=dt1) < np.array(0, dtype=dt2),
7528+ "type %s and %s failed" % (dt1, dt2))
7529+
7530+ # Unsigned integers
7531+ for dt1 in 'BHILQP':
7532+ assert_(-1 < np.array(1, dtype=dt1), "type %s failed" % (dt1,))
7533+ assert_(not -1 > np.array(1, dtype=dt1), "type %s failed" % (dt1,))
7534+ assert_(-1 != np.array(1, dtype=dt1), "type %s failed" % (dt1,))
7535+
7536+ # Unsigned vs signed
7537+ for dt2 in 'bhilqp':
7538+ assert_(np.array(1, dtype=dt1) > np.array(-1, dtype=dt2),
7539+ "type %s and %s failed" % (dt1, dt2))
7540+ assert_(not np.array(1, dtype=dt1) < np.array(-1, dtype=dt2),
7541+ "type %s and %s failed" % (dt1, dt2))
7542+ assert_(np.array(1, dtype=dt1) != np.array(-1, dtype=dt2),
7543+ "type %s and %s failed" % (dt1, dt2))
7544+
7545+ # Signed integers and floats
7546+ for dt1 in 'bhlqp' + np.typecodes['Float']:
7547+ assert_(1 > np.array(-1, dtype=dt1), "type %s failed" % (dt1,))
7548+ assert_(not 1 < np.array(-1, dtype=dt1), "type %s failed" % (dt1,))
7549+ assert_(-1 == np.array(-1, dtype=dt1), "type %s failed" % (dt1,))
7550+
7551+ for dt2 in 'bhlqp' + np.typecodes['Float']:
7552+ assert_(np.array(1, dtype=dt1) > np.array(-1, dtype=dt2),
7553+ "type %s and %s failed" % (dt1, dt2))
7554+ assert_(not np.array(1, dtype=dt1) < np.array(-1, dtype=dt2),
7555+ "type %s and %s failed" % (dt1, dt2))
7556+ assert_(np.array(-1, dtype=dt1) == np.array(-1, dtype=dt2),
7557+ "type %s and %s failed" % (dt1, dt2))
7558+
7559+ def test_to_bool_scalar(self):
7560+ assert_equal(bool(np.array([False])), False)
7561+ assert_equal(bool(np.array([True])), True)
7562+ assert_equal(bool(np.array([[42]])), True)
7563+ assert_raises(ValueError, bool, np.array([1, 2]))
7564+
7565+ class NotConvertible:
7566+ def __bool__(self):
7567+ raise NotImplementedError
7568+
7569+ assert_raises(NotImplementedError, bool, np.array(NotConvertible()))
7570+ assert_raises(NotImplementedError, bool, np.array([NotConvertible()]))
7571+
7572+ self_containing = np.array([None])
7573+ self_containing[0] = self_containing
7574+ try:
7575+ Error = RecursionError
7576+ except NameError:
7577+ Error = RuntimeError # python < 3.5
7578+ assert_raises(Error, bool, self_containing) # previously stack overflow
7579+ self_containing[0] = None # resolve circular reference
7580+
7581+ def test_to_int_scalar(self):
7582+ # gh-9972 means that these aren't always the same
7583+ int_funcs = (int, lambda x: x.__int__())
7584+ for int_func in int_funcs:
7585+ assert_equal(int_func(np.array(0)), 0)
7586+ assert_equal(int_func(np.array([1])), 1)
7587+ assert_equal(int_func(np.array([[42]])), 42)
7588+ assert_raises(TypeError, int_func, np.array([1, 2]))
7589+
7590+ # gh-9972
7591+ assert_equal(4, int_func(np.array('4')))
7592+ assert_equal(5, int_func(np.bytes_(b'5')))
7593+ assert_equal(6, int_func(np.unicode_(u'6')))
7594+
7595+ class HasTrunc:
7596+ def __trunc__(self):
7597+ return 3
7598+ assert_equal(3, int_func(np.array(HasTrunc())))
7599+ assert_equal(3, int_func(np.array([HasTrunc()])))
7600+
7601+ class NotConvertible:
7602+ def __int__(self):
7603+ raise NotImplementedError
7604+ assert_raises(NotImplementedError,
7605+ int_func, np.array(NotConvertible()))
7606+ assert_raises(NotImplementedError,
7607+ int_func, np.array([NotConvertible()]))
7608+
7609+
7610+class TestWhere:
7611+ def test_basic(self):
7612+ dts = [bool, np.int16, np.int32, np.int64, np.double, np.complex128,
7613+ np.longdouble, np.clongdouble]
7614+ for dt in dts:
7615+ c = np.ones(53, dtype=bool)
7616+ assert_equal(np.where( c, dt(0), dt(1)), dt(0))
7617+ assert_equal(np.where(~c, dt(0), dt(1)), dt(1))
7618+ assert_equal(np.where(True, dt(0), dt(1)), dt(0))
7619+ assert_equal(np.where(False, dt(0), dt(1)), dt(1))
7620+ d = np.ones_like(c).astype(dt)
7621+ e = np.zeros_like(d)
7622+ r = d.astype(dt)
7623+ c[7] = False
7624+ r[7] = e[7]
7625+ assert_equal(np.where(c, e, e), e)
7626+ assert_equal(np.where(c, d, e), r)
7627+ assert_equal(np.where(c, d, e[0]), r)
7628+ assert_equal(np.where(c, d[0], e), r)
7629+ assert_equal(np.where(c[::2], d[::2], e[::2]), r[::2])
7630+ assert_equal(np.where(c[1::2], d[1::2], e[1::2]), r[1::2])
7631+ assert_equal(np.where(c[::3], d[::3], e[::3]), r[::3])
7632+ assert_equal(np.where(c[1::3], d[1::3], e[1::3]), r[1::3])
7633+ assert_equal(np.where(c[::-2], d[::-2], e[::-2]), r[::-2])
7634+ assert_equal(np.where(c[::-3], d[::-3], e[::-3]), r[::-3])
7635+ assert_equal(np.where(c[1::-3], d[1::-3], e[1::-3]), r[1::-3])
7636+
7637+ def test_exotic(self):
7638+ # object
7639+ assert_array_equal(np.where(True, None, None), np.array(None))
7640+ # zero sized
7641+ m = np.array([], dtype=bool).reshape(0, 3)
7642+ b = np.array([], dtype=np.float64).reshape(0, 3)
7643+ assert_array_equal(np.where(m, 0, b), np.array([]).reshape(0, 3))
7644+
7645+ # object cast
7646+ d = np.array([-1.34, -0.16, -0.54, -0.31, -0.08, -0.95, 0.000, 0.313,
7647+ 0.547, -0.18, 0.876, 0.236, 1.969, 0.310, 0.699, 1.013,
7648+ 1.267, 0.229, -1.39, 0.487])
7649+ nan = float('NaN')
7650+ e = np.array(['5z', '0l', nan, 'Wz', nan, nan, 'Xq', 'cs', nan, nan,
7651+ 'QN', nan, nan, 'Fd', nan, nan, 'kp', nan, '36', 'i1'],
7652+ dtype=object)
7653+ m = np.array([0, 0, 1, 0, 1, 1, 0, 0, 1, 1,
7654+ 0, 1, 1, 0, 1, 1, 0, 1, 0, 0], dtype=bool)
7655+
7656+ r = e[:]
7657+ r[np.where(m)] = d[np.where(m)]
7658+ assert_array_equal(np.where(m, d, e), r)
7659+
7660+ r = e[:]
7661+ r[np.where(~m)] = d[np.where(~m)]
7662+ assert_array_equal(np.where(m, e, d), r)
7663+
7664+ assert_array_equal(np.where(m, e, e), e)
7665+
7666+ # minimal dtype result with NaN scalar (e.g required by pandas)
7667+ d = np.array([1., 2.], dtype=np.float32)
7668+ e = float('NaN')
7669+ assert_equal(np.where(True, d, e).dtype, np.float32)
7670+ e = float('Infinity')
7671+ assert_equal(np.where(True, d, e).dtype, np.float32)
7672+ e = float('-Infinity')
7673+ assert_equal(np.where(True, d, e).dtype, np.float32)
7674+ # also check upcast
7675+ e = float(1e150)
7676+ assert_equal(np.where(True, d, e).dtype, np.float64)
7677+
7678+ def test_ndim(self):
7679+ c = [True, False]
7680+ a = np.zeros((2, 25))
7681+ b = np.ones((2, 25))
7682+ r = np.where(np.array(c)[:,np.newaxis], a, b)
7683+ assert_array_equal(r[0], a[0])
7684+ assert_array_equal(r[1], b[0])
7685+
7686+ a = a.T
7687+ b = b.T
7688+ r = np.where(c, a, b)
7689+ assert_array_equal(r[:,0], a[:,0])
7690+ assert_array_equal(r[:,1], b[:,0])
7691+
7692+ def test_dtype_mix(self):
7693+ c = np.array([False, True, False, False, False, False, True, False,
7694+ False, False, True, False])
7695+ a = np.uint32(1)
7696+ b = np.array([5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.],
7697+ dtype=np.float64)
7698+ r = np.array([5., 1., 3., 2., -1., -4., 1., -10., 10., 1., 1., 3.],
7699+ dtype=np.float64)
7700+ assert_equal(np.where(c, a, b), r)
7701+
7702+ a = a.astype(np.float32)
7703+ b = b.astype(np.int64)
7704+ assert_equal(np.where(c, a, b), r)
7705+
7706+ # non bool mask
7707+ c = c.astype(int)
7708+ c[c != 0] = 34242324
7709+ assert_equal(np.where(c, a, b), r)
7710+ # invert
7711+ tmpmask = c != 0
7712+ c[c == 0] = 41247212
7713+ c[tmpmask] = 0
7714+ assert_equal(np.where(c, b, a), r)
7715+
7716+ def test_foreign(self):
7717+ c = np.array([False, True, False, False, False, False, True, False,
7718+ False, False, True, False])
7719+ r = np.array([5., 1., 3., 2., -1., -4., 1., -10., 10., 1., 1., 3.],
7720+ dtype=np.float64)
7721+ a = np.ones(1, dtype='>i4')
7722+ b = np.array([5., 0., 3., 2., -1., -4., 0., -10., 10., 1., 0., 3.],
7723+ dtype=np.float64)
7724+ assert_equal(np.where(c, a, b), r)
7725+
7726+ b = b.astype('>f8')
7727+ assert_equal(np.where(c, a, b), r)
7728+
7729+ a = a.astype('<i4')
7730+ assert_equal(np.where(c, a, b), r)
7731+
7732+ c = c.astype('>i4')
7733+ assert_equal(np.where(c, a, b), r)
7734+
7735+ def test_error(self):
7736+ c = [True, True]
7737+ a = np.ones((4, 5))
7738+ b = np.ones((5, 5))
7739+ assert_raises(ValueError, np.where, c, a, a)
7740+ assert_raises(ValueError, np.where, c[0], a, b)
7741+
7742+ def test_string(self):
7743+ # gh-4778 check strings are properly filled with nulls
7744+ a = np.array("abc")
7745+ b = np.array("x" * 753)
7746+ assert_equal(np.where(True, a, b), "abc")
7747+ assert_equal(np.where(False, b, a), "abc")
7748+
7749+ # check native datatype sized strings
7750+ a = np.array("abcd")
7751+ b = np.array("x" * 8)
7752+ assert_equal(np.where(True, a, b), "abcd")
7753+ assert_equal(np.where(False, b, a), "abcd")
7754+
7755+ def test_empty_result(self):
7756+ # pass empty where result through an assignment which reads the data of
7757+ # empty arrays, error detectable with valgrind, see gh-8922
7758+ x = np.zeros((1, 1))
7759+ ibad = np.vstack(np.where(x == 99.))
7760+ assert_array_equal(ibad,
7761+ np.atleast_2d(np.array([[],[]], dtype=np.intp)))
7762+
7763+ def test_largedim(self):
7764+ # invalid read regression gh-9304
7765+ shape = [10, 2, 3, 4, 5, 6]
7766+ np.random.seed(2)
7767+ array = np.random.rand(*shape)
7768+
7769+ for i in range(10):
7770+ benchmark = array.nonzero()
7771+ result = array.nonzero()
7772+ assert_array_equal(benchmark, result)
7773+
7774+
7775+if not IS_PYPY:
7776+ # sys.getsizeof() is not valid on PyPy
7777+ class TestSizeOf:
7778+
7779+ def test_empty_array(self):
7780+ x = np.array([])
7781+ assert_(sys.getsizeof(x) > 0)
7782+
7783+ def check_array(self, dtype):
7784+ elem_size = dtype(0).itemsize
7785+
7786+ for length in [10, 50, 100, 500]:
7787+ x = np.arange(length, dtype=dtype)
7788+ assert_(sys.getsizeof(x) > length * elem_size)
7789+
7790+ def test_array_int32(self):
7791+ self.check_array(np.int32)
7792+
7793+ def test_array_int64(self):
7794+ self.check_array(np.int64)
7795+
7796+ def test_array_float32(self):
7797+ self.check_array(np.float32)
7798+
7799+ def test_array_float64(self):
7800+ self.check_array(np.float64)
7801+
7802+ def test_view(self):
7803+ d = np.ones(100)
7804+ assert_(sys.getsizeof(d[...]) < sys.getsizeof(d))
7805+
7806+ def test_reshape(self):
7807+ d = np.ones(100)
7808+ assert_(sys.getsizeof(d) < sys.getsizeof(d.reshape(100, 1, 1).copy()))
7809+
7810+ @_no_tracing
7811+ def test_resize(self):
7812+ d = np.ones(100)
7813+ old = sys.getsizeof(d)
7814+ d.resize(50)
7815+ assert_(old > sys.getsizeof(d))
7816+ d.resize(150)
7817+ assert_(old < sys.getsizeof(d))
7818+
7819+ def test_error(self):
7820+ d = np.ones(100)
7821+ assert_raises(TypeError, d.__sizeof__, "a")
7822+
7823+
7824+class TestHashing:
7825+
7826+ def test_arrays_not_hashable(self):
7827+ x = np.ones(3)
7828+ assert_raises(TypeError, hash, x)
7829+
7830+ def test_collections_hashable(self):
7831+ x = np.array([])
7832+ assert_(not isinstance(x, collections.abc.Hashable))
7833+
7834+
7835+class TestArrayPriority:
7836+ # This will go away when __array_priority__ is settled, meanwhile
7837+ # it serves to check unintended changes.
7838+ op = operator
7839+ binary_ops = [
7840+ op.pow, op.add, op.sub, op.mul, op.floordiv, op.truediv, op.mod,
7841+ op.and_, op.or_, op.xor, op.lshift, op.rshift, op.mod, op.gt,
7842+ op.ge, op.lt, op.le, op.ne, op.eq
7843+ ]
7844+
7845+ class Foo(np.ndarray):
7846+ __array_priority__ = 100.
7847+
7848+ def __new__(cls, *args, **kwargs):
7849+ return np.array(*args, **kwargs).view(cls)
7850+
7851+ class Bar(np.ndarray):
7852+ __array_priority__ = 101.
7853+
7854+ def __new__(cls, *args, **kwargs):
7855+ return np.array(*args, **kwargs).view(cls)
7856+
7857+ class Other:
7858+ __array_priority__ = 1000.
7859+
7860+ def _all(self, other):
7861+ return self.__class__()
7862+
7863+ __add__ = __radd__ = _all
7864+ __sub__ = __rsub__ = _all
7865+ __mul__ = __rmul__ = _all
7866+ __pow__ = __rpow__ = _all
7867+ __div__ = __rdiv__ = _all
7868+ __mod__ = __rmod__ = _all
7869+ __truediv__ = __rtruediv__ = _all
7870+ __floordiv__ = __rfloordiv__ = _all
7871+ __and__ = __rand__ = _all
7872+ __xor__ = __rxor__ = _all
7873+ __or__ = __ror__ = _all
7874+ __lshift__ = __rlshift__ = _all
7875+ __rshift__ = __rrshift__ = _all
7876+ __eq__ = _all
7877+ __ne__ = _all
7878+ __gt__ = _all
7879+ __ge__ = _all
7880+ __lt__ = _all
7881+ __le__ = _all
7882+
7883+ def test_ndarray_subclass(self):
7884+ a = np.array([1, 2])
7885+ b = self.Bar([1, 2])
7886+ for f in self.binary_ops:
7887+ msg = repr(f)
7888+ assert_(isinstance(f(a, b), self.Bar), msg)
7889+ assert_(isinstance(f(b, a), self.Bar), msg)
7890+
7891+ def test_ndarray_other(self):
7892+ a = np.array([1, 2])
7893+ b = self.Other()
7894+ for f in self.binary_ops:
7895+ msg = repr(f)
7896+ assert_(isinstance(f(a, b), self.Other), msg)
7897+ assert_(isinstance(f(b, a), self.Other), msg)
7898+
7899+ def test_subclass_subclass(self):
7900+ a = self.Foo([1, 2])
7901+ b = self.Bar([1, 2])
7902+ for f in self.binary_ops:
7903+ msg = repr(f)
7904+ assert_(isinstance(f(a, b), self.Bar), msg)
7905+ assert_(isinstance(f(b, a), self.Bar), msg)
7906+
7907+ def test_subclass_other(self):
7908+ a = self.Foo([1, 2])
7909+ b = self.Other()
7910+ for f in self.binary_ops:
7911+ msg = repr(f)
7912+ assert_(isinstance(f(a, b), self.Other), msg)
7913+ assert_(isinstance(f(b, a), self.Other), msg)
7914+
7915+
7916+class TestBytestringArrayNonzero:
7917+
7918+ def test_empty_bstring_array_is_falsey(self):
7919+ assert_(not np.array([''], dtype=str))
7920+
7921+ def test_whitespace_bstring_array_is_falsey(self):
7922+ a = np.array(['spam'], dtype=str)
7923+ a[0] = ' \0\0'
7924+ assert_(not a)
7925+
7926+ def test_all_null_bstring_array_is_falsey(self):
7927+ a = np.array(['spam'], dtype=str)
7928+ a[0] = '\0\0\0\0'
7929+ assert_(not a)
7930+
7931+ def test_null_inside_bstring_array_is_truthy(self):
7932+ a = np.array(['spam'], dtype=str)
7933+ a[0] = ' \0 \0'
7934+ assert_(a)
7935+
7936+
7937+class TestUnicodeEncoding:
7938+ """
7939+ Tests for encoding related bugs, such as UCS2 vs UCS4, round-tripping
7940+ issues, etc
7941+ """
7942+ def test_round_trip(self):
7943+ """ Tests that GETITEM, SETITEM, and PyArray_Scalar roundtrip """
7944+ # gh-15363
7945+ arr = np.zeros(shape=(), dtype="U1")
7946+ for i in range(1, sys.maxunicode + 1):
7947+ expected = chr(i)
7948+ arr[()] = expected
7949+ assert arr[()] == expected
7950+ assert arr.item() == expected
7951+
7952+ def test_assign_scalar(self):
7953+ # gh-3258
7954+ l = np.array(['aa', 'bb'])
7955+ l[:] = np.unicode_('cc')
7956+ assert_equal(l, ['cc', 'cc'])
7957+
7958+ def test_fill_scalar(self):
7959+ # gh-7227
7960+ l = np.array(['aa', 'bb'])
7961+ l.fill(np.unicode_('cc'))
7962+ assert_equal(l, ['cc', 'cc'])
7963+
7964+
7965+class TestUnicodeArrayNonzero:
7966+
7967+ def test_empty_ustring_array_is_falsey(self):
7968+ assert_(not np.array([''], dtype=np.unicode_))
7969+
7970+ def test_whitespace_ustring_array_is_falsey(self):
7971+ a = np.array(['eggs'], dtype=np.unicode_)
7972+ a[0] = ' \0\0'
7973+ assert_(not a)
7974+
7975+ def test_all_null_ustring_array_is_falsey(self):
7976+ a = np.array(['eggs'], dtype=np.unicode_)
7977+ a[0] = '\0\0\0\0'
7978+ assert_(not a)
7979+
7980+ def test_null_inside_ustring_array_is_truthy(self):
7981+ a = np.array(['eggs'], dtype=np.unicode_)
7982+ a[0] = ' \0 \0'
7983+ assert_(a)
7984+
7985+
7986+class TestFormat:
7987+
7988+ def test_0d(self):
7989+ a = np.array(np.pi)
7990+ assert_equal('{:0.3g}'.format(a), '3.14')
7991+ assert_equal('{:0.3g}'.format(a[()]), '3.14')
7992+
7993+ def test_1d_no_format(self):
7994+ a = np.array([np.pi])
7995+ assert_equal('{}'.format(a), str(a))
7996+
7997+ def test_1d_format(self):
7998+ # until gh-5543, ensure that the behaviour matches what it used to be
7999+ a = np.array([np.pi])
8000+ assert_raises(TypeError, '{:30}'.format, a)
8001+
8002+from numpy.testing import IS_PYPY
8003+
8004+class TestCTypes:
8005+
8006+ def test_ctypes_is_available(self):
8007+ test_arr = np.array([[1, 2, 3], [4, 5, 6]])
8008+
8009+ assert_equal(ctypes, test_arr.ctypes._ctypes)
8010+ assert_equal(tuple(test_arr.ctypes.shape), (2, 3))
8011+
8012+ def test_ctypes_is_not_available(self):
8013+ from numpy.core import _internal
8014+ _internal.ctypes = None
8015+ try:
8016+ test_arr = np.array([[1, 2, 3], [4, 5, 6]])
8017+
8018+ assert_(isinstance(test_arr.ctypes._ctypes,
8019+ _internal._missing_ctypes))
8020+ assert_equal(tuple(test_arr.ctypes.shape), (2, 3))
8021+ finally:
8022+ _internal.ctypes = ctypes
8023+
8024+ def _make_readonly(x):
8025+ x.flags.writeable = False
8026+ return x
8027+
8028+ @pytest.mark.parametrize('arr', [
8029+ np.array([1, 2, 3]),
8030+ np.array([['one', 'two'], ['three', 'four']]),
8031+ np.array((1, 2), dtype='i4,i4'),
8032+ np.zeros((2,), dtype=
8033+ np.dtype(dict(
8034+ formats=['<i4', '<i4'],
8035+ names=['a', 'b'],
8036+ offsets=[0, 2],
8037+ itemsize=6
8038+ ))
8039+ ),
8040+ np.array([None], dtype=object),
8041+ np.array([]),
8042+ np.empty((0, 0)),
8043+ _make_readonly(np.array([1, 2, 3])),
8044+ ], ids=[
8045+ '1d',
8046+ '2d',
8047+ 'structured',
8048+ 'overlapping',
8049+ 'object',
8050+ 'empty',
8051+ 'empty-2d',
8052+ 'readonly'
8053+ ])
8054+ def test_ctypes_data_as_holds_reference(self, arr):
8055+ # gh-9647
8056+ # create a copy to ensure that pytest does not mess with the refcounts
8057+ arr = arr.copy()
8058+
8059+ arr_ref = weakref.ref(arr)
8060+
8061+ ctypes_ptr = arr.ctypes.data_as(ctypes.c_void_p)
8062+
8063+ # `ctypes_ptr` should hold onto `arr`
8064+ del arr
8065+ break_cycles()
8066+ assert_(arr_ref() is not None, "ctypes pointer did not hold onto a reference")
8067+
8068+ # but when the `ctypes_ptr` object dies, so should `arr`
8069+ del ctypes_ptr
8070+ if IS_PYPY:
8071+ # Pypy does not recycle arr objects immediately. Trigger gc to
8072+ # release arr. Cpython uses refcounts. An explicit call to gc
8073+ # should not be needed here.
8074+ break_cycles()
8075+ assert_(arr_ref() is None, "unknowable whether ctypes pointer holds a reference")
8076+
8077+ def test_ctypes_as_parameter_holds_reference(self):
8078+ arr = np.array([None]).copy()
8079+
8080+ arr_ref = weakref.ref(arr)
8081+
8082+ ctypes_ptr = arr.ctypes._as_parameter_
8083+
8084+ # `ctypes_ptr` should hold onto `arr`
8085+ del arr
8086+ break_cycles()
8087+ assert_(arr_ref() is not None, "ctypes pointer did not hold onto a reference")
8088+
8089+ # but when the `ctypes_ptr` object dies, so should `arr`
8090+ del ctypes_ptr
8091+ if IS_PYPY:
8092+ break_cycles()
8093+ assert_(arr_ref() is None, "unknowable whether ctypes pointer holds a reference")
8094+
8095+
8096+class TestWritebackIfCopy:
8097+ # all these tests use the WRITEBACKIFCOPY mechanism
8098+ def test_argmax_with_out(self):
8099+ mat = np.eye(5)
8100+ out = np.empty(5, dtype='i2')
8101+ res = np.argmax(mat, 0, out=out)
8102+ assert_equal(res, range(5))
8103+
8104+ def test_argmin_with_out(self):
8105+ mat = -np.eye(5)
8106+ out = np.empty(5, dtype='i2')
8107+ res = np.argmin(mat, 0, out=out)
8108+ assert_equal(res, range(5))
8109+
8110+ def test_insert_noncontiguous(self):
8111+ a = np.arange(6).reshape(2,3).T # force non-c-contiguous
8112+ # uses arr_insert
8113+ np.place(a, a>2, [44, 55])
8114+ assert_equal(a, np.array([[0, 44], [1, 55], [2, 44]]))
8115+ # hit one of the failing paths
8116+ assert_raises(ValueError, np.place, a, a>20, [])
8117+
8118+ def test_put_noncontiguous(self):
8119+ a = np.arange(6).reshape(2,3).T # force non-c-contiguous
8120+ np.put(a, [0, 2], [44, 55])
8121+ assert_equal(a, np.array([[44, 3], [55, 4], [2, 5]]))
8122+
8123+ def test_putmask_noncontiguous(self):
8124+ a = np.arange(6).reshape(2,3).T # force non-c-contiguous
8125+ # uses arr_putmask
8126+ np.putmask(a, a>2, a**2)
8127+ assert_equal(a, np.array([[0, 9], [1, 16], [2, 25]]))
8128+
8129+ def test_take_mode_raise(self):
8130+ a = np.arange(6, dtype='int')
8131+ out = np.empty(2, dtype='int')
8132+ np.take(a, [0, 2], out=out, mode='raise')
8133+ assert_equal(out, np.array([0, 2]))
8134+
8135+ def test_choose_mod_raise(self):
8136+ a = np.array([[1, 0, 1], [0, 1, 0], [1, 0, 1]])
8137+ out = np.empty((3,3), dtype='int')
8138+ choices = [-10, 10]
8139+ np.choose(a, choices, out=out, mode='raise')
8140+ assert_equal(out, np.array([[ 10, -10, 10],
8141+ [-10, 10, -10],
8142+ [ 10, -10, 10]]))
8143+
8144+ def test_flatiter__array__(self):
8145+ a = np.arange(9).reshape(3,3)
8146+ b = a.T.flat
8147+ c = b.__array__()
8148+ # triggers the WRITEBACKIFCOPY resolution, assuming refcount semantics
8149+ del c
8150+
8151+ def test_dot_out(self):
8152+ # if HAVE_CBLAS, will use WRITEBACKIFCOPY
8153+ a = np.arange(9, dtype=float).reshape(3,3)
8154+ b = np.dot(a, a, out=a)
8155+ assert_equal(b, np.array([[15, 18, 21], [42, 54, 66], [69, 90, 111]]))
8156+
8157+ def test_view_assign(self):
8158+ from numpy.core._multiarray_tests import npy_create_writebackifcopy, npy_resolve
8159+
8160+ arr = np.arange(9).reshape(3, 3).T
8161+ arr_wb = npy_create_writebackifcopy(arr)
8162+ assert_(arr_wb.flags.writebackifcopy)
8163+ assert_(arr_wb.base is arr)
8164+ arr_wb[...] = -100
8165+ npy_resolve(arr_wb)
8166+ # arr changes after resolve, even though we assigned to arr_wb
8167+ assert_equal(arr, -100)
8168+ # after resolve, the two arrays no longer reference each other
8169+ assert_(arr_wb.ctypes.data != 0)
8170+ assert_equal(arr_wb.base, None)
8171+ # assigning to arr_wb does not get transferred to arr
8172+ arr_wb[...] = 100
8173+ assert_equal(arr, -100)
8174+
8175+ @pytest.mark.leaks_references(
8176+ reason="increments self in dealloc; ignore since deprecated path.")
8177+ def test_dealloc_warning(self):
8178+ with suppress_warnings() as sup:
8179+ sup.record(RuntimeWarning)
8180+ arr = np.arange(9).reshape(3, 3)
8181+ v = arr.T
8182+ _multiarray_tests.npy_abuse_writebackifcopy(v)
8183+ assert len(sup.log) == 1
8184+
8185+ def test_view_discard_refcount(self):
8186+ from numpy.core._multiarray_tests import npy_create_writebackifcopy, npy_discard
8187+
8188+ arr = np.arange(9).reshape(3, 3).T
8189+ orig = arr.copy()
8190+ if HAS_REFCOUNT:
8191+ arr_cnt = sys.getrefcount(arr)
8192+ arr_wb = npy_create_writebackifcopy(arr)
8193+ assert_(arr_wb.flags.writebackifcopy)
8194+ assert_(arr_wb.base is arr)
8195+ arr_wb[...] = -100
8196+ npy_discard(arr_wb)
8197+ # arr remains unchanged after discard
8198+ assert_equal(arr, orig)
8199+ # after discard, the two arrays no longer reference each other
8200+ assert_(arr_wb.ctypes.data != 0)
8201+ assert_equal(arr_wb.base, None)
8202+ if HAS_REFCOUNT:
8203+ assert_equal(arr_cnt, sys.getrefcount(arr))
8204+ # assigning to arr_wb does not get transferred to arr
8205+ arr_wb[...] = 100
8206+ assert_equal(arr, orig)
8207+
8208+
8209+class TestArange:
8210+ def test_infinite(self):
8211+ assert_raises_regex(
8212+ ValueError, "size exceeded",
8213+ np.arange, 0, np.inf
8214+ )
8215+
8216+ def test_nan_step(self):
8217+ assert_raises_regex(
8218+ ValueError, "cannot compute length",
8219+ np.arange, 0, 1, np.nan
8220+ )
8221+
8222+ def test_zero_step(self):
8223+ assert_raises(ZeroDivisionError, np.arange, 0, 10, 0)
8224+ assert_raises(ZeroDivisionError, np.arange, 0.0, 10.0, 0.0)
8225+
8226+ # empty range
8227+ assert_raises(ZeroDivisionError, np.arange, 0, 0, 0)
8228+ assert_raises(ZeroDivisionError, np.arange, 0.0, 0.0, 0.0)
8229+
8230+
8231+class TestArrayFinalize:
8232+ """ Tests __array_finalize__ """
8233+
8234+ def test_receives_base(self):
8235+ # gh-11237
8236+ class SavesBase(np.ndarray):
8237+ def __array_finalize__(self, obj):
8238+ self.saved_base = self.base
8239+
8240+ a = np.array(1).view(SavesBase)
8241+ assert_(a.saved_base is a.base)
8242+
8243+ def test_lifetime_on_error(self):
8244+ # gh-11237
8245+ class RaisesInFinalize(np.ndarray):
8246+ def __array_finalize__(self, obj):
8247+ # crash, but keep this object alive
8248+ raise Exception(self)
8249+
8250+ # a plain object can't be weakref'd
8251+ class Dummy: pass
8252+
8253+ # get a weak reference to an object within an array
8254+ obj_arr = np.array(Dummy())
8255+ obj_ref = weakref.ref(obj_arr[()])
8256+
8257+ # get an array that crashed in __array_finalize__
8258+ with assert_raises(Exception) as e:
8259+ obj_arr.view(RaisesInFinalize)
8260+
8261+ obj_subarray = e.exception.args[0]
8262+ del e
8263+ assert_(isinstance(obj_subarray, RaisesInFinalize))
8264+
8265+ # reference should still be held by obj_arr
8266+ break_cycles()
8267+ assert_(obj_ref() is not None, "object should not already be dead")
8268+
8269+ del obj_arr
8270+ break_cycles()
8271+ assert_(obj_ref() is not None, "obj_arr should not hold the last reference")
8272+
8273+ del obj_subarray
8274+ break_cycles()
8275+ assert_(obj_ref() is None, "no references should remain")
8276+
8277+
8278+def test_orderconverter_with_nonASCII_unicode_ordering():
8279+ # gh-7475
8280+ a = np.arange(5)
8281+ assert_raises(ValueError, a.flatten, order=u'\xe2')
8282+
8283+
8284+def test_equal_override():
8285+ # gh-9153: ndarray.__eq__ uses special logic for structured arrays, which
8286+ # did not respect overrides with __array_priority__ or __array_ufunc__.
8287+ # The PR fixed this for __array_priority__ and __array_ufunc__ = None.
8288+ class MyAlwaysEqual:
8289+ def __eq__(self, other):
8290+ return "eq"
8291+
8292+ def __ne__(self, other):
8293+ return "ne"
8294+
8295+ class MyAlwaysEqualOld(MyAlwaysEqual):
8296+ __array_priority__ = 10000
8297+
8298+ class MyAlwaysEqualNew(MyAlwaysEqual):
8299+ __array_ufunc__ = None
8300+
8301+ array = np.array([(0, 1), (2, 3)], dtype='i4,i4')
8302+ for my_always_equal_cls in MyAlwaysEqualOld, MyAlwaysEqualNew:
8303+ my_always_equal = my_always_equal_cls()
8304+ assert_equal(my_always_equal == array, 'eq')
8305+ assert_equal(array == my_always_equal, 'eq')
8306+ assert_equal(my_always_equal != array, 'ne')
8307+ assert_equal(array != my_always_equal, 'ne')
8308+
8309+
8310+def test_npymath_complex():
8311+ # Smoketest npymath functions
8312+ from numpy.core._multiarray_tests import (
8313+ npy_cabs, npy_carg)
8314+
8315+ funcs = {npy_cabs: np.absolute,
8316+ npy_carg: np.angle}
8317+ vals = (1, np.inf, -np.inf, np.nan)
8318+ types = (np.complex64, np.complex128, np.clongdouble)
8319+
8320+ for fun, npfun in funcs.items():
8321+ for x, y in itertools.product(vals, vals):
8322+ for t in types:
8323+ z = t(complex(x, y))
8324+ got = fun(z)
8325+ expected = npfun(z)
8326+ assert_allclose(got, expected)
8327+
8328+
8329+def test_npymath_real():
8330+ # Smoketest npymath functions
8331+ from numpy.core._multiarray_tests import (
8332+ npy_log10, npy_cosh, npy_sinh, npy_tan, npy_tanh)
8333+
8334+ funcs = {npy_log10: np.log10,
8335+ npy_cosh: np.cosh,
8336+ npy_sinh: np.sinh,
8337+ npy_tan: np.tan,
8338+ npy_tanh: np.tanh}
8339+ vals = (1, np.inf, -np.inf, np.nan)
8340+ types = (np.float32, np.float64, np.longdouble)
8341+
8342+ with np.errstate(all='ignore'):
8343+ for fun, npfun in funcs.items():
8344+ for x, t in itertools.product(vals, types):
8345+ z = t(x)
8346+ got = fun(z)
8347+ expected = npfun(z)
8348+ assert_allclose(got, expected)
8349+
8350+def test_uintalignment_and_alignment():
8351+ # alignment code needs to satisfy these requirements:
8352+ # 1. numpy structs match C struct layout
8353+ # 2. ufuncs/casting is safe wrt to aligned access
8354+ # 3. copy code is safe wrt to "uint alidned" access
8355+ #
8356+ # Complex types are the main problem, whose alignment may not be the same
8357+ # as their "uint alignment".
8358+ #
8359+ # This test might only fail on certain platforms, where uint64 alignment is
8360+ # not equal to complex64 alignment. The second 2 tests will only fail
8361+ # for DEBUG=1.
8362+
8363+ d1 = np.dtype('u1,c8', align=True)
8364+ d2 = np.dtype('u4,c8', align=True)
8365+ d3 = np.dtype({'names': ['a', 'b'], 'formats': ['u1', d1]}, align=True)
8366+
8367+ assert_equal(np.zeros(1, dtype=d1)['f1'].flags['ALIGNED'], True)
8368+ assert_equal(np.zeros(1, dtype=d2)['f1'].flags['ALIGNED'], True)
8369+ assert_equal(np.zeros(1, dtype='u1,c8')['f1'].flags['ALIGNED'], False)
8370+
8371+ # check that C struct matches numpy struct size
8372+ s = _multiarray_tests.get_struct_alignments()
8373+ for d, (alignment, size) in zip([d1,d2,d3], s):
8374+ assert_equal(d.alignment, alignment)
8375+ assert_equal(d.itemsize, size)
8376+
8377+ # check that ufuncs don't complain in debug mode
8378+ # (this is probably OK if the aligned flag is true above)
8379+ src = np.zeros((2,2), dtype=d1)['f1'] # 4-byte aligned, often
8380+ np.exp(src) # assert fails?
8381+
8382+ # check that copy code doesn't complain in debug mode
8383+ dst = np.zeros((2,2), dtype='c8')
8384+ dst[:,1] = src[:,1] # assert in lowlevel_strided_loops fails?
8385+
8386+class TestAlignment:
8387+ # adapted from scipy._lib.tests.test__util.test__aligned_zeros
8388+ # Checks that unusual memory alignments don't trip up numpy.
8389+ # In particular, check RELAXED_STRIDES don't trip alignment assertions in
8390+ # NDEBUG mode for size-0 arrays (gh-12503)
8391+
8392+ def check(self, shape, dtype, order, align):
8393+ err_msg = repr((shape, dtype, order, align))
8394+ x = _aligned_zeros(shape, dtype, order, align=align)
8395+ if align is None:
8396+ align = np.dtype(dtype).alignment
8397+ assert_equal(x.__array_interface__['data'][0] % align, 0)
8398+ if hasattr(shape, '__len__'):
8399+ assert_equal(x.shape, shape, err_msg)
8400+ else:
8401+ assert_equal(x.shape, (shape,), err_msg)
8402+ assert_equal(x.dtype, dtype)
8403+ if order == "C":
8404+ assert_(x.flags.c_contiguous, err_msg)
8405+ elif order == "F":
8406+ if x.size > 0:
8407+ assert_(x.flags.f_contiguous, err_msg)
8408+ elif order is None:
8409+ assert_(x.flags.c_contiguous, err_msg)
8410+ else:
8411+ raise ValueError()
8412+
8413+ def test_various_alignments(self):
8414+ for align in [1, 2, 3, 4, 8, 12, 16, 32, 64, None]:
8415+ for n in [0, 1, 3, 11]:
8416+ for order in ["C", "F", None]:
8417+ for dtype in list(np.typecodes["All"]) + ['i4,i4,i4']:
8418+ if dtype == 'O':
8419+ # object dtype can't be misaligned
8420+ continue
8421+ for shape in [n, (1, 2, 3, n)]:
8422+ self.check(shape, np.dtype(dtype), order, align)
8423+
8424+ def test_strided_loop_alignments(self):
8425+ # particularly test that complex64 and float128 use right alignment
8426+ # code-paths, since these are particularly problematic. It is useful to
8427+ # turn on USE_DEBUG for this test, so lowlevel-loop asserts are run.
8428+ for align in [1, 2, 4, 8, 12, 16, None]:
8429+ xf64 = _aligned_zeros(3, np.float64)
8430+
8431+ xc64 = _aligned_zeros(3, np.complex64, align=align)
8432+ xf128 = _aligned_zeros(3, np.longdouble, align=align)
8433+
8434+ # test casting, both to and from misaligned
8435+ with suppress_warnings() as sup:
8436+ sup.filter(np.ComplexWarning, "Casting complex values")
8437+ xc64.astype('f8')
8438+ xf64.astype(np.complex64)
8439+ test = xc64 + xf64
8440+
8441+ xf128.astype('f8')
8442+ xf64.astype(np.longdouble)
8443+ test = xf128 + xf64
8444+
8445+ test = xf128 + xc64
8446+
8447+ # test copy, both to and from misaligned
8448+ # contig copy
8449+ xf64[:] = xf64.copy()
8450+ xc64[:] = xc64.copy()
8451+ xf128[:] = xf128.copy()
8452+ # strided copy
8453+ xf64[::2] = xf64[::2].copy()
8454+ xc64[::2] = xc64[::2].copy()
8455+ xf128[::2] = xf128[::2].copy()
8456+
8457+def test_getfield():
8458+ a = np.arange(32, dtype='uint16')
8459+ if sys.byteorder == 'little':
8460+ i = 0
8461+ j = 1
8462+ else:
8463+ i = 1
8464+ j = 0
8465+ b = a.getfield('int8', i)
8466+ assert_equal(b, a)
8467+ b = a.getfield('int8', j)
8468+ assert_equal(b, 0)
8469+ pytest.raises(ValueError, a.getfield, 'uint8', -1)
8470+ pytest.raises(ValueError, a.getfield, 'uint8', 16)
8471+ pytest.raises(ValueError, a.getfield, 'uint64', 0)
tests/benchmarks/many-small-files/small-file-0.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 0
tests/benchmarks/many-small-files/small-file-1.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 1
tests/benchmarks/many-small-files/small-file-10.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 10
tests/benchmarks/many-small-files/small-file-100.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 100
tests/benchmarks/many-small-files/small-file-11.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 11
tests/benchmarks/many-small-files/small-file-12.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 12
tests/benchmarks/many-small-files/small-file-13.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 13
tests/benchmarks/many-small-files/small-file-14.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 14
tests/benchmarks/many-small-files/small-file-15.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 15
tests/benchmarks/many-small-files/small-file-16.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 16
tests/benchmarks/many-small-files/small-file-17.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 17
tests/benchmarks/many-small-files/small-file-18.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 18
tests/benchmarks/many-small-files/small-file-19.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 19
tests/benchmarks/many-small-files/small-file-2.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 2
tests/benchmarks/many-small-files/small-file-20.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 20
tests/benchmarks/many-small-files/small-file-21.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 21
tests/benchmarks/many-small-files/small-file-22.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 22
tests/benchmarks/many-small-files/small-file-23.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 23
tests/benchmarks/many-small-files/small-file-24.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 24
tests/benchmarks/many-small-files/small-file-25.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 25
tests/benchmarks/many-small-files/small-file-26.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 26
tests/benchmarks/many-small-files/small-file-27.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 27
tests/benchmarks/many-small-files/small-file-28.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 28
tests/benchmarks/many-small-files/small-file-29.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 29
tests/benchmarks/many-small-files/small-file-3.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 3
tests/benchmarks/many-small-files/small-file-30.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 30
tests/benchmarks/many-small-files/small-file-31.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 31
tests/benchmarks/many-small-files/small-file-32.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 32
tests/benchmarks/many-small-files/small-file-33.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 33
tests/benchmarks/many-small-files/small-file-34.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 34
tests/benchmarks/many-small-files/small-file-35.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 35
tests/benchmarks/many-small-files/small-file-36.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 36
tests/benchmarks/many-small-files/small-file-37.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 37
tests/benchmarks/many-small-files/small-file-38.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 38
tests/benchmarks/many-small-files/small-file-39.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 39
tests/benchmarks/many-small-files/small-file-4.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 4
tests/benchmarks/many-small-files/small-file-40.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 40
tests/benchmarks/many-small-files/small-file-41.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 41
tests/benchmarks/many-small-files/small-file-42.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 42
tests/benchmarks/many-small-files/small-file-43.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 43
tests/benchmarks/many-small-files/small-file-44.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 44
tests/benchmarks/many-small-files/small-file-45.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 45
tests/benchmarks/many-small-files/small-file-46.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 46
tests/benchmarks/many-small-files/small-file-47.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 47
tests/benchmarks/many-small-files/small-file-48.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 48
tests/benchmarks/many-small-files/small-file-49.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 49
tests/benchmarks/many-small-files/small-file-5.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 5
tests/benchmarks/many-small-files/small-file-50.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 50
tests/benchmarks/many-small-files/small-file-51.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 51
tests/benchmarks/many-small-files/small-file-52.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 52
tests/benchmarks/many-small-files/small-file-53.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 53
tests/benchmarks/many-small-files/small-file-54.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 54
tests/benchmarks/many-small-files/small-file-55.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 55
tests/benchmarks/many-small-files/small-file-56.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 56
tests/benchmarks/many-small-files/small-file-57.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 57
tests/benchmarks/many-small-files/small-file-58.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 58
tests/benchmarks/many-small-files/small-file-59.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 59
tests/benchmarks/many-small-files/small-file-6.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 6
tests/benchmarks/many-small-files/small-file-60.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 60
tests/benchmarks/many-small-files/small-file-61.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 61
tests/benchmarks/many-small-files/small-file-62.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 62
tests/benchmarks/many-small-files/small-file-63.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 63
tests/benchmarks/many-small-files/small-file-64.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 64
tests/benchmarks/many-small-files/small-file-65.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 65
tests/benchmarks/many-small-files/small-file-66.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 66
tests/benchmarks/many-small-files/small-file-67.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 67
tests/benchmarks/many-small-files/small-file-68.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 68
tests/benchmarks/many-small-files/small-file-69.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 69
tests/benchmarks/many-small-files/small-file-7.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 7
tests/benchmarks/many-small-files/small-file-70.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 70
tests/benchmarks/many-small-files/small-file-71.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 71
tests/benchmarks/many-small-files/small-file-72.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 72
tests/benchmarks/many-small-files/small-file-73.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 73
tests/benchmarks/many-small-files/small-file-74.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 74
tests/benchmarks/many-small-files/small-file-75.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 75
tests/benchmarks/many-small-files/small-file-76.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 76
tests/benchmarks/many-small-files/small-file-77.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 77
tests/benchmarks/many-small-files/small-file-78.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 78
tests/benchmarks/many-small-files/small-file-79.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 79
tests/benchmarks/many-small-files/small-file-8.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 8
tests/benchmarks/many-small-files/small-file-80.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 80
tests/benchmarks/many-small-files/small-file-81.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 81
tests/benchmarks/many-small-files/small-file-82.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 82
tests/benchmarks/many-small-files/small-file-83.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 83
tests/benchmarks/many-small-files/small-file-84.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 84
tests/benchmarks/many-small-files/small-file-85.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 85
tests/benchmarks/many-small-files/small-file-86.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 86
tests/benchmarks/many-small-files/small-file-87.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 87
tests/benchmarks/many-small-files/small-file-88.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 88
tests/benchmarks/many-small-files/small-file-89.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 89
tests/benchmarks/many-small-files/small-file-9.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 9
tests/benchmarks/many-small-files/small-file-90.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 90
tests/benchmarks/many-small-files/small-file-91.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 91
tests/benchmarks/many-small-files/small-file-92.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 92
tests/benchmarks/many-small-files/small-file-93.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 93
tests/benchmarks/many-small-files/small-file-94.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 94
tests/benchmarks/many-small-files/small-file-95.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 95
tests/benchmarks/many-small-files/small-file-96.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 96
tests/benchmarks/many-small-files/small-file-97.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 97
tests/benchmarks/many-small-files/small-file-98.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 98
tests/benchmarks/many-small-files/small-file-99.txtnew file+1
@@ -0,0 +1 @@
1+I am small file 99
tests/benchmarks/run-benchmarks.sh+104−28
@@ -1,4 +1,5 @@
11#!/usr/bin/env bash
2+
23cd "$(dirname "${BASH_SOURCE[0]}")" || exit
34
45# Check that Hyperfine is installed.
@@ -8,27 +9,53 @@ if ! command -v hyperfine > /dev/null 2>&1; then
89 exit 1
910fi
1011
11−# Determine the target directories.
12−get_target_dir() {
13− if [[ -f "$HOME/.cargo/config" ]]; then
14− grep 'target-dir[[:space:]]*=' "$HOME/.cargo/config" \
15− | sed 's/^[[:space:]]*target-dir[[:space:]]*=//; s/^[[:space:]]*"//; s/"[[:space:]]*$//' \
16− && return 0
17− fi
12+# Check that python3 is installed.
13+if ! command -v python3 > /dev/null 2>&1; then
14+ echo "'python3' does not seem to be installed."
15+ echo "You can get it here: https://www.python.org/downloads/"
16+ exit 1
17+fi
18+
19+get_cargo_target_dir() {
20+ cargo metadata --no-deps --format-version 1 | python3 -c 'import sys, json; print(json.load(sys.stdin)["target_directory"])'
21+}
22+
23+heading() {
24+ bold=$(tput bold)$(tput setaf 220)
25+ normal=$(tput sgr0)
26+ echo
27+ printf "\n%s%s%s\n\n" "$bold" "$1" "$normal"
1828
19− echo "../../target"
29+ echo -e "\n### $1\n" >> "$REPORT"
2030}
2131
22−TARGET_DIR="$(get_target_dir)"
23−TARGET_DEBUG="${TARGET_DIR}/debug/bat"
32+# Clean up environment
33+unset BAT_CACHE_PATH
34+unset BAT_CONFIG_DIR
35+unset BAT_CONFIG_PATH
36+unset BAT_OPTS
37+unset BAT_PAGER
38+unset BAT_STYLE
39+unset BAT_TABS
40+unset BAT_THEME
41+unset COLORTERM
42+unset NO_COLOR
43+unset PAGER
44+
45+
46+RESULT_DIR="benchmark-results"
47+REPORT="$RESULT_DIR/report.md"
48+
49+TARGET_DIR="$(get_cargo_target_dir)"
2450TARGET_RELEASE="${TARGET_DIR}/release/bat"
2551
52+WARMUP_COUNT=3
53+
2654# Determine which target to benchmark.
2755BAT=''
2856for arg in "$@"; do
2957 case "$arg" in
3058 --system) BAT="bat" ;;
31− --debug) BAT="$TARGET_DEBUG" ;;
3259 --release) BAT="$TARGET_RELEASE" ;;
3360 --bat=*) BAT="${arg:6}" ;;
3461 esac
@@ -36,37 +63,86 @@ done
3663
3764if [[ -z "$BAT" ]]; then
3865 echo "A build of 'bat' must be specified for benchmarking."
39− echo "You can use '--system', '--debug', or '--release'."
66+ echo "You can use '--system', '--release' or '--bat=path/to/bat'."
4067 exit 1
4168fi
4269
43−# Ensure that the target is built.
4470if ! command -v "$BAT" &>/dev/null; then
45− echo "Could not find the build of bat to benchmark."
71+ echo "Could not find the build of bat to benchmark ($BAT)."
4672 case "$BAT" in
4773 "bat") echo "Make you sure to symlink 'batcat' as 'bat'." ;;
48− "$TARGET_DEBUG") echo "Make you sure to 'cargo build' first." ;;
4974 "$TARGET_RELEASE") echo "Make you sure to 'cargo build --release' first." ;;
5075 esac
5176 exit 1
5277fi
5378
54−# Run the benchmark.
55−echo "### Startup time"
56−echo
79+# Run the benchmarks
80+mkdir -p "$RESULT_DIR"
81+rm -f "$RESULT_DIR"/*.md
5782
58−hyperfine --warmup 3 "$BAT"
83+echo "## \`bat\` benchmark results" >> "$REPORT"
5984
60−echo
61−echo "### Plain text"
62−echo
6385
64−hyperfine --warmup 3 "$(printf "%q" "$BAT") --language txt --paging=never 'test-src/jquery-3.3.1.js'"
86+heading "Startup time"
87+hyperfine \
88+ "$(printf "%q" "$BAT") --no-config" \
89+ --command-name "bat" \
90+ --warmup "$WARMUP_COUNT" \
91+ --export-markdown "$RESULT_DIR/startup-time.md" \
92+ --export-json "$RESULT_DIR/startup-time.json"
93+cat "$RESULT_DIR/startup-time.md" >> "$REPORT"
6594
66−echo
67−echo "### Time to syntax-highlight large files"
68−echo
6995
70−for SRC in test-src/*; do
71− hyperfine --warmup 3 "$(printf "%q" "$BAT") --style=full --color=always --paging=never $(printf "%q" "$SRC")"
96+heading "Startup time with syntax highlighting"
97+hyperfine \
98+ "$(printf "%q" "$BAT") --no-config --color=always startup-time-src/small-CpuInfo-file.cpuinfo" \
99+ --command-name "bat … small-CpuInfo-file.cpuinfo" \
100+ --warmup "$WARMUP_COUNT" \
101+ --export-markdown "$RESULT_DIR/startup-time-with-syntax-highlighting.md" \
102+ --export-json "$RESULT_DIR/startup-time-with-syntax-highlighting.json"
103+cat "$RESULT_DIR/startup-time-with-syntax-highlighting.md" >> "$REPORT"
104+
105+
106+heading "Startup time with syntax with dependencies"
107+hyperfine \
108+ "$(printf "%q" "$BAT") --no-config --color=always startup-time-src/small-Markdown-file.md" \
109+ --command-name "bat … small-Markdown-file.md" \
110+ --warmup "$WARMUP_COUNT" \
111+ --export-markdown "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" \
112+ --export-json "$RESULT_DIR/startup-time-with-syntax-with-dependencies.json"
113+cat "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" >> "$REPORT"
114+
115+
116+heading "Plain-text speed"
117+hyperfine \
118+ "$(printf "%q" "$BAT") --no-config --language=txt --style=plain highlighting-speed-src/numpy_test_multiarray.py" \
119+ --command-name 'bat … --language=txt numpy_test_multiarray.py' \
120+ --warmup "$WARMUP_COUNT" \
121+ --export-markdown "$RESULT_DIR/plain-text-speed.md" \
122+ --export-json "$RESULT_DIR/plain-text-speed.json"
123+cat "$RESULT_DIR/plain-text-speed.md" >> "$REPORT"
124+
125+
126+for wrap in character never; do
127+ for SRC in highlighting-speed-src/*; do
128+ filename="$(basename "$SRC")"
129+
130+ heading "Syntax highlighting speed --wrap=${wrap}: \`$filename\`"
131+ hyperfine --warmup "$WARMUP_COUNT" \
132+ "$(printf "%q" "$BAT") --no-config --style=full --color=always --wrap=${wrap} --terminal-width=80 '$SRC'" \
133+ --command-name "bat … ${filename}" \
134+ --export-markdown "$RESULT_DIR/syntax-highlighting-speed-${filename}.md" \
135+ --export-json "$RESULT_DIR/syntax-highlighting-speed-${filename}.json"
136+ cat "$RESULT_DIR/syntax-highlighting-speed-${filename}.md" >> "$REPORT"
137+ done
72138done
139+
140+
141+heading "Many small files speed (overhead of metadata)"
142+hyperfine \
143+ "$(printf "%q" "$BAT") --no-config --language=txt --style=plain many-small-files/*.txt" \
144+ --command-name 'bat … --language=txt *.txt' \
145+ --warmup "$WARMUP_COUNT" \
146+ --export-markdown "$RESULT_DIR/many-small-files-speed.md" \
147+ --export-json "$RESULT_DIR/many-small-files-speed.json"
148+cat "$RESULT_DIR/many-small-files-speed.md" >> "$REPORT"
tests/benchmarks/startup-time-src/small-CpuInfo-file.cpuinfonew file+1
@@ -0,0 +1 @@
1+OneColor : AnotherColor
tests/benchmarks/startup-time-src/small-Markdown-file.mdnew file+3
@@ -0,0 +1,3 @@
1+# Keep this file small, we want to measure bat startup time, not speed of Markdown highlighting!
2+
3+The Markdown syntax definition references ~18 other syntaxes, so without lazy-loading, it will be slow to load.
tests/benchmarks/test-src/jquery-3.3.1.min.jsdeleted−2
@@ -1,2 +0,0 @@
1−/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
2−!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
tests/examples/git/.config/git/confignew file+3
@@ -0,0 +1,3 @@
1+[user]
2+ email = foo@bar.net
3+ name = foobar
tests/examples/git/.gitconfignew file+3
@@ -0,0 +1,3 @@
1+[user]
2+ email = foo@bar.net
3+ name = foobar
tests/examples/longline.jsonnew file+3
@@ -0,0 +1,3 @@
1+{"api":
2+ {"ANGLE_instanced_arrays":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"drawArraysInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"drawElementsInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawElementsInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"vertexAttribDivisorANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/vertexAttribDivisorANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController","spec_url":"https://dom.spec.whatwg.org/#interface-abortcontroller","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/AbortController","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","description":"<code>AbortController()</code> constructor","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"signal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/signal","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-signal②","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}}},"AbortPaymentEvent":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}},"AbortPaymentEvent":{"__compat":{"description":"<code>AbortPaymentEvent()</code> constructor","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}},"respondWith":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/respondWith","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}}},"AbortSignal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal","spec_url":"https://dom.spec.whatwg.org/#interface-AbortSignal","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-abort①","support":{"chrome":{"version_added":false},"chrome_android":{"version_added":false},"edge":{"version_added":false},"firefox":{"version_added":"88"},"firefox_android":{"version_added":"88"},"ie":{"version_added":false},"nodejs":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":false}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"abort_event":{"__compat":{"description":"<code>abort</code> event","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event","spec_url":"https://dom.spec.whatwg.org/#eventdef-abortsignal-abort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"aborted":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-aborted①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"onabort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/onabort","spec_url":"https://dom.spec.whatwg.org/#abortsignal-onabort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#absoluteorientationsensor-interface","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#dom-absoluteorientationsensor-absoluteorientationsensor","description":"<code>AbsoluteOrientationSensor()</code> constructor","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbstractRange":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange","spec_url":"https://dom.spec.whatwg.org/#interface-abstractrange","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":"14.1"},"safari_ios":{"version_added":"14.5"},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":"90"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"collapsed":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange/collapsed","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-range-collapsed①","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":
3+ {"version_added":false}
tests/integration_tests.rs+306−3
@@ -1,4 +1,5 @@
11use assert_cmd::cargo::CommandCargoExt;
2+use predicates::boolean::PredicateBooleanExt;
23use predicates::{prelude::predicate, str::PredicateStrExt};
34use serial_test::serial;
45use std::path::Path;
@@ -918,7 +919,7 @@ fn empty_file_leads_to_empty_output_with_rule_enabled() {
918919}
919920
920921#[test]
921−fn filename_basic() {
922+fn header_basic() {
922923 bat()
923924 .arg("test.txt")
924925 .arg("--decorations=always")
@@ -932,7 +933,21 @@ fn filename_basic() {
932933}
933934
934935#[test]
935−fn filename_binary() {
936+fn header_full_basic() {
937+ bat()
938+ .arg("test.txt")
939+ .arg("--decorations=always")
940+ .arg("--style=header-filename,header-filesize")
941+ .arg("-r=0:0")
942+ .arg("--file-name=foo")
943+ .assert()
944+ .success()
945+ .stdout("File: foo\nSize: 12 B\n")
946+ .stderr("");
947+}
948+
949+#[test]
950+fn header_binary() {
936951 bat()
937952 .arg("test.binary")
938953 .arg("--decorations=always")
@@ -945,6 +960,67 @@ fn filename_binary() {
945960 .stderr("");
946961}
947962
963+#[test]
964+fn header_full_binary() {
965+ bat()
966+ .arg("test.binary")
967+ .arg("--decorations=always")
968+ .arg("--style=header-filename,header-filesize")
969+ .arg("-r=0:0")
970+ .arg("--file-name=foo")
971+ .assert()
972+ .success()
973+ .stdout("File: foo <BINARY>\nSize: 4 B\n")
974+ .stderr("");
975+}
976+
977+#[test]
978+fn header_default() {
979+ bat()
980+ .arg("--paging=never")
981+ .arg("--color=never")
982+ .arg("--terminal-width=80")
983+ .arg("--wrap=never")
984+ .arg("--decorations=always")
985+ .arg("--style=default")
986+ .arg("single-line.txt")
987+ .assert()
988+ .success()
989+ .stdout(
990+ "\
991+───────┬────────────────────────────────────────────────────────────────────────
992+ │ File: single-line.txt
993+───────┼────────────────────────────────────────────────────────────────────────
994+ 1 │ Single Line
995+───────┴────────────────────────────────────────────────────────────────────────
996+",
997+ )
998+ .stderr("");
999+}
1000+
1001+#[test]
1002+fn header_default_is_default() {
1003+ bat()
1004+ .arg("--paging=never")
1005+ .arg("--color=never")
1006+ .arg("--terminal-width=80")
1007+ .arg("--wrap=never")
1008+ .arg("--decorations=always")
1009+ .arg("single-line.txt")
1010+ .assert()
1011+ .success()
1012+ .stdout(
1013+ "\
1014+───────┬────────────────────────────────────────────────────────────────────────
1015+ │ File: single-line.txt
1016+───────┼────────────────────────────────────────────────────────────────────────
1017+ 1 │ Single Line
1018+───────┴────────────────────────────────────────────────────────────────────────
1019+",
1020+ )
1021+ .stderr("");
1022+}
1023+
9481024#[test]
9491025fn filename_stdin() {
9501026 bat()
@@ -1015,6 +1091,18 @@ fn header_padding() {
10151091 .stderr("");
10161092}
10171093
1094+#[test]
1095+fn header_full_padding() {
1096+ bat()
1097+ .arg("--decorations=always")
1098+ .arg("--style=header-filename,header-filesize")
1099+ .arg("test.txt")
1100+ .arg("single-line.txt")
1101+ .assert()
1102+ .stdout("File: test.txt\nSize: 12 B\nhello world\n\nFile: single-line.txt\nSize: 11 B\nSingle Line\n")
1103+ .stderr("");
1104+}
1105+
10181106#[test]
10191107fn header_padding_rule() {
10201108 bat()
@@ -1035,6 +1123,28 @@ Single Line
10351123 .stderr("");
10361124}
10371125
1126+#[test]
1127+fn header_full_padding_rule() {
1128+ bat()
1129+ .arg("--decorations=always")
1130+ .arg("--style=header-filename,header-filesize,rule")
1131+ .arg("--terminal-width=80")
1132+ .arg("test.txt")
1133+ .arg("single-line.txt")
1134+ .assert()
1135+ .stdout(
1136+ "File: test.txt
1137+Size: 12 B
1138+hello world
1139+────────────────────────────────────────────────────────────────────────────────
1140+File: single-line.txt
1141+Size: 11 B
1142+Single Line
1143+",
1144+ )
1145+ .stderr("");
1146+}
1147+
10381148#[test]
10391149fn grid_overrides_rule() {
10401150 bat()
@@ -1054,7 +1164,9 @@ Single Line
10541164────────────────────────────────────────────────────────────────────────────────
10551165",
10561166 )
1057− .stderr("\x1b[33m[bat warning]\x1b[0m: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.\n");
1167+ .stderr(
1168+ "\x1b[33m[bat warning]\x1b[0m: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.\n",
1169+ );
10581170}
10591171
10601172#[cfg(target_os = "linux")]
@@ -1152,6 +1264,52 @@ fn show_all_mode() {
11521264 .stderr("");
11531265}
11541266
1267+#[test]
1268+fn show_all_extends_tab_markers_to_next_tabstop() {
1269+ bat()
1270+ .arg("tabs.txt")
1271+ .arg("--show-all")
1272+ .arg("--tabs=4")
1273+ .arg("--style=plain")
1274+ .assert()
1275+ .success()
1276+ .stdout(
1277+ "├──┤1├─┤2├─┤3├─┤4␊
1278+1├─┤?␊
1279+22├┤?␊
1280+333↹?␊
1281+4444├──┤?␊
1282+55555├─┤?␊
1283+666666├┤?␊
1284+7777777↹?␊
1285+88888888├──┤?␊
1286+",
1287+ );
1288+}
1289+
1290+#[test]
1291+fn show_all_extends_tab_markers_to_next_tabstop_width_8() {
1292+ bat()
1293+ .arg("tabs.txt")
1294+ .arg("--show-all")
1295+ .arg("--tabs=8")
1296+ .arg("--style=plain")
1297+ .assert()
1298+ .success()
1299+ .stdout(
1300+ "├──────┤1├─────┤2├─────┤3├─────┤4␊
1301+1├─────┤?␊
1302+22├────┤?␊
1303+333├───┤?␊
1304+4444├──┤?␊
1305+55555├─┤?␊
1306+666666├┤?␊
1307+7777777↹?␊
1308+88888888├──────┤?␊
1309+",
1310+ );
1311+}
1312+
11551313#[test]
11561314fn no_paging_arg() {
11571315 bat()
@@ -1218,6 +1376,7 @@ fn grid_for_file_without_newline() {
12181376 "\
12191377───────┬────────────────────────────────────────────────────────────────────────
12201378 │ File: single-line.txt
1379+ │ Size: 11 B
12211380───────┼────────────────────────────────────────────────────────────────────────
12221381 1 │ Single Line
12231382───────┴────────────────────────────────────────────────────────────────────────
@@ -1226,10 +1385,50 @@ fn grid_for_file_without_newline() {
12261385 .stderr("");
12271386}
12281387
1388+// For ANSI theme, use underscore as a highlighter
1389+#[test]
1390+fn ansi_highlight_underline() {
1391+ bat()
1392+ .arg("--paging=never")
1393+ .arg("--color=never")
1394+ .arg("--terminal-width=80")
1395+ .arg("--wrap=never")
1396+ .arg("--decorations=always")
1397+ .arg("--theme=ansi")
1398+ .arg("--style=plain")
1399+ .arg("--highlight-line=1")
1400+ .write_stdin("Ansi Underscore Test\nAnother Line")
1401+ .assert()
1402+ .success()
1403+ .stdout("\x1B[4mAnsi Underscore Test\n\x1B[24mAnother Line")
1404+ .stderr("");
1405+}
1406+
1407+// Ensure that ANSI passthrough is emitted properly for both wrapping and non-wrapping printer.
1408+#[test]
1409+fn ansi_passthrough_emit() {
1410+ for wrapping in &["never", "character"] {
1411+ bat()
1412+ .arg("--paging=never")
1413+ .arg("--color=never")
1414+ .arg("--terminal-width=80")
1415+ .arg(format!("--wrap={}", wrapping))
1416+ .arg("--decorations=always")
1417+ .arg("--style=plain")
1418+ .write_stdin("\x1B[33mColor\nColor \x1B[m\nPlain\n")
1419+ .assert()
1420+ .success()
1421+ .stdout("\x1B[33m\x1B[33mColor\n\x1B[33mColor \x1B[m\nPlain\n")
1422+ .stderr("");
1423+ }
1424+}
1425+
12291426#[test]
12301427fn ignored_suffix_arg() {
12311428 bat()
12321429 .arg("-f")
1430+ .arg("--theme")
1431+ .arg("Monokai Extended")
12331432 .arg("-p")
12341433 .arg("test.json~")
12351434 .assert()
@@ -1239,6 +1438,8 @@ fn ignored_suffix_arg() {
12391438
12401439 bat()
12411440 .arg("-f")
1441+ .arg("--theme")
1442+ .arg("Monokai Extended")
12421443 .arg("-p")
12431444 .arg("--ignored-suffix=.suffix")
12441445 .arg("test.json.suffix")
@@ -1249,6 +1450,8 @@ fn ignored_suffix_arg() {
12491450
12501451 bat()
12511452 .arg("-f")
1453+ .arg("--theme")
1454+ .arg("Monokai Extended")
12521455 .arg("-p")
12531456 .arg("test.json.suffix")
12541457 .assert()
@@ -1256,3 +1459,103 @@ fn ignored_suffix_arg() {
12561459 .stdout("\u{1b}[38;5;231m{\"test\": \"value\"}\u{1b}[0m")
12571460 .stderr("");
12581461}
1462+
1463+#[test]
1464+fn highlighting_is_skipped_on_long_lines() {
1465+ let expected = "\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mapi\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\n".to_owned() +
1466+ "\u{1b}" +
1467+ r#"[38;5;231m {"ANGLE_instanced_arrays":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"drawArraysInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"drawElementsInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawElementsInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"vertexAttribDivisorANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/vertexAttribDivisorANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController","spec_url":"https://dom.spec.whatwg.org/#interface-abortcontroller","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/AbortController","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","description":"<code>AbortController()</code> constructor","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"signal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/signal","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-signal②","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}}},"AbortPaymentEvent":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}},"AbortPaymentEvent":{"__compat":{"description":"<code>AbortPaymentEvent()</code> constructor","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}},"respondWith":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/respondWith","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}}},"AbortSignal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal","spec_url":"https://dom.spec.whatwg.org/#interface-AbortSignal","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-abort①","support":{"chrome":{"version_added":false},"chrome_android":{"version_added":false},"edge":{"version_added":false},"firefox":{"version_added":"88"},"firefox_android":{"version_added":"88"},"ie":{"version_added":false},"nodejs":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":false}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"abort_event":{"__compat":{"description":"<code>abort</code> event","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event","spec_url":"https://dom.spec.whatwg.org/#eventdef-abortsignal-abort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"aborted":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-aborted①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"onabort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/onabort","spec_url":"https://dom.spec.whatwg.org/#abortsignal-onabort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#absoluteorientationsensor-interface","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#dom-absoluteorientationsensor-absoluteorientationsensor","description":"<code>AbsoluteOrientationSensor()</code> constructor","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbstractRange":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange","spec_url":"https://dom.spec.whatwg.org/#interface-abstractrange","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":"14.1"},"safari_ios":{"version_added":"14.5"},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":"90"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"collapsed":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange/collapsed","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-range-collapsed①","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":"# +
1468+ "\u{1b}[0m\n\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mversion_added\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\u{1b}[38;5;141mfalse\u{1b}[0m\u{1b}[38;5;231m}\u{1b}[0m\n";
1469+
1470+ bat()
1471+ .arg("-f")
1472+ .arg("--theme")
1473+ .arg("Monokai Extended")
1474+ .arg("-p")
1475+ .arg("longline.json")
1476+ .assert()
1477+ .success()
1478+ .stdout(expected)
1479+ .stderr("");
1480+}
1481+
1482+#[test]
1483+fn all_global_git_config_locations_syntax_mapping_work() {
1484+ let fake_home = Path::new(EXAMPLES_DIR).join("git").canonicalize().unwrap();
1485+ let expected = "\u{1b}[38;5;231m[\u{1b}[0m\u{1b}[38;5;149muser\u{1b}[0m\u{1b}[38;5;231m]\u{1b}[0m
1486+\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;231memail\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;203m=\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;186mfoo@bar.net\u{1b}[0m
1487+\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;231mname\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;203m=\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;186mfoobar\u{1b}[0m
1488+";
1489+
1490+ bat()
1491+ .env("XDG_CONFIG_HOME", fake_home.join(".config").as_os_str())
1492+ .arg("-f")
1493+ .arg("--theme")
1494+ .arg("Monokai Extended")
1495+ .arg("-p")
1496+ .arg("git/.config/git/config")
1497+ .assert()
1498+ .success()
1499+ .stdout(expected)
1500+ .stderr("");
1501+
1502+ bat()
1503+ .env("HOME", fake_home.as_os_str())
1504+ .arg("-f")
1505+ .arg("--theme")
1506+ .arg("Monokai Extended")
1507+ .arg("-p")
1508+ .arg("git/.config/git/config")
1509+ .assert()
1510+ .success()
1511+ .stdout(expected)
1512+ .stderr("");
1513+
1514+ bat()
1515+ .env("HOME", fake_home.as_os_str())
1516+ .arg("-f")
1517+ .arg("--theme")
1518+ .arg("Monokai Extended")
1519+ .arg("-p")
1520+ .arg("git/.gitconfig")
1521+ .assert()
1522+ .success()
1523+ .stdout(expected)
1524+ .stderr("");
1525+}
1526+
1527+#[test]
1528+fn acknowledgements() {
1529+ bat()
1530+ .arg("--acknowledgements")
1531+ .assert()
1532+ .success()
1533+ .stdout(
1534+ // Just some sanity checking that avoids names of persons, except our own Keith Hall :)
1535+ predicate::str::contains(
1536+ "Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).",
1537+ )
1538+ .and(predicate::str::contains(
1539+ "Copyright (c) 2012-2020 The Sublime CMake authors",
1540+ ))
1541+ .and(predicate::str::contains(
1542+ "Copyright 2014-2015 SaltStack Team",
1543+ ))
1544+ .and(predicate::str::contains(
1545+ "Copyright (c) 2013-present Dracula Theme",
1546+ ))
1547+ .and(predicate::str::contains(
1548+ "## syntaxes/01_Packages/Rust/LICENSE.txt",
1549+ ))
1550+ .and(predicate::str::contains(
1551+ "## syntaxes/02_Extra/http-request-response/LICENSE",
1552+ ))
1553+ .and(predicate::str::contains(
1554+ "## themes/dracula-sublime/LICENSE",
1555+ ))
1556+ .and(predicate::str::contains("Copyright (c) 2017 b123400"))
1557+ .and(predicate::str::contains("Copyright (c) 2021 Keith Hall"))
1558+ .and(predicate::str::contains("Copyright 2014 Clams")),
1559+ )
1560+ .stderr("");
1561+}
tests/scripts/license-checks.shnew file+24
@@ -0,0 +1,24 @@
1+#!/usr/bin/env bash
2+set -o errexit -o nounset -o pipefail
3+
4+# Make sure that we don't accidentally include GPL licenced files
5+gpl_term="General Public License"
6+gpl_excludes=(
7+ # Snippet expands to GPL, but is not under GPL
8+ ":(exclude)assets/syntaxes/01_Packages/Matlab/Snippets/Octave-function.sublime-snippet"
9+
10+ # 'gpl_term' matches itself :D
11+ ":(exclude)tests/scripts/license-checks.sh"
12+
13+ # Contains a reference to GPL, but is not under GPL
14+ ":(exclude)tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md"
15+)
16+gpl_occurances=$(git grep --recurse-submodules "${gpl_term}" -- "${gpl_excludes[@]}" || true)
17+
18+if [ -z "${gpl_occurances}" ]; then
19+ echo "PASS: No files under GPL were found"
20+else
21+ echo "FAIL: GPL:ed code is not compatible with bat, but occurances of '${gpl_term}' were found:"
22+ echo "${gpl_occurances}"
23+ exit 1
24+fi
tests/snapshots/output/full.snapshot.txt+1
@@ -1,5 +1,6 @@
11───────┬────────────────────────────────────────────────────────────────────────
22 │ File: sample.rs
3+ │ Size: 533 B
34───────┼────────────────────────────────────────────────────────────────────────
45 1 + │ /// A rectangle. First line is changed to prevent a regression of #1869
56 2 │ struct Rectangle {
tests/syntax-tests/highlighted/Dart/inner_comment.dartnew file+5
@@ -0,0 +1,5 @@
1+return Object(
2+ Object(
3+ // Not highlighted as a comment
4+ )
5+)
tests/syntax-tests/highlighted/Dart/test.dart+52−52

This diff is too big to show here.

tests/syntax-tests/highlighted/INI/test.infnew file+5

This diff is too big to show here.

tests/syntax-tests/highlighted/JQ/sample.jqnew file+60

This diff is too big to show here.

tests/syntax-tests/highlighted/Log/example.log+1

This diff is too big to show here.

tests/syntax-tests/highlighted/PowerShell/test.ps1+2−2

This diff is too big to show here.

tests/syntax-tests/highlighted/RequirementsTXT/requirements.txtdeleted−8

This diff is too big to show here.

tests/syntax-tests/highlighted/SCSS/example.scss+16−16

This diff is too big to show here.

tests/syntax-tests/highlighted/Sass/example.sass+18−18

This diff is too big to show here.

tests/syntax-tests/highlighted/Svelte/App.svelte+5−1

This diff is too big to show here.

tests/syntax-tests/highlighted/Syslog/example.syslog+3−3

This diff is too big to show here.

tests/syntax-tests/highlighted/Vue/example.vue+5

This diff is too big to show here.

tests/syntax-tests/highlighted/Zig/example.zig+39−39

This diff is too big to show here.

tests/syntax-tests/highlighted/cmd-help/test.cmd-helpnew file+54

This diff is too big to show here.

tests/syntax-tests/highlighted/nim/test.nimblenew file+23

This diff is too big to show here.

tests/syntax-tests/source/Dart/inner_comment.dartnew file+5

This diff is too big to show here.

tests/syntax-tests/source/INI/test.infnew file+5

This diff is too big to show here.

tests/syntax-tests/source/JQ/LICENSE.mdnew file+25

This diff is too big to show here.

tests/syntax-tests/source/JQ/sample.jqnew file+60

This diff is too big to show here.

tests/syntax-tests/source/Log/example.log+1

This diff is too big to show here.

tests/syntax-tests/source/RequirementsTXT/requirements.txtdeleted−8

This diff is too big to show here.

tests/syntax-tests/source/Svelte/App.svelte+5−1

This diff is too big to show here.

tests/syntax-tests/source/Vue/example.vue+5

This diff is too big to show here.

tests/syntax-tests/source/cmd-help/test.cmd-helpnew file+54

This diff is too big to show here.

tests/syntax-tests/source/nim/test.nimblenew file+23

This diff is too big to show here.