mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 10:52:24 +01:00
Compare commits
216 Commits
v0.18.0
...
ci-experim
Author | SHA1 | Date | |
---|---|---|---|
|
8244eb8ef8 | ||
|
ff70a80741 | ||
|
ecdb17148d | ||
|
11bd523f7e | ||
|
01fbedc246 | ||
|
05e4e1f2f2 | ||
|
20223ad77c | ||
|
51edacb5eb | ||
|
5197ef9048 | ||
|
19678527e5 | ||
|
5d319dee94 | ||
|
43e1a11ad8 | ||
|
ed09f90e5e | ||
|
cbd96237fd | ||
|
f5c1cb2dff | ||
|
5eb93a6eae | ||
|
25fa577cd0 | ||
|
deddc81426 | ||
|
133b06e945 | ||
|
699f1e65cc | ||
|
9ef87dab27 | ||
|
5125e9c941 | ||
|
6c62ed5608 | ||
|
bf78288e9e | ||
|
f8498b260b | ||
|
79f08588c6 | ||
|
2d92a4dbb3 | ||
|
f508ddf66d | ||
|
02218c916c | ||
|
89217e0d58 | ||
|
cb4973987b | ||
|
905902d811 | ||
|
c83e382eac | ||
|
f6975e2acd | ||
|
d8b813c0bf | ||
|
5236ed135e | ||
|
47d955a2ab | ||
|
bd797c75a4 | ||
|
05c11964fc | ||
|
8ecd23eab4 | ||
|
1ef0206f24 | ||
|
6694aa369e | ||
|
0331d28ee4 | ||
|
51c7eb7ac1 | ||
|
5516bcb839 | ||
|
056b966501 | ||
|
28eca6a2be | ||
|
b7fd55242e | ||
|
8161955cc7 | ||
|
3b020fd95a | ||
|
697d106bd4 | ||
|
50e1c6074f | ||
|
a610987ef7 | ||
|
a7fd9f4b1b | ||
|
5f5b77cdda | ||
|
83808a63be | ||
|
6d5ff671e7 | ||
|
ffdf349a96 | ||
|
f3d53b79a2 | ||
|
6acec2c074 | ||
|
1bac3750df | ||
|
b040efff79 | ||
|
a81009607a | ||
|
c0e09662b4 | ||
|
ccf4563573 | ||
|
fb1ab09e3e | ||
|
f464b1ba39 | ||
|
2ea6348b85 | ||
|
6e536ab06d | ||
|
7537e309d8 | ||
|
84e2a2e5d1 | ||
|
f6fc826dc6 | ||
|
375d55aa5d | ||
|
6ef2bb3283 | ||
|
fc0794a83d | ||
|
589df6792f | ||
|
945bba777b | ||
|
64763eafbe | ||
|
3da4651569 | ||
|
311ed2feca | ||
|
33c11d64f0 | ||
|
a4b674902f | ||
|
3fa09dbe2e | ||
|
bf2b2df9c9 | ||
|
3617c98cf5 | ||
|
774d36c989 | ||
|
6abd61865f | ||
|
3c59b98dc8 | ||
|
21338ed789 | ||
|
dc8ab0b5ce | ||
|
ddb39ef2f6 | ||
|
355e62efe9 | ||
|
fddd11a205 | ||
|
8b37e62cf3 | ||
|
4296d47dcb | ||
|
42f1ef019a | ||
|
fe8e526292 | ||
|
0e9d612173 | ||
|
06c601bc7c | ||
|
229fbc1a18 | ||
|
e05f5010da | ||
|
073b9968c0 | ||
|
d3aa17ae77 | ||
|
4187eed12b | ||
|
12ecb325c9 | ||
|
90e48e9b61 | ||
|
35f31270f3 | ||
|
2a71852070 | ||
|
c8dd32802d | ||
|
71f04dc0e8 | ||
|
49f8bbfee4 | ||
|
f4217eba73 | ||
|
14900f6ed8 | ||
|
c18afcb01a | ||
|
63043d4a60 | ||
|
76034880ae | ||
|
768189859a | ||
|
6e5a2a5c51 | ||
|
9935c4984c | ||
|
a0a5e30c39 | ||
|
4126bbeead | ||
|
a5b79295d7 | ||
|
e917784932 | ||
|
f46b90d28d | ||
|
64cbfbed47 | ||
|
1ced35ec76 | ||
|
16d346773b | ||
|
b02120cf66 | ||
|
702b5caf2d | ||
|
d395f64f58 | ||
|
c9627040cc | ||
|
b1f69434f9 | ||
|
bcca56e3b1 | ||
|
2f98610929 | ||
|
89539ff247 | ||
|
aa74d19940 | ||
|
cf7d9ef962 | ||
|
425a0f90e9 | ||
|
a27814db8e | ||
|
9702f5256c | ||
|
23fd11e806 | ||
|
304ee1489c | ||
|
07d4179274 | ||
|
1439dde265 | ||
|
bef0bf1654 | ||
|
8435cad602 | ||
|
52c11fe23d | ||
|
6fc9641f6a | ||
|
8b6341458b | ||
|
8b787b4f70 | ||
|
ef5154d5b3 | ||
|
7c49919297 | ||
|
395a169104 | ||
|
93f710bdff | ||
|
170badfdd1 | ||
|
978b9adc56 | ||
|
3aea51455b | ||
|
f827ed338b | ||
|
73dab51ad1 | ||
|
9328007d05 | ||
|
8d173cd960 | ||
|
fb0f12a221 | ||
|
9866408b72 | ||
|
aaac56d895 | ||
|
516da7719f | ||
|
d4df0b4405 | ||
|
bfa9c3bef6 | ||
|
2904f24ea8 | ||
|
91a347bf6d | ||
|
e219c8fc03 | ||
|
9eb26b702c | ||
|
c933be926d | ||
|
fc88040b31 | ||
|
5db3c93057 | ||
|
aa442b5795 | ||
|
09711cd6f9 | ||
|
b16cacc758 | ||
|
51451a9636 | ||
|
fbc03da997 | ||
|
1a610dbdd2 | ||
|
a30e3c9066 | ||
|
613b41e357 | ||
|
d405aa98d5 | ||
|
285b1556a9 | ||
|
8321cc661c | ||
|
848ceb6f10 | ||
|
3559079de0 | ||
|
b3ab843954 | ||
|
867cf63dd9 | ||
|
0b44aa6f68 | ||
|
aa09a9dc04 | ||
|
7c4edacb2b | ||
|
782ede5db5 | ||
|
1537733e6b | ||
|
ba0d43672b | ||
|
4384d25c79 | ||
|
b6e3786529 | ||
|
6fff01397d | ||
|
0cd52e5be1 | ||
|
c14dd34dca | ||
|
e04fbd1992 | ||
|
d89fa3ebc2 | ||
|
db57454f3f | ||
|
8f93844427 | ||
|
52f84b063c | ||
|
2e7f2b6c07 | ||
|
35347c2310 | ||
|
b489fc75c9 | ||
|
fc24cb2a77 | ||
|
2540311cdf | ||
|
3880888286 | ||
|
5a806c2149 | ||
|
8a926d511a | ||
|
8885285b10 | ||
|
d1f0181947 | ||
|
b147443c32 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: [sharkdp, keith-hall, Enselic]
|
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -9,11 +9,6 @@ assignees: ''
|
||||
|
||||
<!-- Hey there, thank you for creating an issue! -->
|
||||
|
||||
**What version of `bat` are you using?**
|
||||
|
||||
<!-- Output of `bat --version` -->
|
||||
|
||||
|
||||
**Describe the bug you encountered:**
|
||||
|
||||
...
|
||||
@@ -29,19 +24,24 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Environment**
|
||||
**bat version and environment**
|
||||
|
||||
<!--
|
||||
In order to reproduce your issue, please add some information about the environment
|
||||
in which you're running bat.
|
||||
in which you're running bat. To do this, run the full `bat` command that demonstrates
|
||||
the bug, and attach the `--diagnostic` option:
|
||||
|
||||
Linux and MacOS:
|
||||
Please run the script at
|
||||
bat [other options and arguments…] --diagnostic
|
||||
|
||||
Finally, paste the Markdown output here. Please make sure that it does not reveal any
|
||||
personal information.
|
||||
|
||||
|
||||
If you are running bat 0.17.1 or older (where --diagnostic is not available), please
|
||||
run the script at
|
||||
|
||||
https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh
|
||||
|
||||
(click "Raw" to get the actual source code) and paste the Markdown output here.
|
||||
|
||||
Windows:
|
||||
Please add your Windows Version (e.g. "Windows 10 1908")
|
||||
(click "Raw" to get the actual source code) and paste the Markdown output here. If you
|
||||
are on Windows, please let us know your bat version and your Windows version.
|
||||
-->
|
||||
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
1
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,2 +1 @@
|
||||
blank_issues_enabled: true
|
||||
|
||||
|
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -7,4 +7,3 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
1
.github/ISSUE_TEMPLATE/question.md
vendored
1
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -7,4 +7,3 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
18
.github/dependabot.yml
vendored
Normal file
18
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: cargo
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
||||
ignore:
|
||||
- dependency-name: git2
|
||||
versions:
|
||||
- 0.13.17
|
||||
- package-ecosystem: gitsubmodule
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
94
.github/workflows/CICD.yml
vendored
94
.github/workflows/CICD.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: CICD
|
||||
|
||||
env:
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.42.0"
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.45.0"
|
||||
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
||||
|
||||
on:
|
||||
@@ -16,32 +16,37 @@ on:
|
||||
jobs:
|
||||
min_version:
|
||||
name: Minimum supported rust version
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
|
||||
default: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
components: clippy
|
||||
components: clippy, rustfmt
|
||||
- name: Ensure `cargo fmt` has been run
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: -- --check
|
||||
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
# clippy::match_bool is allowed by default from Rust 1.45.0, see
|
||||
# https://github.com/rust-lang/rust-clippy/commit/e1d13c34b0beaea9a5fbf13687672ef85e779d9f
|
||||
args: --all-targets --all-features -- --allow clippy::match_bool
|
||||
args: --locked --all-targets --all-features
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --locked
|
||||
|
||||
test_with_new_syntaxes_and_themes:
|
||||
name: Run tests with updated syntaxes and themes
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -69,18 +74,25 @@ jobs:
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --release
|
||||
args: --locked --release
|
||||
- name: Run ignored-by-default unit tests with new syntaxes and themes
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --release -- --ignored
|
||||
args: --locked --release -- --ignored
|
||||
- name: Syntax highlighting regression test
|
||||
run: tests/syntax-tests/regression_test.sh
|
||||
- name: List of languages
|
||||
run: bat --list-languages
|
||||
- name: List of themes
|
||||
run: bat --list-themes
|
||||
- name: Check documentation
|
||||
env:
|
||||
RUSTDOCFLAGS: -D warnings
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: doc
|
||||
args: --locked --no-deps --document-private-items --all-features
|
||||
|
||||
build:
|
||||
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
|
||||
@@ -89,17 +101,18 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job:
|
||||
- { os: ubuntu-18.04 , target: arm-unknown-linux-gnueabihf , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu }
|
||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: true }
|
||||
- { os: macos-10.15 , target: x86_64-apple-darwin }
|
||||
# - { os: windows-2019 , target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found
|
||||
- { os: windows-2019 , target: i686-pc-windows-msvc }
|
||||
- { os: windows-2019 , target: x86_64-pc-windows-gnu }
|
||||
- { os: windows-2019 , target: x86_64-pc-windows-msvc }
|
||||
- { os: ubuntu-20.04, target: arm-unknown-linux-gnueabihf , use-cross: true }
|
||||
- { os: ubuntu-20.04, target: arm-unknown-linux-musleabihf, use-cross: true }
|
||||
- { os: ubuntu-20.04, target: aarch64-unknown-linux-gnu , use-cross: true }
|
||||
- { os: ubuntu-20.04, target: i686-unknown-linux-gnu , use-cross: true }
|
||||
- { os: ubuntu-20.04, target: i686-unknown-linux-musl , use-cross: true }
|
||||
- { os: ubuntu-20.04, target: x86_64-unknown-linux-gnu }
|
||||
- { os: ubuntu-20.04, target: x86_64-unknown-linux-musl , use-cross: true }
|
||||
- { os: macos-10.15 , target: x86_64-apple-darwin }
|
||||
# - { os: windows-2019, target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found
|
||||
- { os: windows-2019, target: i686-pc-windows-msvc }
|
||||
- { os: windows-2019, target: x86_64-pc-windows-gnu }
|
||||
- { os: windows-2019, target: x86_64-pc-windows-msvc }
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v2
|
||||
@@ -108,14 +121,14 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
case ${{ matrix.job.target }} in
|
||||
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
||||
esac
|
||||
|
||||
- name: Extract crate information
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
|
||||
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
|
||||
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||
@@ -143,7 +156,7 @@ jobs:
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: build
|
||||
args: --release --target=${{ matrix.job.target }}
|
||||
args: --locked --release --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Strip debug information from executable
|
||||
id: strip
|
||||
@@ -158,7 +171,7 @@ jobs:
|
||||
# Figure out what strip tool to use if any
|
||||
STRIP="strip"
|
||||
case ${{ matrix.job.target }} in
|
||||
arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;;
|
||||
arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;;
|
||||
aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;;
|
||||
*-pc-windows-msvc) STRIP="" ;;
|
||||
esac;
|
||||
@@ -181,63 +194,61 @@ jobs:
|
||||
echo ::set-output name=BIN_PATH::${BIN_PATH}
|
||||
echo ::set-output name=BIN_NAME::${BIN_NAME}
|
||||
|
||||
- name: Set testing options
|
||||
id: test-options
|
||||
shell: bash
|
||||
run: |
|
||||
# test only library unit tests and binary for arm-type targets
|
||||
unset CARGO_TEST_OPTIONS
|
||||
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
|
||||
echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
|
||||
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: test
|
||||
args: --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
|
||||
args: --locked --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Run bat
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: run
|
||||
args: --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs
|
||||
args: --locked --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs
|
||||
|
||||
- name: Show diagnostics (bat --diagnostic)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: run
|
||||
args: --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs --diagnostic
|
||||
args: --locked --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs --diagnostic
|
||||
|
||||
- name: "Feature check: regex-onig"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
||||
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
||||
|
||||
- name: "Feature check: regex-onig,git"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
||||
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
||||
|
||||
- name: "Feature check: regex-onig,paging"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
||||
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
||||
|
||||
- name: "Feature check: regex-onig,git,paging"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||
|
||||
- name: "Feature check: minimal-application"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --locked --target=${{ matrix.job.target }} --verbose --no-default-features --features minimal-application
|
||||
|
||||
- name: Create tarball
|
||||
id: package
|
||||
@@ -263,6 +274,7 @@ jobs:
|
||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
|
||||
|
||||
# Autocompletion files
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.bash "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.bash"
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh"
|
||||
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
**/*.rs.bk
|
||||
|
||||
# Generated files
|
||||
/assets/completions/bat.bash
|
||||
/assets/completions/bat.fish
|
||||
/assets/completions/bat.zsh
|
||||
/assets/manual/bat.1
|
||||
|
28
.gitmodules
vendored
28
.gitmodules
vendored
@@ -61,9 +61,6 @@
|
||||
[submodule "assets/syntaxes/Puppet"]
|
||||
path = assets/syntaxes/02_Extra/Puppet
|
||||
url = https://github.com/russCloak/SublimePuppet
|
||||
[submodule "assets/syntaxes/CSV"]
|
||||
path = assets/syntaxes/02_Extra/CSV
|
||||
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV
|
||||
[submodule "assets/themes/onehalf"]
|
||||
path = assets/themes/onehalf
|
||||
url = https://github.com/sonph/onehalf
|
||||
@@ -97,10 +94,6 @@
|
||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||
[submodule "assets/syntaxes/syslog-syntax"]
|
||||
path = assets/syntaxes/02_Extra/Syslog
|
||||
url = https://github.com/caos21/syslog-syntax.git
|
||||
branch = master
|
||||
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
|
||||
path = assets/syntaxes/02_Extra/Protobuf
|
||||
url = https://github.com/VcamX/protobuf-syntax-highlighting.git
|
||||
@@ -216,3 +209,24 @@
|
||||
[submodule "assets/syntaxes/02_Extra/gnuplot"]
|
||||
path = assets/syntaxes/02_Extra/gnuplot
|
||||
url = https://github.com/hesstobi/sublime_gnuplot
|
||||
[submodule "assets/syntaxes/02_Extra/SystemVerilog"]
|
||||
path = assets/syntaxes/02_Extra/SystemVerilog
|
||||
url = https://github.com/TheClams/SystemVerilog.git
|
||||
[submodule "assets/themes/visual-studio-dark-plus"]
|
||||
path = assets/themes/visual-studio-dark-plus
|
||||
url = https://github.com/vidann1/visual-studio-dark-plus.git
|
||||
[submodule "assets/syntaxes/02_Extra/SublimeEthereum"]
|
||||
path = assets/syntaxes/02_Extra/SublimeEthereum
|
||||
url = https://github.com/davidhq/SublimeEthereum.git
|
||||
[submodule "assets/syntaxes/02_Extra/Groff"]
|
||||
path = assets/syntaxes/02_Extra/Groff
|
||||
url = https://github.com/carsonoid/sublime_man_page_support
|
||||
[submodule "assets/syntaxes/02_Extra/http-request-response"]
|
||||
path = assets/syntaxes/02_Extra/http-request-response
|
||||
url = https://github.com/keith-hall/http-request-response-syntax.git
|
||||
[submodule "assets/syntaxes/02_Extra/LLVM"]
|
||||
path = assets/syntaxes/02_Extra/LLVM
|
||||
url = https://github.com/ioncodes/LLVM.tmBundle
|
||||
[submodule "assets/syntaxes/02_Extra/Slim"]
|
||||
path = assets/syntaxes/02_Extra/Slim
|
||||
url = https://github.com/slim-template/ruby-slim.tmbundle.git
|
||||
|
84
CHANGELOG.md
84
CHANGELOG.md
@@ -1,5 +1,87 @@
|
||||
# unreleased
|
||||
|
||||
## Features
|
||||
|
||||
- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall)
|
||||
|
||||
## Other
|
||||
|
||||
- Load cached assets as fast as integrated assets, see #1753 (@Enselic)
|
||||
- Greatly reduce startup time in loop-through mode, e.g. when redirecting output. Instead of *50 ms* - *100 ms*, startup takes *5 ms* - *10 ms*. See #1747 (@Enselic)
|
||||
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Groff, see #1685 (@scop)
|
||||
- HTTP Requests and Responses, see #1748 (@keith-hall)
|
||||
- LLVM, see #1777 (@ioncodes)
|
||||
- Highlight for `vimrc` and `gvimrc` files, see #1763 (@SuperSandro2000)
|
||||
- Syslog highlighting improvements, see #1793 (@scop)
|
||||
- Added support for `slim` syntax, see #1693 (@mfinelli)
|
||||
|
||||
## New themes
|
||||
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
- Deprecate `HighlightingAssets::syntaxes()` and `HighlightingAssets::syntax_for_file_name()`. Use `HighlightingAssets::get_syntaxes()` and `HighlightingAssets::get_syntax_for_file_name()` instead. They return a `Result` which is needed for upcoming lazy-loading work to improve startup performance. They also return what `SyntaxSet` the returned `SyntaxReference` belongs to. See #1747, #1755 and #1776 (@Enselic)
|
||||
|
||||
|
||||
|
||||
# v0.18.2
|
||||
|
||||
## Features
|
||||
|
||||
- Ignore known backup/template filename suffixes when selecting the syntax, see #1687 (@scop)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- 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).
|
||||
|
||||
## Other
|
||||
|
||||
- Add bash completion, see #1678 (@scop)
|
||||
- Fix Clippy lints, see #1661 (@mohamed-abdelnour)
|
||||
- Add syntax highlighting test files, see #1213 and #1668 (@mohamed-abdelnour)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Upgraded Julia syntax to fix a highlighting bug, see #1692
|
||||
- Added support for `dash` syntax, see #1654 (@mohamed-abdelnour)
|
||||
- Added support for `XAML` syntax, see #1590 and #1655 (@mohamed-abdelnour)
|
||||
- Apply `DotENV` syntax also for `.env.default` and `.env.defaults` files, see #1669
|
||||
|
||||
|
||||
# v0.18.1
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Mouse support and screen clearing broken for `less` versions with minor version number (581.2), see #1629 and #1639 (@aswild)
|
||||
|
||||
## Other
|
||||
|
||||
- `Input::ordinary_file` and `Input::with_name` now accept `Path` rather than `OsStr` see #1571 (@matklad)
|
||||
- The `LESS` environment variable is now included in `bat --diagnostic`, see #1589 (@Enselic)
|
||||
- Increased min. required Rust version to 1.45
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
|
||||
- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)
|
||||
- Added SystemVerilog file syntax, see #1580 (@SeanMcLoughlin)
|
||||
- Added Solidity and Vyper syntax, see #1602 (@Ersikan)
|
||||
|
||||
## New themes
|
||||
|
||||
- Dark+ VS Code theme, see #1588 and #1598 (@PatriotRossii)
|
||||
|
||||
|
||||
|
||||
# v0.18.0
|
||||
|
||||
## Features
|
||||
|
||||
@@ -489,7 +571,7 @@ You can see the API documentation here: https://docs.rs/bat/
|
||||
|
||||
- Added `BAT_CONFIG_PATH` environment variable to set a non-default path for `bat`s configuration file, see #375 (@deg4uss3r)
|
||||
|
||||
- Allow for multiple occurences of `--style` to allow for the configuration
|
||||
- Allow for multiple occurrences of `--style` to allow for the configuration
|
||||
of styles from the config file, see #367 (@sindreij)
|
||||
|
||||
- Allow for multiple `--line-range` arguments, see #23
|
||||
|
371
Cargo.lock
generated
371
Cargo.lock
generated
@@ -1,25 +1,27 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "0.2.3"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.15"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_colours"
|
||||
version = "1.0.2"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52cb663b84aea8670b4a40368360e29485c11b03d14ff6283261aeccd69d5ce1"
|
||||
checksum = "60e2fb6138a49ad9f1cb3c6d8f8ccbdd5e62b4dab317c1b435a47ecd7da1d28f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
@@ -44,9 +46,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
version = "1.0.3"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2475b58cd94eb4f70159f4fd8844ba3b807532fe3131b3373fae060bbe30396"
|
||||
checksum = "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"doc-comment",
|
||||
@@ -81,7 +83,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bat"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
dependencies = [
|
||||
"ansi_colours",
|
||||
"ansi_term 0.12.1",
|
||||
@@ -97,7 +99,9 @@ dependencies = [
|
||||
"error-chain",
|
||||
"git2",
|
||||
"globset",
|
||||
"grep-cli",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"nix",
|
||||
"path_abs",
|
||||
"predicates",
|
||||
@@ -115,11 +119,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.1"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@@ -146,9 +149,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d"
|
||||
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
@@ -157,25 +160,26 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bugreport"
|
||||
version = "0.3.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "116762017f173ea5d8103e75533f6bdb62cb6f2257c9c95672beb085a70daed8"
|
||||
checksum = "0014b4b2b4f63bfe69c3838470121290cc437fdc79785d408a761a21e8b2404c"
|
||||
dependencies = [
|
||||
"snailquote",
|
||||
"git-version",
|
||||
"shell-escape",
|
||||
"sys-info",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.2"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
|
||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.66"
|
||||
version = "1.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
||||
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
]
|
||||
@@ -226,9 +230,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cc80946b3480f421c2f17ed1cb841753a371c7c5104f51d507e13f532c856aa"
|
||||
checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
@@ -258,10 +262,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "difference"
|
||||
version = "2.0.0"
|
||||
name = "difflib"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
|
||||
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
@@ -292,9 +296,15 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
|
||||
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
@@ -377,9 +387,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fancy-regex"
|
||||
version = "0.3.5"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae91abf6555234338687bb47913978d275539235fcb77ba9863b779090b42b14"
|
||||
checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"regex",
|
||||
@@ -399,9 +409,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "float-cmp"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4"
|
||||
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
@@ -414,9 +424,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00"
|
||||
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
@@ -434,10 +444,32 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.13.15"
|
||||
name = "git-version"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44f267c9da8a4de3c615b59e23606c75f164f84896e97f4dd6c15a4294de4359"
|
||||
checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2"
|
||||
dependencies = [
|
||||
"git-version-macro",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git-version-macro"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.13.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9831e983241f8c5591ed53f17d874833e2fa82cac2625f3888c50cbfe136cba"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
@@ -454,9 +486,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.6"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a"
|
||||
checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@@ -465,6 +497,23 @@ dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "grep-cli"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dd110c34bb4460d0de5062413b773e385cbf8a85a63fc535590110a09e79e8a"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bstr",
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"regex",
|
||||
"same-file",
|
||||
"termcolor",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.9.1"
|
||||
@@ -482,9 +531,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094"
|
||||
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"unicode-bidi",
|
||||
@@ -493,9 +542,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.6.1"
|
||||
version = "1.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
|
||||
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
@@ -510,6 +559,15 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.7"
|
||||
@@ -518,9 +576,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.21"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
|
||||
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -539,15 +597,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
version = "0.2.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
|
||||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.12.18+1.1.0"
|
||||
version = "0.12.21+1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885"
|
||||
checksum = "86271bacd72b2b9e854c3dcfb82efd538f15f870e4c11af66900effb462f6825"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -557,9 +615,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
|
||||
checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -584,9 +642,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.2"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
|
||||
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
@@ -608,15 +666,24 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.4"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.4.3"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
|
||||
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"autocfg",
|
||||
@@ -624,14 +691,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.19.1"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2"
|
||||
checksum = "cf1e25ee6b412c2a1e3fcb6a4499a5c1bfe7f43e014bdce9a6b6666e5aa2d187"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -659,12 +727,6 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
|
||||
|
||||
[[package]]
|
||||
name = "onig"
|
||||
version = "6.1.1"
|
||||
@@ -714,9 +776,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "path_abs"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb6b8e6dede0bf94e9300e669f335ba92d5fc9fc8be7f4b1ca8a05206489388c"
|
||||
checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3"
|
||||
dependencies = [
|
||||
"std_prelude",
|
||||
]
|
||||
@@ -727,15 +789,6 @@ version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
|
||||
dependencies = [
|
||||
"ucd-trie",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
@@ -764,12 +817,13 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "1.0.7"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa"
|
||||
checksum = "bc3d91237f5de3bcd9d927e24d03b495adb6135097b001cea7403e2d573d00a9"
|
||||
dependencies = [
|
||||
"difference",
|
||||
"difflib",
|
||||
"float-cmp",
|
||||
"itertools",
|
||||
"normalize-line-endings",
|
||||
"predicates-core",
|
||||
"regex",
|
||||
@@ -792,10 +846,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
@@ -851,9 +911,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.5"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
|
||||
checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
@@ -870,14 +930,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.4.3"
|
||||
version = "1.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
"thread_local",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -891,9 +950,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.22"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
@@ -933,36 +992,24 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.11.0"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
|
||||
dependencies = [
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
||||
dependencies = [
|
||||
"pest",
|
||||
]
|
||||
checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.123"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"
|
||||
checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.123"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31"
|
||||
checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -971,9 +1018,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.62"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -1014,6 +1061,12 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shell-escape"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
|
||||
|
||||
[[package]]
|
||||
name = "shell-words"
|
||||
version = "1.0.0"
|
||||
@@ -1026,16 +1079,6 @@ version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "snailquote"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f34b729d802f52194598858ac852c3fb3b33f6e026cd03195072ccb7bf3fc810"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"unicode_categories",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "std_prelude"
|
||||
version = "0.2.12"
|
||||
@@ -1050,9 +1093,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.60"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1061,9 +1104,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syntect"
|
||||
version = "4.5.0"
|
||||
version = "4.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bfac2b23b4d049dc9a89353b4e06bbc85a8f42020cccbe5409a115cf19031e5"
|
||||
checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"bitflags",
|
||||
@@ -1084,9 +1127,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sys-info"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5cfbd84f86389198ade41b439f72a5b1b3a8ba728e61cd589e1720d0df44c39"
|
||||
checksum = "33fcecee49339531cf6bd84ecf3ed94f9c8ef4a7e700f2a1cac9cc1ca485383a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -1116,6 +1159,15 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.1.16"
|
||||
@@ -1136,40 +1188,11 @@ dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023"
|
||||
checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
@@ -1186,17 +1209,11 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
|
||||
dependencies = [
|
||||
"matches",
|
||||
]
|
||||
@@ -1218,21 +1235,15 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
|
||||
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
@@ -1242,9 +1253,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
||||
checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
@@ -1254,9 +1265,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
@@ -1269,9 +1280,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.1"
|
||||
version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi",
|
||||
|
33
Cargo.toml
33
Cargo.toml
@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.18.0"
|
||||
version = "0.18.2"
|
||||
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
||||
build = "build.rs"
|
||||
edition = '2018'
|
||||
@@ -16,17 +16,26 @@ default = ["application"]
|
||||
# Feature required for bat the application. Should be disabled when depending on
|
||||
# bat as a library.
|
||||
application = [
|
||||
"bugreport",
|
||||
"build-assets",
|
||||
"git",
|
||||
"minimal-application",
|
||||
]
|
||||
# Mainly for developers that want to iterate quickly
|
||||
# Be aware that the included features might change in the future
|
||||
minimal-application = [
|
||||
"atty",
|
||||
"clap",
|
||||
"dirs-next",
|
||||
"git",
|
||||
"lazy_static",
|
||||
"paging",
|
||||
"wild",
|
||||
"regex-onig",
|
||||
"wild",
|
||||
]
|
||||
git = ["git2"] # Support indicating git modifications
|
||||
paging = ["shell-words"] # Support applying a pager on the output
|
||||
# Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
|
||||
build-assets = ["syntect/yaml-load", "syntect/dump-create"]
|
||||
|
||||
# You need to use one of these if you depend on bat as a library:
|
||||
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||
@@ -36,8 +45,9 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
atty = { version = "0.2.14", optional = true }
|
||||
ansi_term = "^0.12.1"
|
||||
ansi_colours = "^1.0"
|
||||
console = "0.14.0"
|
||||
console = "0.14.1"
|
||||
lazy_static = { version = "1.4", optional = true }
|
||||
lazycell = "1.0"
|
||||
wild = { version = "2.0", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
encoding = "0.2"
|
||||
@@ -46,11 +56,12 @@ unicode-width = "0.1.8"
|
||||
globset = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.8"
|
||||
semver = "0.11"
|
||||
semver = "1.0"
|
||||
path_abs = { version = "0.5", default-features = false }
|
||||
clircle = "0.3"
|
||||
bugreport = "0.3"
|
||||
bugreport = { version = "0.4", optional = true }
|
||||
dirs-next = { version = "2.0.0", optional = true }
|
||||
grep-cli = "0.1.6"
|
||||
|
||||
[dependencies.git2]
|
||||
version = "0.13"
|
||||
@@ -58,9 +69,9 @@ optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.syntect]
|
||||
version = "4.5.0"
|
||||
version = "4.6.0"
|
||||
default-features = false
|
||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||
features = ["parsing", "dump-load"]
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2.33"
|
||||
@@ -73,14 +84,14 @@ version = "0.12"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "1.0.2"
|
||||
assert_cmd = "1.0.8"
|
||||
serial_test = "0.5.1"
|
||||
predicates = "1.0.7"
|
||||
predicates = "2.0.1"
|
||||
wait-timeout = "0.2.0"
|
||||
tempfile = "3.2.0"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
nix = "0.19.1"
|
||||
nix = "0.22.0"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "2.33", optional = true }
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 bat-developers (https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
25
README.md
25
README.md
@@ -197,9 +197,9 @@ The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.
|
||||
*... and other Debian-based Linux distributions.*
|
||||
|
||||
`bat` is making its way through the [Ubuntu](https://packages.ubuntu.com/eoan/bat) and
|
||||
[Debian](https://packages.debian.org/sid/bat) package release process, and is available
|
||||
for Ubuntu as of Eoan 19.10. On Debian `bat` is currently only available on the unstable
|
||||
"Sid" branch.
|
||||
[Debian](https://packages.debian.org/testing/bat) package release process, and is available
|
||||
for Ubuntu as of Eoan 19.10. On Debian `bat` is currently available on the unstable
|
||||
"Sid" branch and on the testing branch.
|
||||
|
||||
If your Ubuntu/Debian installation is new enough you can simply run:
|
||||
|
||||
@@ -222,7 +222,7 @@ the most recent release of `bat`, download the latest `.deb` package from the
|
||||
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.2_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -363,7 +363,7 @@ binaries are also available: look for archives with `musl` in the file name.
|
||||
|
||||
### From source
|
||||
|
||||
If you want to build `bat` from source, you need Rust 1.42 or
|
||||
If you want to build `bat` from source, you need Rust 1.45 or
|
||||
higher. You can then use `cargo` to build everything:
|
||||
|
||||
```bash
|
||||
@@ -409,10 +409,11 @@ even when truecolor support is available:
|
||||
It replaces certain bright colors with 8-bit colors from 16 to 21. **Do not** use this simply
|
||||
because you have a 256-color terminal but are not using base16-shell.
|
||||
|
||||
Although these themes are more restricted, they have two advantages over truecolor themes:
|
||||
Although these themes are more restricted, they have three advantages over truecolor themes. They:
|
||||
|
||||
- They harmonize better with other terminal software using 3-bit or 4-bit colors.
|
||||
- When you change your terminal theme, `bat` output already on the screen will update to match.
|
||||
- Enjoy maximum compatibility. Some terminal utilities do not support more than 3-bit colors.
|
||||
- Adapt to terminal theme changes. Even for already printed output.
|
||||
- Visually harmonize better with other terminal software.
|
||||
|
||||
### Output style
|
||||
|
||||
@@ -516,6 +517,8 @@ set, `less` is used by default. If you want to use a different pager, you can ei
|
||||
`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
|
||||
`PAGER`.
|
||||
|
||||
**Note**: If `PAGER` is `more` or `most`, `bat` will silently use `less` instead to ensure support for colors.
|
||||
|
||||
If you want to pass command-line arguments to the pager, you can also set them via the
|
||||
`PAGER`/`BAT_PAGER` variables:
|
||||
|
||||
@@ -714,6 +717,10 @@ Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||
- [keith-hall](https://github.com/keith-hall)
|
||||
- [Enselic](https://github.com/Enselic)
|
||||
|
||||
## Security vulnerabilities
|
||||
|
||||
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
||||
|
||||
## Project goals and alternatives
|
||||
|
||||
`bat` tries to achieve the following goals:
|
||||
@@ -727,7 +734,7 @@ There are a lot of alternatives, if you are looking for similar programs. See
|
||||
[this document](doc/alternatives.md) for a comparison.
|
||||
|
||||
## License
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||
|
||||
|
88
assets/completions/bat.bash.in
vendored
Normal file
88
assets/completions/bat.bash.in
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# shellcheck disable=SC2207
|
||||
|
||||
# Requires https://github.com/scop/bash-completion
|
||||
|
||||
_bat() {
|
||||
local cur prev words cword split
|
||||
_init_completion -s || return 0
|
||||
|
||||
if [[ ${words[1]-} == cache ]]; then
|
||||
case $prev in
|
||||
--source | --target)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=($(compgen -W "
|
||||
--build --clear --source --target --blank --help
|
||||
" -- "$cur"))
|
||||
return 0
|
||||
fi
|
||||
|
||||
case $prev in
|
||||
-l | --language)
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "$(
|
||||
"$1" --list-languages | while IFS=: read -r lang _; do
|
||||
printf "%s\n" "$lang"
|
||||
done
|
||||
)" -- "$cur"))
|
||||
compopt -o filenames # for escaping
|
||||
return 0
|
||||
;;
|
||||
-H | --highlight-line | --diff-context | --tabs | --terminal-width | \
|
||||
-m | --map-syntax | --style | --line-range | -h | --help | -V | \
|
||||
--version | --diagnostic | --config-file | --config-dir | \
|
||||
--cache-dir | --generate-config-file)
|
||||
# argument required but no completion available, or option
|
||||
# causes an exit
|
||||
return 0
|
||||
;;
|
||||
--file-name)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
--wrap)
|
||||
COMPREPLY=($(compgen -W "auto never character" -- "$cur"))
|
||||
return 0
|
||||
;;
|
||||
--color | --decorations | --paging)
|
||||
COMPREPLY=($(compgen -W "auto never always" -- "$cur"))
|
||||
return 0
|
||||
;;
|
||||
--italic-text)
|
||||
COMPREPLY=($(compgen -W "always never" -- "$cur"))
|
||||
return 0
|
||||
;;
|
||||
--pager)
|
||||
COMPREPLY=($(compgen -c -- "$cur"))
|
||||
return 0
|
||||
;;
|
||||
--theme)
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "$("$1" --list-themes)" -- "$cur"))
|
||||
compopt -o filenames # for escaping
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return 0
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=($(compgen -W "
|
||||
--show-all --plain --language --highlight-line
|
||||
--file-name --diff --diff-context --tabs --wrap
|
||||
--terminal-width --number --color --italic-text
|
||||
--decorations --paging --pager --map-syntax --theme
|
||||
--list-themes --style --line-range --list-languages
|
||||
--help --version --force-colorization --unbuffered
|
||||
--diagnostic --config-file --config-dir --cache-dir
|
||||
--generate-config-file
|
||||
" -- "$cur"))
|
||||
return 0
|
||||
fi
|
||||
|
||||
_filedir
|
||||
((cword == 1)) && COMPREPLY+=($(compgen -W cache -- "$cur"))
|
||||
|
||||
} && complete -F _bat {{PROJECT_EXECUTABLE}}
|
2
assets/completions/bat.fish.in
vendored
2
assets/completions/bat.fish.in
vendored
@@ -34,7 +34,7 @@ complete -c {{PROJECT_EXECUTABLE}} -s H -l highlight-line -x -d "<N> Highlight t
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -l italic-text -xka "always never" -d "Specify when to use ANSI sequences for italic text (default: never)" -n "not __fish_seen_subcommand_from cache"
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -s l -l language -d "Set the language for syntax highlighting" -n "not __fish_seen_subcommand_from cache" -xa "(__{{PROJECT_EXECUTABLE}}_autocomplete_languages)"
|
||||
complete -c {{PROJECT_EXECUTABLE}} -s l -l language -d "Set the language for syntax highlighting" -n "not __fish_seen_subcommand_from cache" -xa "(__{{PROJECT_EXECUTABLE}}_autocomplete_languages)"
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -s r -l line-range -x -d "<N:M> Only print the specified range of lines for each file" -n "not __fish_seen_subcommand_from cache"
|
||||
|
||||
|
6
assets/completions/bat.zsh.in
vendored
6
assets/completions/bat.zsh.in
vendored
@@ -44,6 +44,12 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
||||
'(--style)'--style='[Comma-separated list of style elements to display]:<components>:->style'
|
||||
'(-r --line-range)'{-r+,--line-range=}'[Only print the lines from N to M]:<N\:M>...'
|
||||
'(: --list-themes --list-languages -L)'{-L,--list-languages}'[Display all supported languages]'
|
||||
'(: --no-config)'--no-config'[Do not use the configuration file]'
|
||||
'(: --no-custom-assets)'--no-custom-assets'[Do not load custom assets]'
|
||||
'(: --config-dir)'--config-dir'[Show bat'"'"'s configuration directory]'
|
||||
'(: --config-file)'--config-file'[Show path to the configuration file]'
|
||||
'(: --generate-config-file)'--generate-config-file'[Generates a default configuration file]'
|
||||
'(: --cache-dir)'--cache-dir'[Show bat'"'"'s cache directory]'
|
||||
'(: -)'{-h,--help}'[Print this help message]'
|
||||
'(: -)'{-V,--version}'[Show version information]'
|
||||
'*: :_files'
|
||||
|
2
assets/create.sh
vendored
2
assets/create.sh
vendored
@@ -5,7 +5,7 @@ ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
REPO_DIR="$ASSET_DIR/.."
|
||||
|
||||
# Ensure submodules are initialized.
|
||||
function update_submodules() {
|
||||
update_submodules() {
|
||||
local submodule
|
||||
local submodule_prompt=unspecified
|
||||
local submodule_path
|
||||
|
8
assets/manual/bat.1.in
vendored
8
assets/manual/bat.1.in
vendored
@@ -142,7 +142,7 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
|
||||
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
|
||||
To set a default style, add the '\-\-style=".."' option to the configuration file or
|
||||
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
||||
values: *auto*, full, plain, changes, header, grid, rule, numbers, snip.
|
||||
values: *full*, auto, plain, changes, header, grid, rule, numbers, snip.
|
||||
.HP
|
||||
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
||||
.IP
|
||||
@@ -189,6 +189,10 @@ is dependent on your operating system. To get the default path for your system,
|
||||
|
||||
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
|
||||
location of the configuration file.
|
||||
|
||||
To generate a default configuration file, call:
|
||||
|
||||
\fB{{PROJECT_EXECUTABLE}} --generate-config-file\fR
|
||||
.SH "ADDING CUSTOM LANGUAGES"
|
||||
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB.sublime-syntax\fR language files, and can be
|
||||
customized to add additional languages to your local installation. To do this, add the \fB.sublime-syntax\fR language
|
||||
@@ -214,7 +218,7 @@ git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||
|
||||
Once the cache is built, the new language will be visible in `\fB{{PROJECT_EXECUTABLE}} --list-languages\fR`.
|
||||
.br
|
||||
If you ever want to remove the custom languages, you can clear the cache with `\fB{{PROJECT_EXECUTABLE}} cache --clear\fR`.
|
||||
If you ever want to remove the custom languages, you can clear the cache with `\fB{{PROJECT_EXECUTABLE}} cache --clear\fR`.
|
||||
|
||||
.SH "ADDING CUSTOM THEMES"
|
||||
Similarly to custom languages, {{PROJECT_EXECUTABLE}} supports Sublime Text \fB.tmTheme\fR themes.
|
||||
|
16
assets/patches/Groff.sublime-syntax.patch
vendored
Normal file
16
assets/patches/Groff.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
diff --git syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax
|
||||
index 57834af..6648664 100644
|
||||
--- syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax
|
||||
+++ syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax
|
||||
@@ -4,9 +4,9 @@
|
||||
# - man-pages(7)
|
||||
# - groff(7)
|
||||
---
|
||||
-name: Man Page (groff/troff)
|
||||
+name: Groff/troff
|
||||
scope: text.groff
|
||||
-file_extensions: [man, groff, troff, '1', '2', '3', '4', '5', '6', '7']
|
||||
+file_extensions: [groff, troff, '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||
|
||||
contexts:
|
||||
main:
|
11
assets/patches/Markdown.sublime-syntax.patch
vendored
11
assets/patches/Markdown.sublime-syntax.patch
vendored
@@ -1,5 +1,5 @@
|
||||
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||
index 19dc685d..6afd87ae 100644
|
||||
index 19dc685d..44440c7f 100644
|
||||
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||
@@ -24,7 +24,6 @@ variables:
|
||||
@@ -166,3 +166,12 @@ index 19dc685d..6afd87ae 100644
|
||||
- match: ^\s*$\n?
|
||||
scope: invalid.illegal.non-terminated.bold-italic.markdown
|
||||
pop: true
|
||||
@@ -1152,7 +1110,7 @@ contexts:
|
||||
- match: |-
|
||||
(?x)
|
||||
{{fenced_code_block_start}}
|
||||
- ((?i:rust))
|
||||
+ ((?i:rust|rs))
|
||||
{{fenced_code_block_trailing_infostring_characters}}
|
||||
captures:
|
||||
0: meta.code-fence.definition.begin.rust.markdown-gfm
|
||||
|
20
assets/patches/Monokai-Extended.tmTheme.patch
vendored
20
assets/patches/Monokai-Extended.tmTheme.patch
vendored
@@ -7,7 +7,7 @@ index 9c2aa3e..180cbbf 100644
|
||||
<string>JSON String</string>
|
||||
<key>scope</key>
|
||||
- <string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||
+ <string>meta.mapping.key.json string.quoted.double.json</string>
|
||||
+ <string>meta.mapping.key.json string.quoted.double.json, punctuation.separator.sequence.csv</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -16,3 +16,21 @@ index 9c2aa3e..180cbbf 100644
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
@@ -1027,7 +1027,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid</string>
|
||||
+ <string>invalid, markup.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
@@ -1042,7 +1042,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid.deprecated</string>
|
||||
+ <string>invalid.deprecated, markup.warning</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
|
15
assets/patches/Python.sublime-syntax.patch
vendored
Normal file
15
assets/patches/Python.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git syntaxes/01_Packages/Python/Python.sublime-syntax syntaxes/01_Packages/Python/Python.sublime-syntax
|
||||
index 2acd86d8..86257f7b 100644
|
||||
--- syntaxes/01_Packages/Python/Python.sublime-syntax
|
||||
+++ syntaxes/01_Packages/Python/Python.sublime-syntax
|
||||
@@ -988,10 +988,6 @@ contexts:
|
||||
- match: \}
|
||||
scope: punctuation.section.mapping-or-set.end.python
|
||||
set: after-expression
|
||||
- - match: (?={{simple_expression}}:|\s*\*\*)
|
||||
- set: inside-dictionary
|
||||
- - match: (?={{simple_expression}}[,}]|\s*\*)
|
||||
- set: inside-set
|
||||
- match: ','
|
||||
scope: punctuation.separator.set.python
|
||||
set: inside-set
|
@@ -1,8 +1,8 @@
|
||||
diff --git syntaxes/01_Packages/ShellScript/Bash.sublime-syntax syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||
index e973e319..a703cef8 100644
|
||||
index e973e319..07c170a7 100644
|
||||
--- syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||
+++ syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||
@@ -30,8 +30,8 @@ file_extensions:
|
||||
@@ -30,12 +30,12 @@ file_extensions:
|
||||
- .zshenv
|
||||
- .zshrc
|
||||
- PKGBUILD # https://jlk.fjfi.cvut.cz/arch/manpages/man/PKGBUILD.5
|
||||
@@ -13,3 +13,8 @@ index e973e319..a703cef8 100644
|
||||
|
||||
first_line_match: |
|
||||
(?x)
|
||||
- ^\#! .* \b(bash|zsh|sh|tcsh|ash)\b
|
||||
+ ^\#! .* \b(bash|zsh|sh|tcsh|ash|dash)\b
|
||||
| ^\# \s* -\*- [^*]* mode: \s* shell-script [^*]* -\*-
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
12
assets/patches/XML.sublime-syntax.patch
vendored
Normal file
12
assets/patches/XML.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
diff --git syntaxes/01_Packages/XML/XML.sublime-syntax syntaxes/01_Packages/XML/XML.sublime-syntax
|
||||
index ad7d9c87..af4a00f0 100644
|
||||
--- syntaxes/01_Packages/XML/XML.sublime-syntax
|
||||
+++ syntaxes/01_Packages/XML/XML.sublime-syntax
|
||||
@@ -12,6 +12,7 @@ file_extensions:
|
||||
- rss
|
||||
- opml
|
||||
- svg
|
||||
+ - xaml
|
||||
first_line_match: |-
|
||||
(?x:
|
||||
^(?:
|
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/CMake
vendored
2
assets/syntaxes/02_Extra/CMake
vendored
Submodule assets/syntaxes/02_Extra/CMake updated: 7d6231c934...ab6ef4ef9f
1
assets/syntaxes/02_Extra/CSV
vendored
1
assets/syntaxes/02_Extra/CSV
vendored
Submodule assets/syntaxes/02_Extra/CSV deleted from 4786d037a7
110
assets/syntaxes/02_Extra/CSV.sublime-syntax
vendored
110
assets/syntaxes/02_Extra/CSV.sublime-syntax
vendored
@@ -1,46 +1,78 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Advanced CSV
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Comma Separated Values
|
||||
file_extensions:
|
||||
- csv
|
||||
- tsv
|
||||
scope: text.advanced_csv
|
||||
scope: text.csv
|
||||
variables:
|
||||
field_separator: (?:[,;\t])
|
||||
record_separator: (?:$\n?)
|
||||
contexts:
|
||||
prototype:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
fields:
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
main:
|
||||
- match: (\")
|
||||
captures:
|
||||
1: string.quoted.double.advanced_csv
|
||||
push:
|
||||
- meta_scope: meta.quoted.advanced_csv
|
||||
- match: (\")
|
||||
captures:
|
||||
1: string.quoted.double.advanced_csv
|
||||
pop: true
|
||||
- include: main
|
||||
- match: '(\[([+-]?\d*)(\:)?([+-]?\d*)(\,)?([+-]?\d*)(\:)?([+-]?\d*)\])?\s*([<>v^])?\s*(=)'
|
||||
captures:
|
||||
1: keyword.operator.advanced_csv
|
||||
2: constant.numeric.formula.advanced_csv
|
||||
4: constant.numeric.formula.advanced_csv
|
||||
6: constant.numeric.formula.advanced_csv
|
||||
8: constant.numeric.formula.advanced_csv
|
||||
9: keyword.operator.advanced_csv
|
||||
10: keyword.operator.advanced_csv
|
||||
push:
|
||||
- meta_scope: meta.range.advanced_csv
|
||||
- match: (?=(\")|$)
|
||||
pop: true
|
||||
- include: scope:source.python
|
||||
- match: '(?<=^|,|\s|\")([0-9.eE+-]+)(?=$|,|\s|\")'
|
||||
scope: meta.number.advanced_csv
|
||||
captures:
|
||||
1: constant.numeric.advanced_csv
|
||||
- match: '(?<=^|,|\s|\")([^, \t\"]+)(?=$|,|\s|\")'
|
||||
scope: meta.nonnumber.advanced_csv
|
||||
captures:
|
||||
1: storage.type.advanced_csv
|
||||
- match: (\,)
|
||||
scope: meta.delimiter.advanced_csv
|
||||
captures:
|
||||
1: keyword.operator.advanced_csv
|
||||
- meta_include_prototype: false
|
||||
- match: '^'
|
||||
set: fields
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: double_quoted_string
|
||||
|
||||
- match: (?={{field_separator}}|{{record_separator}})
|
||||
pop: true
|
||||
|
||||
double_quoted_string:
|
||||
- meta_include_prototype: false
|
||||
- meta_scope: string.quoted.double.csv
|
||||
- match: '""'
|
||||
scope: constant.character.escape.csv
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.end.csv
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv support.type
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
|
||||
|
2
assets/syntaxes/02_Extra/Crystal
vendored
2
assets/syntaxes/02_Extra/Crystal
vendored
Submodule assets/syntaxes/02_Extra/Crystal updated: 5e032ff5f5...eb63666f35
2
assets/syntaxes/02_Extra/DotENV
vendored
2
assets/syntaxes/02_Extra/DotENV
vendored
Submodule assets/syntaxes/02_Extra/DotENV updated: a1c917633d...58201ba2ab
@@ -4,7 +4,6 @@
|
||||
name: DotENV
|
||||
file_extensions:
|
||||
- .env
|
||||
- .envrc
|
||||
- .env.dist
|
||||
- .env.local
|
||||
- .env.sample
|
||||
@@ -19,8 +18,11 @@ file_extensions:
|
||||
- .env.production
|
||||
- .env.production.local
|
||||
- .env.dusk.local
|
||||
- .flaskenv
|
||||
- .env.staging
|
||||
- .env.default
|
||||
- .env.defaults
|
||||
- .envrc
|
||||
- .flaskenv
|
||||
scope: source.env
|
||||
contexts:
|
||||
main:
|
||||
|
2
assets/syntaxes/02_Extra/FSharp
vendored
2
assets/syntaxes/02_Extra/FSharp
vendored
Submodule assets/syntaxes/02_Extra/FSharp updated: c18616d6bd...9e4645c608
@@ -5,6 +5,7 @@ name: fstab
|
||||
file_extensions:
|
||||
- fstab
|
||||
- crypttab
|
||||
- mtab
|
||||
scope: source.fstab
|
||||
|
||||
contexts:
|
||||
|
1
assets/syntaxes/02_Extra/Groff
vendored
Submodule
1
assets/syntaxes/02_Extra/Groff
vendored
Submodule
Submodule assets/syntaxes/02_Extra/Groff added at 651091c7e2
2
assets/syntaxes/02_Extra/Julia
vendored
2
assets/syntaxes/02_Extra/Julia
vendored
Submodule assets/syntaxes/02_Extra/Julia updated: e2b1cb549d...48639e1dbf
2
assets/syntaxes/02_Extra/LESS
vendored
2
assets/syntaxes/02_Extra/LESS
vendored
Submodule assets/syntaxes/02_Extra/LESS updated: 44632e19af...a2eae0453e
1
assets/syntaxes/02_Extra/LLVM
vendored
Submodule
1
assets/syntaxes/02_Extra/LLVM
vendored
Submodule
Submodule assets/syntaxes/02_Extra/LLVM added at 274126faa9
2
assets/syntaxes/02_Extra/Lean
vendored
2
assets/syntaxes/02_Extra/Lean
vendored
Submodule assets/syntaxes/02_Extra/Lean updated: 49d185361a...29a03a8aba
2
assets/syntaxes/02_Extra/SCSS_Sass
vendored
2
assets/syntaxes/02_Extra/SCSS_Sass
vendored
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: 4868322030...63819a1ab6
1
assets/syntaxes/02_Extra/Slim
vendored
Submodule
1
assets/syntaxes/02_Extra/Slim
vendored
Submodule
Submodule assets/syntaxes/02_Extra/Slim added at 3b1441f89f
306
assets/syntaxes/02_Extra/Slim.sublime-syntax
vendored
Normal file
306
assets/syntaxes/02_Extra/Slim.sublime-syntax
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/syntax.html
|
||||
name: Ruby Slim
|
||||
file_extensions:
|
||||
- slim
|
||||
- skim
|
||||
scope: text.slim
|
||||
contexts:
|
||||
main:
|
||||
- match: ^(\s*)(ruby):$
|
||||
captures:
|
||||
2: constant.language.name.ruby.filter.slim
|
||||
push:
|
||||
- meta_scope: text.ruby.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.ruby
|
||||
- match: ^(\s*)(javascript):$
|
||||
captures:
|
||||
2: constant.language.name.javascript.filter.slim
|
||||
push:
|
||||
- meta_scope: source.js.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.js
|
||||
- match: ^(---)\s*\n
|
||||
captures:
|
||||
1: storage.frontmatter.slim
|
||||
push:
|
||||
- meta_scope: source.yaml.meta.slim
|
||||
- match: ^(---)\s*\n
|
||||
captures:
|
||||
1: storage.frontmatter.slim
|
||||
pop: true
|
||||
- include: scope:source.yaml
|
||||
- match: ^(\s*)(coffee):$
|
||||
captures:
|
||||
2: constant.language.name.coffeescript.filter.slim
|
||||
push:
|
||||
- meta_scope: text.coffeescript.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.coffee
|
||||
- match: ^(\s*)(markdown):$
|
||||
captures:
|
||||
2: constant.language.name.markdown.filter.slim
|
||||
push:
|
||||
- meta_scope: text.markdown.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:text.html.markdown
|
||||
- match: ^(\s*)(css):$
|
||||
captures:
|
||||
2: constant.language.name.css.filter.slim
|
||||
push:
|
||||
- meta_scope: text.css.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.css
|
||||
- match: ^(\s*)(sass):$
|
||||
captures:
|
||||
2: constant.language.name.sass.filter.slim
|
||||
push:
|
||||
- meta_scope: text.sass.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.sass
|
||||
- match: ^(\s*)(scss):$
|
||||
captures:
|
||||
2: constant.language.name.scss.filter.slim
|
||||
push:
|
||||
- meta_scope: text.scss.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.scss
|
||||
- match: ^(\s*)(less):$
|
||||
captures:
|
||||
2: constant.language.name.less.filter.slim
|
||||
push:
|
||||
- meta_scope: text.less.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.less
|
||||
- match: ^(\s*)(erb):$
|
||||
captures:
|
||||
2: constant.language.name.erb.filter.slim
|
||||
push:
|
||||
- meta_scope: text.erb.filter.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:source.erb
|
||||
- match: ^(! )($|\s.*)
|
||||
scope: meta.prolog.slim
|
||||
captures:
|
||||
1: punctuation.definition.prolog.slim
|
||||
- match: ^(\s*)(/)\s*.*$
|
||||
captures:
|
||||
2: comment.line.slash.slim
|
||||
push:
|
||||
- meta_scope: comment.block.slim
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- match: ^\s*(?=-)
|
||||
push:
|
||||
- match: $
|
||||
pop: true
|
||||
- include: rubyline
|
||||
- match: (?==+|~)
|
||||
push:
|
||||
- match: $
|
||||
pop: true
|
||||
- include: rubyline
|
||||
- include: tag-attribute
|
||||
- include: embedded-ruby
|
||||
- match: ^(\s*)(\||')\s*
|
||||
comment: Verbatim text (can include HTML tags and copied lines)
|
||||
push:
|
||||
- match: ^(?!(\1\s)|\s*$)
|
||||
pop: true
|
||||
- include: scope:text.html.basic
|
||||
- include: embedded-ruby
|
||||
- match: '^\s*(\.|#|[-a-zA-Z0-9]+)([\w-]+)?'
|
||||
comment: '1 - dot OR hash OR any combination of word, number; 2 - OPTIONAL any combination of word, number, dash or underscore (following a . or'
|
||||
captures:
|
||||
1: entity.name.tag.slim
|
||||
2: entity.other.attribute-name.event.slim
|
||||
push:
|
||||
- meta_scope: meta.tag
|
||||
- match: '$|(?!\.|#|:|-|~|/|\}|\]|\*|\s?[\*\{])'
|
||||
captures:
|
||||
1: entity.name.tag.slim
|
||||
2: entity.other.attribute-name.event.slim
|
||||
pop: true
|
||||
- match: '(:[\w\d]+)+'
|
||||
comment: XML
|
||||
push:
|
||||
- meta_scope: entity.name.tag.slim
|
||||
- match: $|\s
|
||||
pop: true
|
||||
- match: '(:\s)(\.|#|[a-zA-Z0-9]+)([\w-]+)?'
|
||||
comment: Inline HTML / 1 - colon; 2 - dot OR hash OR any combination of word, number; 3 - OPTIONAL any combination of word, number, dash or underscore (following a . or
|
||||
captures:
|
||||
1: punctuation.definition.tag.end.slim
|
||||
2: entity.name.tag.slim
|
||||
3: entity.other.attribute-name.event.slim
|
||||
push:
|
||||
- match: '$|(?!\.|#|=|-|~|/|\}|\]|\*|\s?[\*\{])'
|
||||
captures:
|
||||
1: punctuation.definition.tag.end.slim
|
||||
2: entity.name.tag.slim
|
||||
3: entity.other.attribute-name.event.slim
|
||||
pop: true
|
||||
- include: root-class-id-tag
|
||||
- include: tag-attribute
|
||||
- match: '(\*\{)(?=.*\}|.*\|\s*$)'
|
||||
comment: Splat attributes
|
||||
captures:
|
||||
1: punctuation.section.embedded.ruby
|
||||
push:
|
||||
- meta_scope: source.ruby.embedded.slim
|
||||
- match: '(\})|$|^(?!.*\|\s*$)'
|
||||
captures:
|
||||
1: punctuation.section.embedded.ruby
|
||||
pop: true
|
||||
- include: embedded-ruby
|
||||
- include: root-class-id-tag
|
||||
- include: rubyline
|
||||
- match: /
|
||||
scope: punctuation.terminator.tag.slim
|
||||
- match: ^\s*(\\.)
|
||||
captures:
|
||||
1: meta.escape.slim
|
||||
- match: ^\s*(?=\||')
|
||||
push:
|
||||
- match: $
|
||||
pop: true
|
||||
- include: embedded-ruby
|
||||
- include: scope:text.html.basic
|
||||
- match: '(?=<[\w\d\:]+)'
|
||||
comment: Inline and root-level HTML tags
|
||||
push:
|
||||
- match: $|\/\>
|
||||
pop: true
|
||||
- include: scope:text.html.basic
|
||||
continuation:
|
||||
- match: '([\\,])\s*\n'
|
||||
captures:
|
||||
1: punctuation.separator.continuation.slim
|
||||
delimited-ruby-a:
|
||||
- match: '=\('
|
||||
push:
|
||||
- meta_scope: source.ruby.embedded.slim
|
||||
- match: \)(?=( \w|$))
|
||||
pop: true
|
||||
- include: scope:source.ruby.rails
|
||||
delimited-ruby-b:
|
||||
- match: '=\['
|
||||
push:
|
||||
- meta_scope: source.ruby.embedded.slim
|
||||
- match: '\](?=( \w|$))'
|
||||
pop: true
|
||||
- include: scope:source.ruby.rails
|
||||
delimited-ruby-c:
|
||||
- match: '=\{'
|
||||
push:
|
||||
- meta_scope: source.ruby.embedded.slim
|
||||
- match: '\}(?=( \w|$))'
|
||||
pop: true
|
||||
- include: scope:source.ruby.rails
|
||||
embedded-ruby:
|
||||
- match: '(?<!\\)#\{{1,2}'
|
||||
captures:
|
||||
0: punctuation.section.embedded.ruby
|
||||
push:
|
||||
- meta_scope: source.ruby.embedded.html
|
||||
- match: '\}{1,2}'
|
||||
captures:
|
||||
0: punctuation.section.embedded.ruby
|
||||
pop: true
|
||||
- include: scope:source.ruby.rails
|
||||
entities:
|
||||
- match: '(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)'
|
||||
scope: constant.character.entity.html
|
||||
captures:
|
||||
1: punctuation.definition.entity.html
|
||||
3: punctuation.definition.entity.html
|
||||
- match: '&'
|
||||
scope: invalid.illegal.bad-ampersand.html
|
||||
interpolated-ruby:
|
||||
- match: '=(?=\b)'
|
||||
push:
|
||||
- meta_scope: source.ruby.embedded.html
|
||||
- match: \s|\w$
|
||||
pop: true
|
||||
root-class-id-tag:
|
||||
- match: '(\.|#)([\w\d\-]+)'
|
||||
captures:
|
||||
1: punctuation.separator.key-value.html
|
||||
2: entity.other.attribute-name.html
|
||||
rubyline:
|
||||
- match: (==|=)(<>|><|<'|'<|<|>)?|-
|
||||
comment: Hack to thwart Sublime's Ruby highlighter. It thinks do without a variable continues the next line (this can be muted with a / at the end of the line). For things like yields, do is unnecessary without an argument, so this hack will suffice
|
||||
push:
|
||||
- meta_scope: meta.line.ruby.slim
|
||||
- meta_content_scope: source.ruby.embedded.slim
|
||||
- match: (do\s*\n$)|(?<!\\|,|,\n|\\\n)$
|
||||
captures:
|
||||
1: keyword.control.start-block.ruby
|
||||
pop: true
|
||||
- match: '#.*$'
|
||||
comment: Hack to let ruby comments work in this context properly
|
||||
scope: comment.line.number-sign.ruby
|
||||
- include: continuation
|
||||
- include: scope:source.ruby.rails
|
||||
string-double-quoted:
|
||||
- match: (")(?=.*")
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.html
|
||||
push:
|
||||
- meta_scope: string.quoted.double.html
|
||||
- meta_content_scope: meta.toc-list.id.html
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.html
|
||||
pop: true
|
||||
- include: embedded-ruby
|
||||
- include: entities
|
||||
string-single-quoted:
|
||||
- match: (')(?=.*')
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.html
|
||||
push:
|
||||
- meta_scope: string.quoted.single.html
|
||||
- meta_content_scope: meta.toc-list.id.html
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.end.html
|
||||
pop: true
|
||||
- include: embedded-ruby
|
||||
- include: entities
|
||||
tag-attribute:
|
||||
- match: '([\w.#_-]+)(=)(?!\s)(true|false|nil)?(\s*\(|\{)?'
|
||||
captures:
|
||||
1: entity.other.attribute-name.event.slim
|
||||
2: punctuation.separator.key-value.html
|
||||
3: constant.language.slim
|
||||
push:
|
||||
- meta_scope: meta.attribute-with-value.slim
|
||||
- match: '\}|\)|$'
|
||||
captures:
|
||||
1: entity.other.attribute-name.event.slim
|
||||
2: punctuation.separator.key-value.html
|
||||
3: constant.language.slim
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- include: string-double-quoted
|
||||
- include: string-single-quoted
|
||||
tag-stuff:
|
||||
- include: tag-attribute
|
||||
- include: interpolated-ruby
|
||||
- include: delimited-ruby-a
|
||||
- include: delimited-ruby-b
|
||||
- include: delimited-ruby-c
|
||||
- include: rubyline
|
||||
- include: embedded-ruby
|
1
assets/syntaxes/02_Extra/SublimeEthereum
vendored
Submodule
1
assets/syntaxes/02_Extra/SublimeEthereum
vendored
Submodule
Submodule assets/syntaxes/02_Extra/SublimeEthereum added at b60e0a3e00
1
assets/syntaxes/02_Extra/Syslog
vendored
1
assets/syntaxes/02_Extra/Syslog
vendored
Submodule assets/syntaxes/02_Extra/Syslog deleted from 7628d4e0b8
1
assets/syntaxes/02_Extra/SystemVerilog
vendored
Submodule
1
assets/syntaxes/02_Extra/SystemVerilog
vendored
Submodule
Submodule assets/syntaxes/02_Extra/SystemVerilog added at 7eca705e87
2
assets/syntaxes/02_Extra/VimL
vendored
2
assets/syntaxes/02_Extra/VimL
vendored
Submodule assets/syntaxes/02_Extra/VimL updated: 7ebcaa1d98...c91fe3ab02
1
assets/syntaxes/02_Extra/http-request-response
vendored
Submodule
1
assets/syntaxes/02_Extra/http-request-response
vendored
Submodule
Submodule assets/syntaxes/02_Extra/http-request-response added at 93b93261bc
116
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
Normal file
116
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
file_extensions:
|
||||
- log
|
||||
scope: text.log
|
||||
variables:
|
||||
ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
|
||||
contexts:
|
||||
main:
|
||||
- match: (\w+)(=)
|
||||
captures:
|
||||
1: variable.parameter.log
|
||||
2: keyword.operator.assignment.log
|
||||
- match: (')([^']*)(')
|
||||
scope: string.quoted.single.log
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.log
|
||||
3: punctuation.definition.string.end.log
|
||||
- match: (")([^"]*)(")
|
||||
scope: string.quoted.double.log
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.log
|
||||
3: punctuation.definition.string.end.log
|
||||
- include: dates
|
||||
- include: ip_addresses
|
||||
- include: numbers
|
||||
- match: \b(?i:fail(?:ure|ed)?|error|exception)\b
|
||||
scope: markup.error.log
|
||||
- match: \b(?i:warn(?:ing)?)\b
|
||||
scope: markup.warning.log
|
||||
#- include: scope:text.html.markdown#autolink-inet
|
||||
- match: \b\w+:/{2,3}
|
||||
scope: markup.underline.link.scheme.log
|
||||
push: url-host
|
||||
dates:
|
||||
- match: \b\d{4}-\d{2}-\d{2}\b
|
||||
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
- match: \b\d{4}/\d{2}/\d{2}\b
|
||||
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
- match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
|
||||
scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
captures:
|
||||
1: punctuation.separator.decimal.log
|
||||
ip_addresses:
|
||||
- match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
|
||||
push:
|
||||
- meta_scope: meta.ipaddress.v4.log meta.number.integer.decimal.log
|
||||
- match: \d+
|
||||
scope: constant.numeric.value.log
|
||||
- match: \.
|
||||
scope: punctuation.separator.sequence.log
|
||||
- match: ''
|
||||
pop: true
|
||||
- match: (?=(?:\h{0,4}:){2,6}\h{1,4}\b)
|
||||
push:
|
||||
- meta_scope: meta.ipaddress.v6.log meta.number.integer.hexadecimal.log
|
||||
- match: \h{1,4}
|
||||
scope: constant.numeric.value.log
|
||||
- match: ':'
|
||||
scope: punctuation.separator.sequence.log
|
||||
- match: ''
|
||||
pop: true
|
||||
numbers:
|
||||
- match: \b(0x)(\h+)(?:(\.)(\h+))?\b
|
||||
scope: meta.number.float.hexadecimal.log
|
||||
captures:
|
||||
1: constant.numeric.base.log
|
||||
2: constant.numeric.value.log
|
||||
3: constant.numeric.value.log punctuation.separator.decimal.log
|
||||
4: constant.numeric.value.log
|
||||
- match: \b\d+(\.)\d+\b
|
||||
scope: meta.number.float.log constant.numeric.value.log
|
||||
captures:
|
||||
1: punctuation.separator.decimal.log
|
||||
- match: \b\d+\b
|
||||
scope: meta.number.integer.log constant.numeric.value.log
|
||||
url-host:
|
||||
- meta_content_scope: markup.underline.link.host.log
|
||||
- match: \[
|
||||
scope: punctuation.section.brackets.begin.log
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.brackets.end.log
|
||||
pop: true
|
||||
- include: ip_addresses
|
||||
- match: '[^:/\s]+'
|
||||
- match: ''
|
||||
set: url-after-host
|
||||
url-after-host:
|
||||
- match: (:)(\d+)
|
||||
scope: markup.underline.link.port.log
|
||||
captures:
|
||||
1: punctuation.separator.mapping.port.log
|
||||
2: constant.numeric.value.log
|
||||
#- include: scope:text.html.markdown#url-escaped-chars
|
||||
- match: (%)\h{2}
|
||||
scope: markup.underline.link.path.log constant.character.escape.url.log
|
||||
captures:
|
||||
1: punctuation.definition.escape.log
|
||||
# After a valid domain, zero or more non-space non-< characters may follow
|
||||
- match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link
|
||||
pop: true
|
||||
- match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis
|
||||
push:
|
||||
- meta_scope: markup.underline.link.path.log
|
||||
- match: (?=[?!.,:*_~]*[\s<])
|
||||
pop: true
|
||||
- match: \)
|
||||
pop: true
|
||||
- match: (?=\)[?!.,:*_~]*[\s<])
|
||||
pop: true
|
||||
- match: '[^?!.,:*_~\s<&()%]+|\S'
|
||||
scope: markup.underline.link.path.log
|
||||
- match: ''
|
||||
pop: true
|
60
assets/syntaxes/02_Extra/syntax_test_csv.csv
vendored
Normal file
60
assets/syntaxes/02_Extra/syntax_test_csv.csv
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# SYNTAX TEST "CSV.sublime-syntax"
|
||||
Forename,Surname,House No.,Street,City,Postcode
|
||||
#^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
John,Doe,87,Logon Road,Citiville,TU43 6GH
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Jane,Doe,22,"""Fun"" Street","The City, County",FA90 1XA
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
# ^^ constant.character.escape
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Fred,Bloggs,"19","Street
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-3 string.quoted.double
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-4 punctuation.definition.string.begin
|
||||
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||
Spanning Multiple ""
|
||||
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
Lines",Citee,P0stc0d3
|
||||
#^^^^^ meta.field-4 string.quoted.double
|
||||
# ^ meta.field-4 punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
60
assets/syntaxes/02_Extra/syntax_test_tsv.tsv
vendored
Normal file
60
assets/syntaxes/02_Extra/syntax_test_tsv.tsv
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# SYNTAX TEST "CSV.sublime-syntax"
|
||||
Forename Surname House No. Street City Postcode
|
||||
#^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
John Doe 87 Logon Road Citiville TU43 6GH
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Jane Doe 22 """Fun"" Street" "The City County" FA90 1XA
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
# ^^ constant.character.escape
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Fred Bloggs "19" "Street
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-3 string.quoted.double
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-4 punctuation.definition.string.begin
|
||||
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||
Spanning Multiple ""
|
||||
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
Lines" Citee P0stc0d3
|
||||
#^^^^^ meta.field-4 string.quoted.double
|
||||
# ^ meta.field-4 punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
63
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
Normal file
63
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: syslog
|
||||
file_extensions:
|
||||
- syslog
|
||||
scope: text.log.syslog
|
||||
contexts:
|
||||
main:
|
||||
- match: ^(\w+\s+\d+)\s+(\d{2}:\d{2}:\d{2})
|
||||
scope: meta.datetime.syslog constant.numeric.syslog
|
||||
captures:
|
||||
1: meta.date.syslog
|
||||
2: meta.time.syslog
|
||||
push: loghost
|
||||
- match: ^
|
||||
push: text
|
||||
loghost:
|
||||
- match: '[\w:.-]+'
|
||||
scope: entity.other.attribute-name.loghost.syslog
|
||||
set: process
|
||||
process:
|
||||
- match: ([\w.-]+)(?:(\[)(\d+)(\]))?([ :])
|
||||
captures:
|
||||
1: support.function.process.syslog
|
||||
2: punctuation.separator.pid.begin.syslog
|
||||
3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
|
||||
4: punctuation.separator.pid.end.syslog
|
||||
5: punctuation.separator.mapping.syslog
|
||||
set: structured-data
|
||||
structured-data:
|
||||
- match: '\['
|
||||
scope: punctuation.section.mapping.begin.syslog
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.mapping.end.syslog
|
||||
pop: true
|
||||
- match: \w+
|
||||
scope: variable.parameter.syslog
|
||||
- match: =
|
||||
scope: keyword.operator.assignment.syslog
|
||||
push:
|
||||
- match: '[^\s\]]+'
|
||||
scope: constant.other.syslog
|
||||
pop: true
|
||||
- match: (?=\])
|
||||
pop: true
|
||||
- match: (?=\S)
|
||||
set: text
|
||||
text:
|
||||
- match: $
|
||||
pop: true
|
||||
- match: '<\w+>'
|
||||
scope: constant.language.syslog
|
||||
- match: \b(CMD)\b\s+(\()
|
||||
captures:
|
||||
1: entity.name.label.syslog
|
||||
2: punctuation.section.block.begin.syslog
|
||||
embed: scope:source.shell.bash
|
||||
escape: \)$
|
||||
escape_captures:
|
||||
0: punctuation.section.block.end.syslog
|
||||
- include: scope:text.log
|
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
1
assets/themes/visual-studio-dark-plus
vendored
Submodule
1
assets/themes/visual-studio-dark-plus
vendored
Submodule
Submodule assets/themes/visual-studio-dark-plus added at 01ee1e8e0d
2
assets/themes/zenburn
vendored
2
assets/themes/zenburn
vendored
Submodule assets/themes/zenburn updated: 7f6fb86e0d...702023d80d
5
build.rs
5
build.rs
@@ -54,6 +54,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
"assets/manual/bat.1.in",
|
||||
out_dir.join("assets/manual/bat.1"),
|
||||
)?;
|
||||
template(
|
||||
&variables,
|
||||
"assets/completions/bat.bash.in",
|
||||
out_dir.join("assets/completions/bat.bash"),
|
||||
)?;
|
||||
template(
|
||||
&variables,
|
||||
"assets/completions/bat.fish.in",
|
||||
|
@@ -95,6 +95,17 @@ bat f - g # output 'f', then stdin, then 'g'.
|
||||
|
||||
### 他のツールとの統合
|
||||
|
||||
#### `fzf`
|
||||
|
||||
[`fzf`](https://github.com/junegunn/fzf) のプレビューウィンドウに `bat` を使用できます。
|
||||
その場合、`bat` の `--color=always` オプションを用いてカラー出力を強制しなければなりません。
|
||||
また、`--line-range` オプションを用いることで巨大なファイルの読み込み時間を制限できます:
|
||||
```bash
|
||||
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||
```
|
||||
|
||||
詳しくは [`fzf` の `README`](https://github.com/junegunn/fzf#preview-window) を参照してください。
|
||||
|
||||
#### `find` or `fd`
|
||||
|
||||
`find` の `-exec` オプションを使用して、`bat` ですべての検索結果をプレビューできます:
|
||||
@@ -191,7 +202,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||
次の方法でインストールします:
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.2_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -393,7 +404,7 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
|
||||
### 新しい構文の追加 / 言語の定義
|
||||
|
||||
`bat` はシンタックスハイライトのための [`syntext`](https://github.com/trishume/syntect/)
|
||||
`bat` はシンタックスハイライトのための [`syntect`](https://github.com/trishume/syntect/)
|
||||
という素晴らしいライブラリを使用しています。`syntect` は、
|
||||
[Sublime Text の `.sublime-syntax` ファイル](https://www.sublimetext.com/docs/3/syntax.html)
|
||||
とテーマを読み取ることができます。新しい構文を定義するために以下の手順を行います。
|
||||
@@ -630,7 +641,7 @@ cargo install --locked --force
|
||||
比較については [このドキュメント](alternatives.md) を参照してください。
|
||||
|
||||
## ライセンス
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` は MIT License 及び Apache License 2.0 の両方の条件の下で配布されています。
|
||||
|
||||
|
669
doc/README-ko.md
669
doc/README-ko.md
@@ -1,75 +1,86 @@
|
||||
<p align="center">
|
||||
<img src="../doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></a>
|
||||
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||
|
||||
문법 강조와 깃 통합 기능의 <i>cat(1)</i> 클론
|
||||
문법 강조와 Git 통합 기능의 <i>cat(1)</i> 클론
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#문법-강조">주요 기능들</a> •
|
||||
<a href="#사용법">사용법</a> •
|
||||
<a href="#설치">설치</a> •
|
||||
<a href="#커스터마이즈">커스터마이즈</a> •
|
||||
<a href="#사용자화">사용자화</a> •
|
||||
<a href="#프로젝트-목표와-대안들">프로젝트 목표와 대안들</a> •
|
||||
번역 [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="../doc/README-ja.md">日本語</a>]
|
||||
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>] [<a href="../doc/README-ja.md">日本語</a>] [<a href="../doc/README-ko.md">한국어</a>] [<a href="../doc/README-ru.md">Русский</a>]
|
||||
</p>
|
||||
|
||||
### 문법 강조
|
||||
|
||||
`bat`은 다양한 프로그래밍 언어와 마크업 언어에 대해 문법 강조(Syntax highlighting)기능을 지원하고 있습니다:
|
||||
`bat`은 다양한 프로그래밍 및 마크업 언어의 문법 강조(syntax highlighting) 기능을
|
||||
지원합니다:
|
||||
|
||||

|
||||
|
||||
### Git 통합
|
||||
|
||||
`bat`은 `git`을 통해 인덱스와 함께 변경분을 표시합니다 (왼쪽 바를 확인하세요):
|
||||
`bat`은 `git`을 통해 인덱스와 함께 변경분을 표시합니다
|
||||
(왼쪽 사이드바를 확인하세요):
|
||||
|
||||

|
||||
|
||||
### 표시할 수 없는 문자 처리
|
||||
### 비인쇄 문자 처리
|
||||
|
||||
`-A`/`--show-all` 옵션을 사용하여 표시할수 없는 문자를 시각화 해줍니다:
|
||||
`-A`/`--show-all` 옵션을 사용하여 비인쇄 문자를 표시 및 강조할 수 있습니다:
|
||||
|
||||

|
||||
|
||||
### 자동 페이징
|
||||
### 자동 페이징
|
||||
|
||||
하나의 화면에 비해 출력이 너무 큰 경우, `less` 를 이용해 출력들을 연결할 수 있습니다.
|
||||
`bat`은 기본적으로 한 화면에 비해 출력이 큰 경우 `less`와 같은 페이저(pager)로
|
||||
출력을 연결(pipe)합니다.
|
||||
만약 `bat`을 언제나 `cat`처럼 작동하게 하려면 (출력을 페이지하지 않기),
|
||||
`--paging=never` 옵션을 커맨드 라인이나 설정 파일에 넣을 수 있습니다.
|
||||
셸(shell) 설정에서 `cat`을 `bat`의 alias로 사용하려면,
|
||||
`alias cat='bat --paging=never'`를 써서 기본 행동을 유지할 수 있습니다.
|
||||
|
||||
### 파일 연결
|
||||
### 파일 연결(concatenation)
|
||||
|
||||
이 뿐만 아니라 파일을 연결할 때도 사용 할 수 있습니다. :wink: `bat`가 인터렉티브 하지 않은(non-interactive)가 감지하면 (예를 들어,다른 프로세스 혹은 파일과 파이프라인을 연결 한 경우) `bat`은 `cat`을 대신하여 동작하며 일반 파일 내용을 표기해줍니다.
|
||||
페이저(pager)를 사용하더라도 `bat`은 파일들을 연결(concatenate)할 수 있습니다
|
||||
:wink:.
|
||||
`bat`이 비대화형(non-interactive) 터미널(예를 들어, 다른 프로세스나 파일에
|
||||
연결(pipe)한 경우)을 감지하면, `bat`은 `--pager` 옵션의 값과 상관없이 `cat`과
|
||||
동일하게 파일 내용을 그대로 출력합니다.
|
||||
|
||||
## 사용법
|
||||
|
||||
터미널에서 하나의 파일 표시하기
|
||||
터미널에 하나의 파일 표시하기
|
||||
|
||||
```bash
|
||||
> bat README.md
|
||||
```
|
||||
|
||||
여러 파일 한번에 보여주기
|
||||
여러 파일 한 번에 보여주기
|
||||
|
||||
```bash
|
||||
> bat src/*.rs
|
||||
```
|
||||
|
||||
stdin에서 읽고, 자동으로 맞는 문법 강조 적용하기
|
||||
stdin에서 읽고, 자동으로 맞는 문법 결정하기 (참고로, 문법 강조는 파일의 첫
|
||||
줄만으로 문법이 결정될 수 있을 때만 작동합니다.
|
||||
이는 보통 `#!/bin/sh`와 같은 셔뱅(shebang)으로 판단합니다.)
|
||||
|
||||
```bash
|
||||
> curl -s https://sh.rustup.rs | bat
|
||||
```
|
||||
|
||||
stdin에서 읽고, 명시적으로 언어 지정하여 적용하기
|
||||
stdin에서 읽고, 명시적으로 언어 지정하기
|
||||
|
||||
```bash
|
||||
> yaml2json .travis.yml | json_pp | bat -l json
|
||||
```
|
||||
|
||||
표시할 수 없는 문자 처리하기
|
||||
비인쇄 문자 표시 및 강조하기
|
||||
```bash
|
||||
> bat -A /etc/hosts
|
||||
```
|
||||
@@ -86,23 +97,38 @@ bat -n main.rs # show line numbers (only)
|
||||
bat f - g # output 'f', then stdin, then 'g'.
|
||||
```
|
||||
|
||||
### 다른 툴과의 통합
|
||||
### 다른 도구들과 통합하기
|
||||
|
||||
#### `find` 와 `fd`
|
||||
#### `fzf`
|
||||
|
||||
`find`의 `-exec` 옵션을 사용하여 `bat`의 모든 검색 결과를 미리 볼 수 있습니다:
|
||||
`bat`을 [`fzf`](https://github.com/junegunn/fzf)의 프리뷰로 쓸 수 있습니다.
|
||||
이를 위해서는 `bat`의 `--color=always` 옵션으로 항상 컬러 출력이 나오게 해야
|
||||
합니다.
|
||||
또한 `--line-range` 옵션으로 긴 파일의 로드 시간을 제한할 수 있습니다:
|
||||
```bash
|
||||
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||
```
|
||||
더 많은 정보는
|
||||
[`fzf`의 `README`](https://github.com/junegunn/fzf#preview-window)를 참고하세요.
|
||||
|
||||
#### `find`와 `fd`
|
||||
|
||||
`find`의 `-exec` 옵션을 사용하여 모든 검색 결과를 `bat`로 미리 볼 수 있습니다:
|
||||
```bash
|
||||
find … -exec bat {} +
|
||||
```
|
||||
|
||||
[`fd`](https://github.com/sharkdp/fd)를 사용하고 있는 경우, `-X`/`--exec-batch` 옵션을 이용하여 동일하게 사용할 수 있습니다:
|
||||
[`fd`](https://github.com/sharkdp/fd)를 사용하는 경우, `-X`/`--exec-batch`
|
||||
옵션을 이용하여 동일하게 사용할 수 있습니다:
|
||||
```bash
|
||||
fd … -X bat
|
||||
```
|
||||
|
||||
#### `ripgrep`
|
||||
|
||||
[`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)과 함께, [`ripgrep`](https://github.com/BurntSushi/ripgrep)의 검색 결과를 `bat`을 이용하여 볼 수 있습니다.
|
||||
[`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)을
|
||||
통해 `bat`로 [`ripgrep`](https://github.com/BurntSushi/ripgrep)의 검색 결과를
|
||||
출력할 수 있습니다.
|
||||
|
||||
```bash
|
||||
batgrep needle src/
|
||||
@@ -110,279 +136,393 @@ batgrep needle src/
|
||||
|
||||
#### `tail -f`
|
||||
|
||||
`bat` 과 `tail -f`를 함께 사용하여, 특정 파일을 문법 강조하며 지속적으로 모니터링 할 수 있습니다.
|
||||
`bat`와 `tail -f`를 함께 사용하여 주어진 파일을 문법 강조하며 지속적으로
|
||||
모니터할 수 있습니다.
|
||||
```bash
|
||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||
```
|
||||
이 작업을 하려면 페이징 기능을 꺼야합니다. 또, 자동 감지가 되지 않기 때문에, 적용되어야할 문법을 명시적(`-l log`)으로 지정해야 합니다.
|
||||
참고로 이 작업을 하려면 페이징 기능을 꺼야 합니다.
|
||||
또한 이 경우 문법을 자동 감지할 수 없기 때문에, 적용할 문법을 직접 지정해야
|
||||
합니다 (`-l log`).
|
||||
|
||||
#### `git`
|
||||
|
||||
`bat`과 `git show`를 함께 사용하여 주어진 파일의 이전 기록을 문법 강조와 함께 볼 수 있습니다:
|
||||
`bat`과 `git show`를 함께 사용하여 주어진 파일의 이전 버전을 올바른 문법 강조로
|
||||
볼 수 있습니다:
|
||||
```bash
|
||||
git show v0.6.0:src/main.rs | bat -l rs
|
||||
```
|
||||
|
||||
diffs 내에서 문법 강조 표시는 현재 지원되지 않습니다. 이 기능은 [`delta`](https://github.com/dandavison/delta)에서 찾아 볼 수 있습니다.
|
||||
#### `git diff`
|
||||
|
||||
`bat`과 `git diff`를 함께 사용하여 수정된 코드 주위의 줄들을 올바른 문법 강조로
|
||||
볼 수 있습니다:
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
이것을 별도의 도구로 쓰고 싶다면
|
||||
[`bat-extras`](https://github.com/eth-p/bat-extras)의 `batdiff`를 확인해 보세요.
|
||||
|
||||
Git과 diff의 더 많은 지원을 원한다면
|
||||
[`delta`](https://github.com/dandavison/delta)를 확인해 보세요.
|
||||
|
||||
#### `xclip`
|
||||
|
||||
`bat` 출력에서 라인 넘버와 Git 수정 내역이 같이 있어 파일 내용을 복사하기가 어려울 수도 있습니다. 이 경우에는 `-p`/`--plain` 옵션을 사용 하거나 출력 시 파이프라인으로 `xclip`을 사용하면 됩니다:
|
||||
`bat` 출력에 줄 번호와 Git 수정 내역이 포함되어서 파일의 내용을 복사하기
|
||||
어려울 수 있습니다.
|
||||
이 경우에는 `bat`의 `-p`/`--plain` 옵션을 사용하거나 간단히 `xclip`으로 출력을
|
||||
연결(pipe)하면 됩니다:
|
||||
```bash
|
||||
bat main.cpp | xclip
|
||||
```
|
||||
`bat` 에서는 리다이렉트된 것으로 감지하여, 파일 내용만 출력합니다.
|
||||
`bat`는 출력이 우회되고 있다는 것을 감지하여 파일 내용 그대로를 출력합니다.
|
||||
|
||||
#### `man`
|
||||
|
||||
`bat`은 `MANPAGER` 환경 변수 설정을 통해 `man`에 대하여 컬러 페이져를 사용할 수 있습니다:
|
||||
`MANPAGER` 환경 변수 설정을 통해 `bat`을 `man`의 컬러 페이저(pager)로 쓸 수
|
||||
있습니다.
|
||||
|
||||
```bash
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
(Debian이나 Ubuntu를 사용한다면 `bat`을 `batcat`으로 치환하세요.)
|
||||
|
||||
포매팅 문제가 발생한다면, `MANROFFOPT="-c"` 설정 해야 할 수도 있습니다 .
|
||||
포팻 문제가 발생한다면, `MANROFFOPT="-c"`을 써야 할 수 있습니다.
|
||||
|
||||
새 커맨드에서 이 번들을 사용하려면, [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)을 이용 할 수 있습니다.
|
||||
이 기능을 포함한 새로운 명령어를 선호한다면,
|
||||
[`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)을 쓸
|
||||
수도 있습니다.
|
||||
|
||||
참고로 [Manpage 문법](../assets/syntaxes/Manpage.sublime-syntax)은 본 저장소에서
|
||||
개발 중에 있으며, 아직 더 손봐야 합니다.
|
||||
|
||||
참고 : [Manpage syntax](../assets/syntaxes/Manpage.sublime-syntax)는 이 저장소에서 개발되고 있으며, 아직 작업 중 입니다.
|
||||
또한, 이는 Mandoc의 `man` 구현에서
|
||||
[작동하지 않습니다](https://github.com/sharkdp/bat/issues/1145).
|
||||
|
||||
#### `prettier` / `shfmt` / `rustfmt`
|
||||
|
||||
[`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) 스크립트는 코드를 포맷팅하고 `bat`으로 출력해주는 랩퍼(wrapper) 입니다.
|
||||
[`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md)
|
||||
스크립트는 코드를 포맷하고 `bat`으로 출력하는 래퍼(wrapper)입니다.
|
||||
|
||||
|
||||
## 설치
|
||||
|
||||
[](https://repology.org/project/bat/versions)
|
||||
[](https://repology.org/project/bat-cat/versions)
|
||||
|
||||
### On Ubuntu
|
||||
*... 그리고 기타 Debian 기반의 Linux 배포판들.*
|
||||
### Ubuntu에서 (`apt` 사용)
|
||||
*... 그리고 다른 Debian 기반의 Linux 배포판들에서.*
|
||||
|
||||
Ubuntu Eoan 19.10 혹은 Debian unstable sid 이후 버전 부터는 [Ubuntu용 `bat` 패키지](https://packages.ubuntu.com/eoan/bat)나 [Debian용 `bat` 패키지](https://packages.debian.org/sid/bat) 를 설치 할 수 있습니다.
|
||||
`bat`은 [Ubuntu](https://packages.ubuntu.com/eoan/bat)와
|
||||
[Debian](https://packages.debian.org/sid/bat) 패키지 배포 과정에 도입되는 중이며,
|
||||
Eoan 19.10 버전의 Ubuntu에서부터 제공됩니다.
|
||||
현재 Debain에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다.
|
||||
|
||||
만약 충분히 최신 버전의 Ubuntu/Debian이 설치되어 있다면 간단히 다음을 실행하세요:
|
||||
|
||||
```bash
|
||||
apt install bat
|
||||
```
|
||||
|
||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
||||
**중요**: 만약 `bat`을 이와 같이 설치한다면, ([다른 패키지와의 이름
|
||||
충돌](https://github.com/sharkdp/bat/issues/982)로 인하여) `bat` 대신에
|
||||
`batcat`이라는 이름의 실행 파일로 설치될 수 있음을 참고하세요.
|
||||
이에 따른 문제들과 다른 배포판들과의 일관성을 위하여 `bat -> batcat` symlink
|
||||
혹은 alias를 설정할 수 있습니다:
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
### Ubuntu에서 (가장 최신 `.deb` 패키지들 사용)
|
||||
*... 그리고 다른 Debian 기반의 Linux 배포판들에서.*
|
||||
|
||||
공식 소스를 통해 [`bat` 패키지](https://pkgs.alpinelinux.org/packages?name=bat) 를 설치 할 수 있습니다:
|
||||
만약 여러분이 설치한 Ubuntu/Debian에 패키지가 배포되지 않거나 가장 최신 릴리즈된
|
||||
`bat`을 원한다면, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서
|
||||
다음과 같이 `.deb` 패키지를 받아 설치하세요:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.2_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### Alpine Linux에서
|
||||
|
||||
적절한 저장소가 활성화되어 있다면, 공식 소스를 통해
|
||||
[`bat` 패키지](https://pkgs.alpinelinux.org/packages?name=bat)를 설치할 수
|
||||
있습니다:
|
||||
|
||||
```bash
|
||||
apk add bat
|
||||
```
|
||||
|
||||
### On Arch Linux
|
||||
### Arch Linux에서
|
||||
|
||||
공식 소스를 통해 [`bat` 패키지](https://www.archlinux.org/packages/community/x86_64/bat/)를 설치할 수 있습니다:
|
||||
공식 소스를 통해
|
||||
[`bat` 패키지](https://www.archlinux.org/packages/community/x86_64/bat/)를
|
||||
설치할 수 있습니다:
|
||||
|
||||
```bash
|
||||
pacman -S bat
|
||||
```
|
||||
|
||||
### On Fedora
|
||||
### Fedora에서
|
||||
|
||||
[공식 Fedora 모듈 저장소](https://docs.fedoraproject.org/en-US/modularity/using-modules/)에서 [`bat` 패키지](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506)을 설치할 수 있습니다:
|
||||
공식
|
||||
[Fedora 모듈](https://docs.fedoraproject.org/en-US/modularity/using-modules/)
|
||||
저장소에서
|
||||
[`bat` 패키지](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506)를
|
||||
설치할 수 있습니다:
|
||||
|
||||
```bash
|
||||
dnf install bat
|
||||
```
|
||||
|
||||
### On Gentoo Linux
|
||||
### Gentoo Linux에서
|
||||
|
||||
공식 소스를 통해 [`bat` 패키지](https://packages.gentoo.org/packages/sys-apps/bat)를 설치할 수 있습니다.
|
||||
공식 소스를 통해
|
||||
[`bat` 패키지](https://packages.gentoo.org/packages/sys-apps/bat)를 설치할 수
|
||||
있습니다:
|
||||
|
||||
```bash
|
||||
emerge sys-apps/bat
|
||||
```
|
||||
|
||||
### On Void Linux
|
||||
### Void Linux에서
|
||||
|
||||
xbps-install를 이용해 `bat`을 설치할 수 있습니다:
|
||||
xbps-install을 이용해 `bat`을 설치할 수 있습니다:
|
||||
```bash
|
||||
xbps-install -S bat
|
||||
```
|
||||
|
||||
### On FreeBSD
|
||||
### Termux에서
|
||||
|
||||
pkg를 이용하여 미리 컴파일된 [`bat` 패키지](https://www.freshports.org/textproc/bat)를 설치할 수 있습니다:
|
||||
pkg를 이용해 `bat`을 설치할 수 있습니다:
|
||||
```bash
|
||||
pkg install bat
|
||||
```
|
||||
|
||||
### FreeBSD에서
|
||||
|
||||
pkg를 이용하여 미리 컴파일된
|
||||
[`bat` 패키지](https://www.freshports.org/textproc/bat)를 설치할 수 있습니다:
|
||||
|
||||
```bash
|
||||
pkg install bat
|
||||
```
|
||||
|
||||
또는 FreeBSD 포트에서 직접 빌드할 수도 있습니다:
|
||||
또는 FreeBSD 포트에서 직접 빌드할 수도 있습니다:
|
||||
|
||||
```bash
|
||||
cd /usr/ports/textproc/bat
|
||||
make install
|
||||
```
|
||||
|
||||
### Via nix
|
||||
### nix를 써서
|
||||
|
||||
[nix package manager](https://nixos.org/nix)를 이용해 `bat`을 설치할 수 있습니다:
|
||||
[nix package manager](https://nixos.org/nix)를 이용해 `bat`을 설치할 수
|
||||
있습니다:
|
||||
|
||||
```bash
|
||||
nix-env -i bat
|
||||
```
|
||||
|
||||
### On openSUSE
|
||||
### openSUSE에서
|
||||
|
||||
zypper을 이용해 `bat`을 설치할 수 있습니다:
|
||||
zypper를 이용해 `bat`을 설치할 수 있습니다:
|
||||
|
||||
```bash
|
||||
zypper install bat
|
||||
```
|
||||
|
||||
### On macOS
|
||||
### snap 패키지를 써서
|
||||
|
||||
[Homebrew](http://braumeister.org/formula/bat)를 이용해 `bat`을 설치할 수 있습니다:
|
||||
지금으로서는 추천하는 snap 패키지가 없습니다.
|
||||
제공되는 패키지들이 존재할 수는 있지만, 공식적으로 지원되지 않으며
|
||||
[문제](https://github.com/sharkdp/bat/issues/1519)가 있을 수 있습니다.
|
||||
|
||||
|
||||
### macOS (또는 Linux)에서 Homebrew를 써서
|
||||
|
||||
[macOS의 Homebrew](https://formulae.brew.sh/formula/bat) 또는
|
||||
[Linux의 Homebrew](https://formulae.brew.sh/formula-linux/bat)를 이용하여
|
||||
`bat`을 설치할 수 있습니다.
|
||||
|
||||
```bash
|
||||
brew install bat
|
||||
```
|
||||
|
||||
또는 [MacPorts](https://ports.macports.org/port/bat/summary)를 사용할 수도 있습니다:
|
||||
### macOS에서 MacPorts를 써서
|
||||
|
||||
[MacPorts](https://ports.macports.org/port/bat/summary)를 이용하여 `bat`을
|
||||
설치할 수 있습니다:
|
||||
|
||||
```bash
|
||||
port install bat
|
||||
```
|
||||
|
||||
### On Windows
|
||||
### Windows에서
|
||||
|
||||
Windows에서 `bat`을 설치할 수 있는 몇 가지 옵션들이 있습니다. 먼저 `bat`을 설치 한 후, ["Windows에서 사용하기"](#Windows에서-사용하기) 참고하시기 바랍니다.
|
||||
Windows에서 `bat`을 설치할 수 있는 몇 가지 옵션들이 있습니다.
|
||||
먼저 `bat`을 설치한 후,
|
||||
["Windows에서 `bat` 사용하기"](#windows에서-bat-사용하기) 섹션을 살펴보세요.
|
||||
|
||||
#### With Chocolatey
|
||||
#### 전제 조건
|
||||
|
||||
[Chocolatey](https://chocolatey.org/packages/Bat)를 이용해 `bat`을 설치할 수 있습니다:
|
||||
[Visual C++ 재배포 가능](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
|
||||
패키지를 설치해야 합니다.
|
||||
|
||||
#### Chocolatey를 써서
|
||||
|
||||
[Chocolatey](https://chocolatey.org/packages/Bat)를 이용해 `bat`을 설치할 수
|
||||
있습니다:
|
||||
```bash
|
||||
choco install bat
|
||||
```
|
||||
|
||||
#### With Scoop
|
||||
#### Scoop을 써서
|
||||
|
||||
[scoop](https://scoop.sh/)을 이용해 `bat`을 설치할 수 있습니다:
|
||||
```bash
|
||||
scoop install bat
|
||||
```
|
||||
[Visual C++ Redistributable 패키지](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)를 같이 설치해 주어야 합니다.
|
||||
|
||||
#### From prebuilt binaries:
|
||||
#### 사전 빌드된 바이너리들로
|
||||
|
||||
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 빌드된 바이너리를 다운받을 수 있습니다.
|
||||
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 사전 빌드된
|
||||
바이너리를 다운받을 수 있습니다.
|
||||
|
||||
[Visual C++ Redistributable 패키지](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)를 같이 설치해 주어야 합니다.
|
||||
[Visual C++ 재배포 가능](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
|
||||
패키지를 설치해야 합니다.
|
||||
|
||||
### Via Docker
|
||||
### 바이너리들로
|
||||
|
||||
컨테이너에서 `bat`을 사용할 수 있는 [Docker image](https://hub.docker.com/r/danlynn/bat/)가 있습니다.:
|
||||
```bash
|
||||
docker pull danlynn/bat
|
||||
alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
|
||||
```
|
||||
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다양한 아키텍처를
|
||||
위해 사전 빌드된 버전들을 확인할 수 있습니다.
|
||||
정적 링크 바이너리들은 파일 이름에 `musl` 이 포함된 아카이브들을 확인하세요.
|
||||
|
||||
### Via Ansible
|
||||
### 소스에서
|
||||
|
||||
[Ansible](https://www.ansible.com/)을 사용해 `bat`을 설치할 수 있습니다:
|
||||
|
||||
```bash
|
||||
# Install role on local machine
|
||||
ansible-galaxy install aeimer.install_bat
|
||||
```
|
||||
|
||||
```yaml
|
||||
---
|
||||
# Playbook to install bat
|
||||
- host: all
|
||||
roles:
|
||||
- aeimer.install_bat
|
||||
```
|
||||
|
||||
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
||||
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
||||
|
||||
다음 배포판들에서 동작합니다:
|
||||
- Debian/Ubuntu
|
||||
- ARM (eg. Raspberry PI)
|
||||
- Arch Linux
|
||||
- Void Linux
|
||||
- FreeBSD
|
||||
- MacOS
|
||||
|
||||
### From binaries
|
||||
|
||||
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다양한 환경을 위해 빌드된 버전들을 확인 할 수 있습니다. 정적 링크 바이너리들은 아카이브에서 파일 이름에 `musl` 이 포함 파일로 확인 할 수 있습니다.
|
||||
|
||||
### From source
|
||||
|
||||
`bat`의 소스를 직접 빌드하기 위해서는, Rust 1.36 이상이 필요하며 `cargo`를 이용해 빌드할 수 있습니다.
|
||||
`bat`의 소스를 빌드하기 위해서는, Rust 1.45 이상이 필요합니다.
|
||||
`cargo`를 이용해 전부 빌드할 수 있습니다:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
```
|
||||
|
||||
일부 플랫폼에서는 `llvm` 그리고/또는 `libclang-dev` 설치가 필요할 수도 있습니다.
|
||||
참고로 man 페이지나 셸 자동 완성 파일과 같은 부가 파일들은 이 방법으로 설치될 수
|
||||
없습니다.
|
||||
이것들은 `cargo`에 의해 생성이 되고 (`build` 밑의) cargo 타켓 폴더에서 찾을 수
|
||||
있습니다.
|
||||
|
||||
## 커스터마이즈
|
||||
## 사용자화
|
||||
|
||||
### 문법 강조 테마
|
||||
### 문법 강조 테마
|
||||
|
||||
`bat --list-themes`을 사용하면, 현재 사용 가능한 문법 강조 테마들을 확인할 수 있습니다. `TwoDark` 테마 선택하는 경우, `--theme=TwoDark` 옵션과 함께 `bat`을 사용하거나 환경변수에서 `BAT_THEME`를 `TwoDark`로 세팅해주면 됩니다. 쉘 시작 파일에 `export BAT_THEME="TwoDark"` 를 정의해 계속 사용도 가능합니다. 이 밖에 `bat`의 [설정 파일](#설정-파일)을 이용할 수도 있습니다.
|
||||
`bat --list-themes`을 사용하여 사용 가능한 문법 강조 테마들의 목록을 확인할 수
|
||||
있습니다.
|
||||
`TwoDark` 테마를 선택하려면, `--theme=TwoDark` 옵션과 함께 `bat`을 사용하거나
|
||||
`BAT_THEME` 환경 변수를 `TwoDark`로 설정하세요.
|
||||
셸 시작 파일에 `export BAT_THEME="TwoDark"` 를 정의해 영구적으로 설정할 수
|
||||
있습니다.
|
||||
이 밖에 `bat`의 [설정 파일](#설정-파일)을 이용할 수 있습니다.
|
||||
|
||||
다른 테마를 미리 보고 싶은경우 다음 명령어와 같이 사용할 수 있습니다.(이 경우 [`fzf`](https://github.com/junegunn/fzf)가 필요합니다.)
|
||||
만약 다른 테마들을 사용하여 특정 파일을 보고 싶다면, 다음 명령어를 쓸 수
|
||||
있습니다(이 경우 [`fzf`](https://github.com/junegunn/fzf)가 필요합니다.)
|
||||
|
||||
```bash
|
||||
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
```
|
||||
`bat`의 기본 테마는 어두운 배경색 터미널에 적합합니다. 만일 밝은 배경색을 사용할 경우에는 `GitHub` 이나 `OneHalfLight` 과 같은 테마가 더 잘 어울립니다. 아래 [새로운 테마 추가하기](#새로운-테마-추가하기)에 따라 커스텀 테마를 사용할수도 있습니다.
|
||||
|
||||
`bat`은 기본적으로 어두운 배경에 적합합니다.
|
||||
그러나 밝은 배경의 터미널을 사용한다면 `GitHub`이나 `OneHalfLight`과 같은 테마가
|
||||
더 잘 어울립니다.
|
||||
아래 [새로운 테마 추가하기](#새로운-테마-추가하기) 섹션에 따라 커스텀 테마를
|
||||
사용할 수도 있습니다.
|
||||
|
||||
### 8비트 테마
|
||||
|
||||
`bat`은 트루컬러 지원이 되더라도 항상
|
||||
[8비트 색상](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors)을 사용하는
|
||||
세 개의 테마가 있습니다.
|
||||
|
||||
- `ansi`는 어떤 터미널에서도 무난하게 보입니다. 이는 3비트 색상을 사용합니다:
|
||||
검정, 빨강, 녹색, 노랑, 파랑, 마젠타, 시안, 하양.
|
||||
- `base16`은 [base16](https://github.com/chriskempson/base16) 터미널 테마를 위해
|
||||
디자인되었습니다.
|
||||
이는 [base16 스타일 가이드라인](https://github.com/chriskempson/base16/blob/master/styling.md)에
|
||||
따라 4비트 색상(3비트 색상에 밝은 변형 추가)을 사용합니다.
|
||||
- `base16-256`는 [base16-shell](https://github.com/chriskempson/base16-shell)을
|
||||
위해 디자인되었습니다.
|
||||
이는 16부터 21의 일부 밝은 색상을 8비트 색상으로 대치합니다.
|
||||
단지 256-색상 터미널을 쓰지만 base16-shell을 쓰지 않는다고 해서 이것을
|
||||
사용하지 **마십시오**.
|
||||
|
||||
이들 테마는 더 제한적이지만, 트루컬러 테마에 비해 두 장점이 있습니다:
|
||||
|
||||
- 이들은 3비트 혹은 4비트 색상을 쓰는 다른 터미널 소프트웨어와 더 잘
|
||||
어울립니다.
|
||||
- 만약 터미널 테마를 바꾼다면, 이미 화면 상의 `bat`의 출력도 이에 맞추어
|
||||
업데이트됩니다.
|
||||
|
||||
### 출력 스타일
|
||||
|
||||
`--style` 옵션을 이용하여 `bat`의 출력 스타일을 변경 할 수 있습니다. 예를 들어, `--style=numbers,changes`는 Git 변경분과 라인 넘버에 대해서만 출력하며 눈금과 파일 헤더가 표시되지 않습니다. `BAT_STYLE` 환경 변수로 정의하여 계속해서 사용하거나`bat`의 [설정 파일](#설정-파일)을 사용할 수도 있습니다.
|
||||
`--style` 옵션을 이용하면 `bat`의 출력 모양을 조절할 수 있습니다.
|
||||
예를 들어, `--style=numbers,changes`를 통해 Git 변경분과 줄 번호는 출력하지만
|
||||
격자와 파일 헤더는 출력하지 않을 수 있습니다.
|
||||
`BAT_STYLE` 환경 변수를 정의하여 이러한 수정을 영구적으로 하거나 `bat`의
|
||||
[설정 파일](#설정-파일)을 사용하세요.
|
||||
|
||||
### 새로운 문법 강조 / 언어 추가하기
|
||||
### 새로운 문법 / 언어 정의 추가하기
|
||||
|
||||
`bat`은 문법 강조를 위해 [`syntect`](https://github.com/trishume/syntect/) 라이브러리를 사용하고 있습니다. `syntect`는 [Sublime Text의 `.sublime-syntax` 파일](https://www.sublimetext.com/docs/3/syntax.html)과 테마를 읽을 수 있습니다. 새로운 문법 강조를 추가하는 방법은 다음과 같습니다.
|
||||
만약 `bat`에서 특정 문법이 지원되지 않을 경우, 다음의 절차를 통해 현재 `bat`
|
||||
설치본에 새로운 문법을 쉽게 추가할 수 있습니다.
|
||||
|
||||
우선 문법 정의 파일을 넣을 폴더를 만듭니다:
|
||||
`bat`은 문법 강조를 위해 훌륭한
|
||||
[`syntect`](https://github.com/trishume/syntect/) 라이브러리를 사용합니다.
|
||||
`syntect`는 임의의 [Sublime Text의 `.sublime-syntax`
|
||||
파일](https://www.sublimetext.com/docs/3/syntax.html)과 테마를 읽을 수 있습니다.
|
||||
|
||||
```bash
|
||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||
cd "$(bat --config-dir)/syntaxes"
|
||||
[Package Control](https://packagecontrol.io/)에 Sublime 문법 패키지를 찾는
|
||||
방법이 잘 정리되어 있습니다.
|
||||
일단 문법을 찾았다면:
|
||||
|
||||
# Put new '.sublime-syntax' language definition files
|
||||
# in this folder (or its subdirectories), for example:
|
||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||
```
|
||||
1. 문법 정의 파일들을 넣을 폴더를 만듭니다:
|
||||
|
||||
다음 명령어를 통해 파일을 바이너리 캐시로 파싱합니다.
|
||||
```bash
|
||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||
cd "$(bat --config-dir)/syntaxes"
|
||||
|
||||
```bash
|
||||
bat cache --build
|
||||
```
|
||||
# Put new '.sublime-syntax' language definition files
|
||||
# in this folder (or its subdirectories), for example:
|
||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||
```
|
||||
|
||||
마지막으로 `bat --list-languages`을 통해 새로운 언어가 사용 가능한지 확인합니다.
|
||||
2. 이제 다음 명령어를 통해 파일들을 파싱(parse)하여 바이너리 캐시를 만듭니다.
|
||||
|
||||
기본 설정으로 돌아가려면, 다음 명령어를 이용합니다.:
|
||||
```bash
|
||||
bat cache --build
|
||||
```
|
||||
|
||||
```bash
|
||||
bat cache --clear
|
||||
```
|
||||
3. 마지막으로, `bat --list-languages`로 새로 추가한 언어가 사용 가능한지
|
||||
확인합니다.
|
||||
|
||||
만약 기본 설정으로 돌아갈 일이 생긴다면, 다음 명령어를 이용합니다:
|
||||
|
||||
```bash
|
||||
bat cache --clear
|
||||
```
|
||||
|
||||
4. 만약 특정 문법이 `bat`에 기본적으로 포함되어 있어야 한다고 생각한다면, 방침과
|
||||
절차를 [여기](../doc/assets.md)서 읽은 후 "문법 요청(syntax request)"을 열어
|
||||
주세요: [문법 요청하기](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md).
|
||||
|
||||
### 새로운 테마 추가하기
|
||||
|
||||
새로운 문법 정의 추가와 매우 유사합니다.
|
||||
이 과정은 새로운 문법 정의 추가 방식과 매우 비슷합니다.
|
||||
|
||||
먼저, 새로운 문법 강조 테마 폴더를 만듭니다.
|
||||
먼저, 새로운 문법 강조 테마 폴더를 만듭니다.
|
||||
```bash
|
||||
mkdir -p "$(bat --config-dir)/themes"
|
||||
cd "$(bat --config-dir)/themes"
|
||||
@@ -394,32 +534,93 @@ git clone https://github.com/greggb/sublime-snazzy
|
||||
bat cache --build
|
||||
```
|
||||
|
||||
마지막으로 `bat --list-themes`을 통해 새로운 테마가 사용 가능한지 확인합니다.
|
||||
마지막으로 `bat --list-themes`을 통해 새로 추가한 테마들이 사용 가능한지
|
||||
확인합니다.
|
||||
|
||||
### 다른 페이져 사용하기
|
||||
### 파일 타입 설정을 추가하거나 변경하기
|
||||
|
||||
`bat`은 환경변수 `PAGER`로 사용할 페이져를 명시합니다. 만약 이 변수가 정의되어있지 않다면 `less`가 기본입니다. 만약 다른 페이져를 사용하고 싶다면 `PAGER` 변수를 수정하거나 `BAT_PAGER` 환경 변수로 `PAGER` 대신 정의 할 수도 있습니다.
|
||||
새로운 파일 이름 패턴을 추가하려면 (혹은 이미 존재하는 것을 변경하려면)
|
||||
`--map-syntax` 커맨드 라인 옵션을 사용하세요.
|
||||
이 옵션은 `pattern:syntax` 꼴의 인자를 받습니다.
|
||||
이때 `pattern`은 파일 이름과 절대 파일 경로를 매치할 글로브(glob) 패턴입니다.
|
||||
`syntax` 부분은 지원되는 언어의 전체 이름입니다
|
||||
(`bat --list-languages`를 통해 개요를 확인하세요).
|
||||
|
||||
만약 커맨드라인 인수로 넘기려면, `PAGER`/`BAT_PAGER` 변수를 정의를 통해 사용 할 수 있습니다. :
|
||||
참고: 이 옵션은 커맨드 라인에 넘겨 주는 것보다는 `bat`의 설정 파일에 넣는 것이
|
||||
좋을 것입니다 (아래를 보세요).
|
||||
|
||||
예시: "INI" 문법 강조를 `.conf` 파일 확장자의 모든 파일에 적용하려면, 다음을
|
||||
사용하세요:
|
||||
```bash
|
||||
--map-syntax='*.conf:INI'
|
||||
```
|
||||
|
||||
예시: `.ignore`(완전 일치)이라는 이름의 모든 파일을 "Git Ignore" 문법으로
|
||||
열려면, 다음을 사용하세요:
|
||||
```bash
|
||||
--map-syntax='.ignore:Git Ignore'
|
||||
```
|
||||
|
||||
예시: `/etc/apache2`의 하위 폴더들에 있는 모든 `.conf` 파일들을 "Apache Conf"
|
||||
문법으로 열려면, 다음을 사용하세요 (이 대응(mapping)은 이미 내장되어 있습니다):
|
||||
```bash
|
||||
--map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
||||
```
|
||||
|
||||
### 다른 페이저 사용하기
|
||||
|
||||
`bat`은 환경 변수 `PAGER`에 명시된 페이저를 사용합니다.
|
||||
이 변수가 정의되어 있지 않다면, `less`가 기본으로 사용됩니다.
|
||||
만약 다른 페이저를 사용하고 싶다면, `PAGER` 변수를 수정하거나 `BAT_PAGER` 환경
|
||||
변수를 설정하여 `PAGER`의 설정을 오버라이드(override)할 수 있습니다.
|
||||
|
||||
만약 커맨드라인 인수들을 페이저에게 넘겨 주려면, `PAGER`/`BAT_PAGER` 변수로
|
||||
설정할 수 있습니다:
|
||||
|
||||
```bash
|
||||
export BAT_PAGER="less -RF"
|
||||
```
|
||||
|
||||
환경 변수 대신, `bat`의 [설정 파일](#설정-파일)에서 페이져를 설정 할 수도 있습니다.(`--pager` 옵션)
|
||||
환경 변수를 사용하는 대신, `bat`의 [설정 파일](#설정-파일)로 페이저를 설정할
|
||||
수도 있습니다 (`--pager` 옵션).
|
||||
|
||||
**참고**: 기본적으로 페이져가 `less`로 설정 되어있다면, `bat`은 다음 옵션들을 받을 수 있습니다: `-R`/`--RAW-CONTROL-CHARS`,
|
||||
`-F`/`--quit-if-one-screen` 그리고 `-X`/`--no-init`. 마지막 옵션(`-X`)은 530 이전 버전에서만 사용됩니다.
|
||||
**참고**: 기본적으로, 페이저가 `less`로 설정되어 있다면 (그리고 커맨드 라인
|
||||
옵션이 지정되어 있지 않다면), `bat`은 다음 옵션들을 페이저로 넘겨줍니다:
|
||||
`-R`/`--RAW-CONTROL-CHARS`, `-F`/`--quit-if-one-screen` 그리고 `-X`/`--no-init`.
|
||||
마지막 옵션(`-X`)은 530 이전 버전의 `less`에만 사용됩니다.
|
||||
|
||||
`-R` 옵션은 ANSI 컬러를 올바르게 해석하기 위해 필요합니다. 두번째 옵션 (`-F`)은 출력 크기가 터미널의 세로 크기보다 작을 경우 즉시 종료되도록 합니다.
|
||||
페이져를 종료하기 위해 `q`를 누를 필요 없기 때문에 작은 파일을 다룰 때 용이합니다. 세번째 옵션(`-X`)는 `less` 이전 버전의 `--quit-if-one-screen` 기능과 함께 버그를 잡을 때 필요합니다. 안타깝게도, `less`의 마우스 휠 지원은 종료합니다.
|
||||
`-R` 옵션은 ANSI 색상을 올바르게 해석하기 위해 필요합니다.
|
||||
두 번째 옵션(`-F`)은 출력 크기가 터미널의 세로 크기보다 작을 경우 less가 즉시
|
||||
종료되도록 합니다.
|
||||
이는 작은 파일을 다룰 때 페이저를 종료하기 위해 `q`를 누를 필요 없어서
|
||||
편리합니다.
|
||||
세 번째 옵션(`-X`)는 예전 버전의 `less`에 있는 `--quit-if-one-screen` 기능의
|
||||
버그를 고치기 위해 필요합니다.
|
||||
안타깝게도, 이는 `less`의 마우스 휠 지원과 호환되지 않습니다.
|
||||
|
||||
`less` 예전 버전에서 마우스 휠 기능을 활성화 시키려면, `-R` 옵션을 사용하면 됩니다. (위의 예제처럼, 이 옵션은 quit-if-one-screen 기능을 비활성화 시킵니다.)
|
||||
530 이하 버전에서는 그대로 사용할 수 있습니다.
|
||||
`less`의 예전 버전에서 마우스 휠 기능을 활성화하려면, `-R` 옵션을 넘겨주세요
|
||||
(위의 예제처럼, 이 옵션은 quit-if-one-screen 기능을 비활성화합니다).
|
||||
less 530과 이후 버전에서는 그대로 사용할 수 있습니다.
|
||||
|
||||
### 들여쓰기
|
||||
|
||||
`bat`은 페이저에 의존하지 않고 탭을 4 스페이스로 확장합니다.
|
||||
이를 변경하려면 간단히 `--tabs` 인자에 표시되기를 원하는 스페이스 개수를
|
||||
추가하세요.
|
||||
|
||||
**참고**: (`bat`의 `--pager` 인자 혹은 `less`의 `LESS` 환경 변수를 통해)
|
||||
페이저의 탭 길이를 지정하는 것은 효과가 없을 것인데, 이는 페이저가 이미
|
||||
스페이스로 확장된 탭을 받기 때문입니다.
|
||||
이 기능은 사이드바에 의한 들여쓰기 문제를 회피하기 위해 추가되었습니다.
|
||||
`bat`을 `--tabs=0`과 함께 호출하면 이를 오버라이드하여 페이저가 탭을 처리하게
|
||||
합니다.
|
||||
|
||||
### 다크 모드
|
||||
|
||||
macOS에서 다크 모드를 사용하고 있다면, OS 테마에 따라 다른 테마를 사용하도록 `bat`의 구성할 수 있습니다. 아래 코드는 라이트 모드에서는 `default` 테마를 다크모드에서는 `Github` 테마를 사용하는 방법입니다.
|
||||
macOS에서 다크 모드를 사용하고 있다면, `bat`가 OS 테마에 따라 다른 테마를
|
||||
사용하도록 구성할 수 있습니다.
|
||||
아래 스니펫은 _다크 모드_에서는 `default` 테마를, _라이트 모드_에서는 `GitHub`
|
||||
테마를 사용하는 방법입니다.
|
||||
|
||||
```bash
|
||||
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||
@@ -427,57 +628,89 @@ alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /de
|
||||
|
||||
## 설정 파일
|
||||
|
||||
`bat` 설정 파일로 커스터마이즈 할 수 있습니다. 파일의 위치는 운영 체제에 따라 다릅니다. 아래 커맨드를 통해 시스템의 기본 경로를 알 수 있습니다.
|
||||
`bat`는 설정 파일로도 사용자화 할 수 있습니다.
|
||||
설정 파일의 위치는 운영 체제에 따라 다릅니다.
|
||||
아래 커맨드를 통해 시스템의 기본 경로를 확인할 수 있습니다.
|
||||
```
|
||||
bat --config-file
|
||||
```
|
||||
|
||||
또는, `BAT_CONFIG_PATH` 환경 변수를 사용하여 `bat`의 설정 파일 위치를 지정할 수 있습니다.
|
||||
또는, `BAT_CONFIG_PATH` 환경 변수를 사용하여 `bat`가 설정 파일의 기본 경로
|
||||
이외의 위치를 사용하도록 할 수 있습니다.
|
||||
```bash
|
||||
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||
```
|
||||
|
||||
### 포맷
|
||||
|
||||
설정 파일은 명령어 인수들의 리스트 입니다. `bat --help`를 이용하여 가능한 옵션들과 값들을 확인해 볼 수 있습니다. 또, `#` 으로 주석을 추가할수도 있습니다.
|
||||
|
||||
설정 파일의 예:
|
||||
기본 설정 파일은 `--generate-config-file` 옵션으로 생성할 수 있습니다.
|
||||
```bash
|
||||
# Set the theme to "TwoDark"
|
||||
--theme="TwoDark"
|
||||
|
||||
# Show line numbers, Git modifications and file header (but no grid)
|
||||
--style="numbers,changes,header"
|
||||
|
||||
# Use italic text on the terminal (not supported on all terminals)
|
||||
--italic-text=always
|
||||
|
||||
# Use C++ syntax for .ino files
|
||||
--map-syntax "*.ino:C++"
|
||||
|
||||
# Use ".gitignore"-style highlighting for ".ignore" files
|
||||
--map-syntax ".ignore:Git Ignore"
|
||||
bat --generate-config-file
|
||||
```
|
||||
|
||||
## Windows에서 사용하기
|
||||
### 포맷
|
||||
|
||||
`bat` 대부분의 경우 Windows에서 기본적으로 잘 작동하지만, 일부 기능에는 추가 적인 구성이 필요할 수 있습니다.
|
||||
설정 파일은 단순히 커맨드 라인 인자들의 리스트입니다.
|
||||
`bat --help`로 가능한 모든 옵션과 값들을 확인하세요.
|
||||
추가적으로, 줄 앞에 `#` 문자를 추가해 주석을 넣을 수 있습니다.
|
||||
|
||||
### 페이징
|
||||
설정 파일 예시:
|
||||
```bash
|
||||
# "TwoDark" 테마 설정하기
|
||||
--theme="TwoDark"
|
||||
|
||||
Windows는 `more` 형식의 매우 제한된 페이저만이 포함되어있습니다. `less`용 Windows 바이너리는 [이 홈페이지](http://www.greenwoodsoftware.com/less/download.html)나 [Chocolatey](https://chocolatey.org/packages/Less)에서 다운로드 받을 수 있습니다. 이를 사용하려면 바이너리를 `PATH` 디렉토리에 배치하거나 [환경 변수로 정의](#using-a-different-pager) 하세요. [Chocolatey 패키지](#on-windows)로 `less`를 자동으로 설치할 수 있습니다.
|
||||
# 줄 번호, Git 변경 내용, 파일 헤더 보이기 (격자 없이)
|
||||
--style="numbers,changes,header"
|
||||
|
||||
# 터미널에서 이탤릭체 쓰기 (일부 터미널에서 미지원)
|
||||
--italic-text=always
|
||||
|
||||
# .ino 파일에 C++ 문법 쓰기
|
||||
--map-syntax "*.ino:C++"
|
||||
```
|
||||
|
||||
## Windows에서 `bat` 사용하기
|
||||
|
||||
`bat`는 대부분의 경우 Windows에서 기본적으로 잘 작동하지만, 일부 기능은 추가적인
|
||||
구성이 필요할 수 있습니다.
|
||||
|
||||
#### 전제 조건
|
||||
|
||||
[Visual C++ 재배포 가능](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
|
||||
패키지를 설치해야 합니다.
|
||||
|
||||
### 페이징
|
||||
|
||||
Windows는 `more` 형식의 매우 제한된 페이저만 포함합니다.
|
||||
Windows용 `less` 바이너리는
|
||||
[공식 홈페이지](http://www.greenwoodsoftware.com/less/download.html)나
|
||||
[Chocolatey](https://chocolatey.org/packages/Less)를 통해 다운로드 받을 수
|
||||
있습니다.
|
||||
이를 사용하려면 디렉터리 안의 바이너리를 `PATH`에 넣거나
|
||||
[환경 변수로 정의](#using-a-different-pager)하세요.
|
||||
[Chocolatey 패키지](#on-windows)는 `less`를 자동으로 설치합니다.
|
||||
|
||||
### 색상
|
||||
|
||||
Windows 10은 기본 내장기능으로 [v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update)) 이후의 `conhost.exe`(Command Prompt) 와 PowerShell, 그리고 최신 버전의 bash에서 색상을 지원합니다. 이전 버전의 Windows에서는, [ConEmu](https://conemu.github.io/)가 포함 된 [Cmder](http://cmder.net/)를 사용할 수 있습니다 .
|
||||
Windows 10은
|
||||
[v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update))부터
|
||||
기본적으로 `conhost.exe`(Command Prompt)와 PowerShell에서 색상을 지원하며,
|
||||
최신 버전의 bash에서도 색상을 지원합니다.
|
||||
이전 버전의 Windows에서는, [ConEmu](https://conemu.github.io/)가 포함된
|
||||
[Cmder](http://cmder.net/)를 사용할 수 있습니다.
|
||||
|
||||
**참고:** `less`의 Git과 MSYS 버전은 Windows에서 색상을 올바르게 해석하지 않습니다. 다른 페이져가 설치되어 있지 않은 경우, `--paging=never` 하거나 `BAT_PAGER`를 빈 문자열로 설정하여 페이징을 완전히 비활성화 할 수 있습니다 .
|
||||
**참고:** Git과 MSYS 버전의 `less`는 Windows에서 색상을 올바르게 해석하지
|
||||
않습니다.
|
||||
다른 페이저가 설치되어 있지 않은 경우, `--paging=never`을 넘겨주거나
|
||||
`BAT_PAGER`을 빈 문자열로 설정하여 페이징을 완전히 비활성화 할 수 있습니다.
|
||||
|
||||
### Cygwin
|
||||
|
||||
Windows에서의 `bat`은 기본적으로 Cygwin의 unix 스타일의 경로(`/cygdrive/*`)를 지원하지 않습니다. cygwin 절대경로를 인자로 받았을 때, `bat`은 다음과 같이 오류를 반환합니다. `:The system cannot find the path specified. (os error 3)`
|
||||
Windows에서의 `bat`은 기본적으로 Cygwin의 unix 스타일 경로(`/cygdrive/*`)를
|
||||
지원하지 않습니다.
|
||||
Cygwin 절대 경로를 인자로 받았을 때, `bat`은 다음과 같은 오류를 반환합니다:
|
||||
`The system cannot find the path specified. (os error 3)`
|
||||
|
||||
이 경우, wrapper를 만들거나 다음 함수를 `.bash_profile`추가하여 문제를 해결하실 수 있습니다 :
|
||||
이는 wrapper를 만들거나 다음 함수를 `.bash_profile`에 추가하여 해결할 수
|
||||
있습니다:
|
||||
|
||||
```bash
|
||||
bat() {
|
||||
@@ -493,68 +726,94 @@ bat() {
|
||||
}
|
||||
```
|
||||
|
||||
## 트러블슈팅
|
||||
## 문제 해결
|
||||
|
||||
### 터미널과 색상
|
||||
|
||||
`bat`은 터미널 트루컬러 지원 여부와 상관없이 동작합니다. 하지만, 문법 강조 테마의 색상이 8-bit 컬러에는 최적화 되어 있지 않고 있으며, 24-bit 트루컬러 지원하는 터미널 사용하는 것을 적극 권장합니다.(`terminator`, `konsole`, `iTerm2`, ...). [이 글](https://gist.github.com/XVilka/8346728)에서 24-bit 트루컬러 지원하는 터미널들을 찾아보실 수 있습니다.
|
||||
`bat`은 터미널의 트루컬러 지원 여부와 상관 없이 동작합니다.
|
||||
그러나 대부분 문법 강조 테마의 색상은 8비트 색상에 최적화되어 있지 않습니다.
|
||||
따라서 24비트 트루컬러 지원이 되는 터미널(`terminator`, `konsole`, `iTerm2`,
|
||||
...)을 사용하는 것을 적극 권장합니다.
|
||||
트루컬러를 지원하는 터미널들과 더 자세한 정보는
|
||||
[이 글](https://gist.github.com/XVilka/8346728)에서 찾아보실 수 있습니다.
|
||||
|
||||
사용하고 있는 터미널에서 `COLORTERM`을 `truecolor` 혹은
|
||||
`24bit`으로 설정 되어있는지 확인하세요. 만약 아니라면, `bat`은 24-bit escape sequence를 지원되는지 여부를 판단 할 수 없습니다. (그리고 8-bit 색상으로 돌아갑니다.)
|
||||
사용하고 있는 트루컬러 터미널에서 `COLORTERM` 변수를 `truecolor` 혹은
|
||||
`24bit`로 설정되어 있는지 확인하세요.
|
||||
그렇지 않을 경우, `bat`은 24비트 확장열(escape sequence)이 지원되는지 여부를
|
||||
판단할 수 없습니다 (그리고 8비트 색상을 사용합니다).
|
||||
|
||||
### 라인 숫자와 눈금이 잘 보이지 않는 경우
|
||||
### 줄 번호와 격자가 잘 보이지 않는 경우
|
||||
|
||||
다른 테마를 사용해 보세요. (`bat --list-themes`에서 테마들을 확인해 볼 수 있습니다.) `OneHalfDark` 과 `OneHalfLight` 테마는 눈금과 선의 색을 밝게 합니다.
|
||||
다른 테마를 사용해 보세요 (`bat --list-themes`에서 목록을 볼 수 있습니다).
|
||||
`OneHalfDark`와 `OneHalfLight` 테마는 더 밝은 눈금과 선의 색상을 사용합니다.
|
||||
|
||||
### 파일 인코딩
|
||||
|
||||
`bat`은 기본적으로 UTF-8과 UTF-8을 제공합니다. 다른 파일 인코딩의 경우, 자동 감지 되지 않으므로 UTF-8로 먼저 변환해 주어야 합니다. 이렇게 할 때, `iconv`를 사용 할 수 있습니다. 예를 들어, Latin-1 (ISO-8859-1)로 인코딩된 PHP파일이라면 다음과 같이 사용할 수 있습니다.:
|
||||
`bat`은 기본적으로 UTF-8과 UTF-16을 지원합니다.
|
||||
다른 모든 종류의 파일 인코딩에 대해서는, 일반적으로 인코딩을 자동으로 판별하는
|
||||
방법이 없기 때문에 먼저 UTF-8으로 변환해야 할 수 있습니다.
|
||||
이를 위해 `iconv`를 사용할 수 있습니다.
|
||||
예시: Latin-1(ISO-8859-1)로 인코딩된 PHP 파일은 다음과 같이 처리할 수 있습니다:
|
||||
``` bash
|
||||
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
||||
```
|
||||
참고: `bat`으로 자동 감지가 되지 않는 경우에는 `-l`/`--language` 옵션을 사용할 수도 있습니다.
|
||||
참고: `bat`으로 문법 자동 감지가 되지 않는 경우에는 `-l`/`--language` 옵션을
|
||||
사용할 수 있습니다.
|
||||
|
||||
## 배포
|
||||
## 개발
|
||||
|
||||
```bash
|
||||
# Recursive clone to retrieve all submodules
|
||||
# 모든 서브모듈을 받기 위해 재귀적으로 복제하기
|
||||
git clone --recursive https://github.com/sharkdp/bat
|
||||
|
||||
# Build (debug version)
|
||||
# (디버그 버전) 빌드
|
||||
cd bat
|
||||
cargo build --bins
|
||||
|
||||
# Run unit tests and integration tests
|
||||
# 단위 테스트와 통합 테스트 실행
|
||||
cargo test
|
||||
|
||||
# Install (release version)
|
||||
# (배포 버전) 설치
|
||||
cargo install --locked
|
||||
|
||||
# Build a bat binary with modified syntaxes and themes
|
||||
# 수정된 문법과 테마가 적용된 bat 바이너리 빌드
|
||||
bash assets/create.sh
|
||||
cargo install --locked --force
|
||||
```
|
||||
|
||||
`bat`의 pretty-printing 기능을 라이브러리로 사용하는 애플리케이션을 만들고
|
||||
싶다면, [API 문서](https://docs.rs/bat/)를 살펴보세요.
|
||||
참고로 `bat`에 라이브러리로써 의존한다면, `regex-onig`나 `regex-fancy`를
|
||||
기능으로 사용해야 합니다.
|
||||
|
||||
## 기여하기
|
||||
|
||||
[`CONTRIBUTING.md`](../CONTRIBUTING.md) 가이드를 살펴보세요.
|
||||
|
||||
## 메인테이너들
|
||||
|
||||
- [sharkdp](https://github.com/sharkdp)
|
||||
- [eth-p](https://github.com/eth-p)
|
||||
- [keith-hall](https://github.com/keith-hall)
|
||||
- [Enselic](https://github.com/Enselic)
|
||||
|
||||
## 프로젝트 목표와 대안들
|
||||
|
||||
`bat`은 아래와 같은 목표를 달성하려고 합니다:
|
||||
`bat`은 다음과 같은 목표를 달성하려고 합니다:
|
||||
|
||||
- 아름답고 발전된 문법 강조 기능
|
||||
- Git 연동을 통한 파일 수정 내역 확인
|
||||
- (POSIX)`cat`의 대체제
|
||||
- 사용자 친화적인 CLI 제공
|
||||
- 아름답고 발전된 문법 강조 기능 제공
|
||||
- Git과의 연동을 통한 파일 변경 내용 확인
|
||||
- (POSIX) `cat`의 대체제
|
||||
- 사용자 친화적인 커맨드 라인 인터페이스 제공
|
||||
|
||||
|
||||
비슷한 프로그램들을 찾고 있다면, 많은 대안들이 있습니다. 비교는 [이 문서]((doc/alternatives.md))를 참조해주세요.
|
||||
비슷한 프로그램들을 찾고 있다면 많은 대안들이 있습니다.
|
||||
비교는 [이 문서](../doc/alternatives.md)를 참조해 주세요.
|
||||
|
||||
## 라이센스
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat`는 MIT 라이센스 및 Apache 라이센스 2.0의 조건에 따라 배포됩니다.
|
||||
`bat`는 여러분의 선택에 따라 MIT 라이센스 또는 Apache 라이센스 2.0의 조건에 따라
|
||||
배포됩니다.
|
||||
|
||||
라이센스 세부사항은 [LICENSE-APACHE](LICENSE-APACHE)와 [LICENSE-MIT](LICENSE-MIT)를 참조하세요.
|
||||
라이센스의 세부사항은 [LICENSE-APACHE](../LICENSE-APACHE)와
|
||||
[LICENSE-MIT](../LICENSE-MIT)를 참조하세요.
|
||||
|
@@ -185,7 +185,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # измените архитектуру и версию
|
||||
sudo dpkg -i bat_0.18.2_amd64.deb # измените архитектуру и версию
|
||||
```
|
||||
|
||||
### Alpine Linux
|
||||
@@ -341,7 +341,7 @@ ansible-galaxy install aeimer.install_bat
|
||||
|
||||
### Из исходников
|
||||
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.42 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.45 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
@@ -434,11 +434,11 @@ export BAT_PAGER="less -RF"
|
||||
`-R`/`--RAW-CONTROL-CHARS`,
|
||||
`-F`/`--quit-if-one-screen` и `-X`/`--no-init`. Последний флаг(`-X`) используется только для `less`, чья версия раньше 530.
|
||||
|
||||
Флаг `-R` нужен чтобы корректно воспроизвести ANSI цвета. Второй флаг (`-F`) говорит
|
||||
Флаг `-R` нужен чтобы корректно воспроизвести ANSI цвета. Второй флаг (`-F`) говорит
|
||||
`less` чтобы тот сразу же завершился, если размер вывода меньше чем вертикальный размер терминала.
|
||||
Это удобно для небольших файлов, так как вам не надо каждый раз нажимать `q`, чтобы выйти из пейджера. Третий флаг (`-X`) нужен для того, чтобы исправить баг с `--quit-if-one-screen` в старых версиях `less`. К сожалению, это блокирует возможность использования колеса мышки.
|
||||
|
||||
Если вы хотите все же его включить, вы можете добавить флаг `-R`.
|
||||
Если вы хотите все же его включить, вы можете добавить флаг `-R`.
|
||||
Для `less` новее чем 530 оно должно работать из коробки.
|
||||
|
||||
### Темная тема
|
||||
@@ -499,7 +499,7 @@ Windows поддерживает только очень простой пейд
|
||||
### Цвета
|
||||
|
||||
Windows 10 поддерживает цвета и в `conhost.exe` (Command Prompt), и в PowerShell начиная с версии Windows
|
||||
[v1511](https://ru.wikipedia.org/wiki/Windows_10#Обновления и поддержка), так же как и в bash. На ранних версиях Windows вы можете использовать
|
||||
[v1511](https://ru.wikipedia.org/wiki/Windows_10#Обновления и поддержка), так же как и в bash. На ранних версиях Windows вы можете использовать
|
||||
[Cmder](http://cmder.net/), в котором есть [ConEmu](https://conemu.github.io/).
|
||||
|
||||
**Внимание:** Версия `less` в Git и MSYS2 воспроизводит цвета некорректно. Если у вас нет других пейджеров, мы можете отключить использование пейджеров с помощью флага `--paging=never`
|
||||
@@ -587,7 +587,7 @@ cargo install --locked --force
|
||||
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||
|
||||
## Лицензия
|
||||
Copyright (c) 2018-2020 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||
|
||||
|
@@ -9,7 +9,9 @@ in the `.sublime-syntax` format.
|
||||
**Important:** Before proceeding, verify that the syntax you wish to add meets the [criteria for inclusion](#Criteria-for-inclusion-of-new-syntaxes).
|
||||
|
||||
1. Find a Sublime Text syntax for the given language, preferably in a separate Git repository
|
||||
which can be included as a submodule (under `assets/syntaxes`).
|
||||
which can be included as a submodule (under `assets/syntaxes`) using
|
||||
`git submodule add <https github link> ./assets/syntaxes/02_Extra/<repo name>`, replacing
|
||||
the contents of the angle brackets as appropriate.
|
||||
|
||||
2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
|
||||
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
|
||||
@@ -26,7 +28,8 @@ in the `.sublime-syntax` format.
|
||||
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
|
||||
|
||||
7. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
||||
file. A new binary cache file will be created once before every new release of `bat`.
|
||||
file. A new binary cache file will be created once before every new release of `bat`. This
|
||||
avoids bloating the repository size unnecessarily.
|
||||
|
||||
### Syntax tests
|
||||
|
||||
@@ -68,7 +71,7 @@ themes (`bat cache --clear`).
|
||||
|
||||
## Criteria for inclusion of new syntaxes
|
||||
|
||||
* More than 10,000 downloads on packagecontrol.io/
|
||||
* More than 10,000 downloads at [Package Control](https://packagecontrol.io)
|
||||
|
||||
### Manual modifications
|
||||
|
||||
|
58
doc/release-checklist.md
Normal file
58
doc/release-checklist.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Release checklist
|
||||
|
||||
## Dependencies
|
||||
|
||||
See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
|
||||
|
||||
- [ ] Optional: update dependencies with `cargo update`. This is also done by
|
||||
dependabot, so it is not strictly necessary.
|
||||
- [ ] Check for outdated dependencies (`cargo outdated`) and decide for each of
|
||||
them whether we want to (manually) upgrade. This will require changes to
|
||||
`Cargo.toml`.
|
||||
|
||||
## Version bump
|
||||
|
||||
- [ ] Update version in `Cargo.toml`. Run `cargo build` to update `Cargo.lock`.
|
||||
Make sure to `git add` the `Cargo.lock` changes as well.
|
||||
- [ ] Find the current min. supported Rust version by running
|
||||
`grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
|
||||
- [ ] Update the version and the min. supported Rust version in `README.md` and
|
||||
`doc/README-*.md`.
|
||||
- [ ] Update `CHANGELOG.md`. Introduce a section for the new release and
|
||||
prepare a new (empty) "unreleased" section at the top.
|
||||
|
||||
## Update syntaxes and themes (build assets)
|
||||
|
||||
- [ ] Install the latest master version (`cargo install -f --path .`) and make
|
||||
sure that it is available on the `PATH` (`bat --version` should show the
|
||||
new version).
|
||||
- [ ] Run `assets/create.sh` and check in the binary asset files.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [ ] Review the `-h` and `--help` texts
|
||||
- [ ] Review the `man` page
|
||||
|
||||
## Pre-release checks
|
||||
|
||||
- [ ] Push all changes and wait for CI to succeed (before continuing with the
|
||||
next section).
|
||||
- [ ] Optional: manually test the new features and command-line options. To do
|
||||
this, install the latest `bat` version again (to include the new synaxes
|
||||
and themes).
|
||||
- [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
|
||||
succeed later (after creating the GitHub release).
|
||||
|
||||
## Release
|
||||
|
||||
- [ ] Create a tag and push it to the remote `git tag vX.Y.Z; git push --tags`.
|
||||
This will trigger the deployment via GitHub Actions.
|
||||
- [ ] Go to https://github.com/sharkdp/bat/releases/new to create the new
|
||||
release. Select the new tag and also use it as the release title. For the
|
||||
release notes, copy the corresponding section from `CHANGELOG.md` and
|
||||
possibly add additional remarks for package maintainers.
|
||||
Publish the release.
|
||||
- [ ] Check if the binary deployment works (archives and Debian packages should
|
||||
appear when the CI run for the Git tag has finished).
|
||||
- [ ] Publish to crates.io by running `cargo publish` in a *clean* repository.
|
||||
The safest way to do this is to clone a fresh copy.
|
445
src/assets.rs
445
src/assets.rs
@@ -1,16 +1,15 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::{self, File};
|
||||
use std::io::BufReader;
|
||||
use std::path::Path;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use syntect::dumps::{dump_to_file, from_binary, from_reader};
|
||||
use lazycell::LazyCell;
|
||||
|
||||
use syntect::dumps::{from_binary, from_reader};
|
||||
use syntect::highlighting::{Theme, ThemeSet};
|
||||
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
||||
use syntect::parsing::{SyntaxReference, SyntaxSet};
|
||||
|
||||
use path_abs::PathAbs;
|
||||
|
||||
use crate::assets_metadata::AssetsMetadata;
|
||||
use crate::bat_warning;
|
||||
use crate::error::*;
|
||||
use crate::input::{InputReader, OpenedInput, OpenedInputKind};
|
||||
@@ -18,23 +17,66 @@ use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HighlightingAssets {
|
||||
pub(crate) syntax_set: SyntaxSet,
|
||||
pub(crate) theme_set: ThemeSet,
|
||||
syntax_set_cell: LazyCell<SyntaxSet>,
|
||||
serialized_syntax_set: Option<SerializedSyntaxSet>,
|
||||
theme_set: ThemeSet,
|
||||
fallback_theme: Option<&'static str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SyntaxReferenceInSet<'a> {
|
||||
pub syntax: &'a SyntaxReference,
|
||||
pub syntax_set: &'a SyntaxSet,
|
||||
}
|
||||
|
||||
const IGNORED_SUFFIXES: [&str; 10] = [
|
||||
// Editor etc backups
|
||||
"~",
|
||||
".bak",
|
||||
".old",
|
||||
".orig",
|
||||
// Debian and derivatives apt/dpkg backups
|
||||
".dpkg-dist",
|
||||
".dpkg-old",
|
||||
// Red Hat and derivatives rpm backups
|
||||
".rpmnew",
|
||||
".rpmorig",
|
||||
".rpmsave",
|
||||
// Build system input/template files
|
||||
".in",
|
||||
];
|
||||
|
||||
impl HighlightingAssets {
|
||||
fn new(
|
||||
syntax_set: Option<SyntaxSet>,
|
||||
serialized_syntax_set: Option<SerializedSyntaxSet>,
|
||||
theme_set: ThemeSet,
|
||||
) -> Self {
|
||||
assert!(syntax_set.is_some() || serialized_syntax_set.is_some());
|
||||
|
||||
let syntax_set_cell = LazyCell::new();
|
||||
if let Some(syntax_set) = syntax_set {
|
||||
syntax_set_cell.fill(syntax_set).expect("can never fail");
|
||||
}
|
||||
|
||||
HighlightingAssets {
|
||||
syntax_set_cell,
|
||||
serialized_syntax_set,
|
||||
theme_set,
|
||||
fallback_theme: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_theme() -> &'static str {
|
||||
"Monokai Extended"
|
||||
}
|
||||
|
||||
#[cfg(feature = "build-assets")]
|
||||
pub fn from_files(source_dir: &Path, include_integrated_assets: bool) -> Result<Self> {
|
||||
let mut theme_set = if include_integrated_assets {
|
||||
Self::get_integrated_themeset()
|
||||
get_integrated_themeset()
|
||||
} else {
|
||||
ThemeSet {
|
||||
themes: BTreeMap::new(),
|
||||
}
|
||||
ThemeSet::new()
|
||||
};
|
||||
|
||||
let theme_dir = source_dir.join("themes");
|
||||
@@ -55,11 +97,11 @@ impl HighlightingAssets {
|
||||
}
|
||||
|
||||
let mut syntax_set_builder = if !include_integrated_assets {
|
||||
let mut builder = SyntaxSetBuilder::new();
|
||||
let mut builder = syntect::parsing::SyntaxSetBuilder::new();
|
||||
builder.add_plain_text_syntax();
|
||||
builder
|
||||
} else {
|
||||
Self::get_integrated_syntaxset().into_builder()
|
||||
from_binary::<SyntaxSet>(get_serialized_integrated_syntaxset()).into_builder()
|
||||
};
|
||||
|
||||
let syntax_dir = source_dir.join("syntaxes");
|
||||
@@ -72,95 +114,63 @@ impl HighlightingAssets {
|
||||
);
|
||||
}
|
||||
|
||||
Ok(HighlightingAssets {
|
||||
syntax_set: syntax_set_builder.build(),
|
||||
theme_set,
|
||||
fallback_theme: None,
|
||||
})
|
||||
if std::env::var("BAT_PRINT_SYNTAX_DEPENDENCIES").is_ok() {
|
||||
// To trigger this code, run:
|
||||
// BAT_PRINT_SYNTAX_DEPENDENCIES=1 cargo run -- cache --build --source assets --blank --target /tmp
|
||||
crate::syntax_dependencies::print_syntax_dependencies(&syntax_set_builder);
|
||||
}
|
||||
|
||||
let syntax_set = syntax_set_builder.build();
|
||||
let missing_contexts = syntax_set.find_unlinked_contexts();
|
||||
if !missing_contexts.is_empty() {
|
||||
println!("Some referenced contexts could not be found!");
|
||||
for context in missing_contexts {
|
||||
println!("- {}", context);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(HighlightingAssets::new(Some(syntax_set), None, theme_set))
|
||||
}
|
||||
|
||||
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
||||
let syntax_set_path = cache_path.join("syntaxes.bin");
|
||||
let theme_set_path = cache_path.join("themes.bin");
|
||||
|
||||
let syntax_set_file = File::open(&syntax_set_path).chain_err(|| {
|
||||
format!(
|
||||
"Could not load cached syntax set '{}'",
|
||||
syntax_set_path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
let syntax_set: SyntaxSet = from_reader(BufReader::new(syntax_set_file))
|
||||
.chain_err(|| "Could not parse cached syntax set")?;
|
||||
|
||||
let theme_set_file = File::open(&theme_set_path).chain_err(|| {
|
||||
format!(
|
||||
"Could not load cached theme set '{}'",
|
||||
theme_set_path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
let theme_set: ThemeSet = from_reader(BufReader::new(theme_set_file))
|
||||
.chain_err(|| "Could not parse cached theme set")?;
|
||||
|
||||
Ok(HighlightingAssets {
|
||||
syntax_set,
|
||||
theme_set,
|
||||
fallback_theme: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn get_integrated_syntaxset() -> SyntaxSet {
|
||||
from_binary(include_bytes!("../assets/syntaxes.bin"))
|
||||
}
|
||||
|
||||
fn get_integrated_themeset() -> ThemeSet {
|
||||
from_binary(include_bytes!("../assets/themes.bin"))
|
||||
Ok(HighlightingAssets::new(
|
||||
None,
|
||||
Some(SerializedSyntaxSet::FromFile(
|
||||
cache_path.join("syntaxes.bin"),
|
||||
)),
|
||||
asset_from_cache(&cache_path.join("themes.bin"), "theme set")?,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn from_binary() -> Self {
|
||||
let syntax_set = Self::get_integrated_syntaxset();
|
||||
let theme_set = Self::get_integrated_themeset();
|
||||
|
||||
HighlightingAssets {
|
||||
syntax_set,
|
||||
theme_set,
|
||||
fallback_theme: None,
|
||||
}
|
||||
HighlightingAssets::new(
|
||||
None,
|
||||
Some(SerializedSyntaxSet::FromBinary(
|
||||
get_serialized_integrated_syntaxset(),
|
||||
)),
|
||||
get_integrated_themeset(),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(feature = "build-assets")]
|
||||
pub fn save_to_cache(&self, target_dir: &Path, current_version: &str) -> Result<()> {
|
||||
let _ = fs::create_dir_all(target_dir);
|
||||
let theme_set_path = target_dir.join("themes.bin");
|
||||
let syntax_set_path = target_dir.join("syntaxes.bin");
|
||||
|
||||
print!(
|
||||
"Writing theme set to {} ... ",
|
||||
theme_set_path.to_string_lossy()
|
||||
);
|
||||
dump_to_file(&self.theme_set, &theme_set_path).chain_err(|| {
|
||||
format!(
|
||||
"Could not save theme set to {}",
|
||||
theme_set_path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
println!("okay");
|
||||
|
||||
print!(
|
||||
"Writing syntax set to {} ... ",
|
||||
syntax_set_path.to_string_lossy()
|
||||
);
|
||||
dump_to_file(&self.syntax_set, &syntax_set_path).chain_err(|| {
|
||||
format!(
|
||||
"Could not save syntax set to {}",
|
||||
syntax_set_path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
println!("okay");
|
||||
asset_to_cache(
|
||||
self.get_theme_set(),
|
||||
&target_dir.join("themes.bin"),
|
||||
"theme set",
|
||||
)?;
|
||||
asset_to_cache(
|
||||
self.get_syntax_set()?,
|
||||
&target_dir.join("syntaxes.bin"),
|
||||
"syntax set",
|
||||
)?;
|
||||
|
||||
print!(
|
||||
"Writing metadata to folder {} ... ",
|
||||
target_dir.to_string_lossy()
|
||||
);
|
||||
AssetsMetadata::new(current_version).save_to_folder(target_dir)?;
|
||||
crate::assets_metadata::AssetsMetadata::new(current_version).save_to_folder(target_dir)?;
|
||||
println!("okay");
|
||||
|
||||
Ok(())
|
||||
@@ -170,41 +180,85 @@ impl HighlightingAssets {
|
||||
self.fallback_theme = Some(theme);
|
||||
}
|
||||
|
||||
pub(crate) fn get_syntax_set(&self) -> Result<&SyntaxSet> {
|
||||
if !self.syntax_set_cell.filled() {
|
||||
self.syntax_set_cell.fill(
|
||||
self.serialized_syntax_set
|
||||
.as_ref()
|
||||
.expect("a dev forgot to setup serialized_syntax_set, please report to https://github.com/sharkdp/bat/issues")
|
||||
.deserialize()?
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
// It is safe to .unwrap() because we just made sure it was .filled()
|
||||
Ok(self.syntax_set_cell.borrow().unwrap())
|
||||
}
|
||||
|
||||
/// Use [Self::get_syntaxes] instead
|
||||
#[deprecated]
|
||||
pub fn syntaxes(&self) -> &[SyntaxReference] {
|
||||
self.syntax_set.syntaxes()
|
||||
self.get_syntax_set()
|
||||
.expect(".syntaxes() is deprecated, use .get_syntaxes() instead")
|
||||
.syntaxes()
|
||||
}
|
||||
|
||||
pub fn get_syntaxes(&self) -> Result<&[SyntaxReference]> {
|
||||
Ok(self.get_syntax_set()?.syntaxes())
|
||||
}
|
||||
|
||||
fn get_theme_set(&self) -> &ThemeSet {
|
||||
&self.theme_set
|
||||
}
|
||||
|
||||
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||
self.theme_set.themes.keys().map(|s| s.as_ref())
|
||||
self.get_theme_set().themes.keys().map(|s| s.as_ref())
|
||||
}
|
||||
|
||||
/// Use [Self::get_syntax_for_file_name] instead
|
||||
#[deprecated]
|
||||
pub fn syntax_for_file_name(
|
||||
&self,
|
||||
file_name: impl AsRef<Path>,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Option<&SyntaxReference> {
|
||||
self.get_syntax_for_file_name(file_name, mapping)
|
||||
.expect(
|
||||
".syntax_for_file_name() is deprecated, use .get_syntax_for_file_name() instead",
|
||||
)
|
||||
.map(|syntax_in_set| syntax_in_set.syntax)
|
||||
}
|
||||
|
||||
pub fn get_syntax_for_file_name(
|
||||
&self,
|
||||
file_name: impl AsRef<Path>,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let file_name = file_name.as_ref();
|
||||
match mapping.get_syntax_for(file_name) {
|
||||
Ok(match mapping.get_syntax_for(file_name) {
|
||||
Some(MappingTarget::MapToUnknown) => None,
|
||||
Some(MappingTarget::MapTo(syntax_name)) => {
|
||||
self.syntax_set.find_syntax_by_name(syntax_name)
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
syntax_set
|
||||
.find_syntax_by_name(syntax_name)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set })
|
||||
}
|
||||
None => self.get_extension_syntax(file_name.as_os_str()),
|
||||
}
|
||||
None => self.get_extension_syntax(file_name.as_os_str())?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
||||
match self.theme_set.themes.get(theme) {
|
||||
match self.get_theme_set().themes.get(theme) {
|
||||
Some(theme) => theme,
|
||||
None => {
|
||||
if theme == "ansi-light" || theme == "ansi-dark" {
|
||||
bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
|
||||
return self.get_theme("ansi");
|
||||
}
|
||||
if theme != "" {
|
||||
if !theme.is_empty() {
|
||||
bat_warning!("Unknown theme '{}', using default.", theme)
|
||||
}
|
||||
&self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||
&self.get_theme_set().themes
|
||||
[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,13 +268,15 @@ impl HighlightingAssets {
|
||||
language: Option<&str>,
|
||||
input: &mut OpenedInput,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Result<&SyntaxReference> {
|
||||
) -> Result<SyntaxReferenceInSet> {
|
||||
if let Some(language) = language {
|
||||
self.syntax_set
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
syntax_set
|
||||
.find_syntax_by_token(language)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set })
|
||||
.ok_or_else(|| ErrorKind::UnknownSyntax(language.to_owned()).into())
|
||||
} else {
|
||||
let line_syntax = self.get_first_line_syntax(&mut input.reader);
|
||||
let line_syntax = self.get_first_line_syntax(&mut input.reader)?;
|
||||
|
||||
// Get the path of the file:
|
||||
// If this was set by the metadata, that will take priority.
|
||||
@@ -248,14 +304,17 @@ impl HighlightingAssets {
|
||||
ErrorKind::UndetectedSyntax(path.to_string_lossy().into()).into()
|
||||
}),
|
||||
|
||||
Some(MappingTarget::MapTo(syntax_name)) => self
|
||||
.syntax_set
|
||||
.find_syntax_by_name(syntax_name)
|
||||
.ok_or_else(|| ErrorKind::UnknownSyntax(syntax_name.to_owned()).into()),
|
||||
Some(MappingTarget::MapTo(syntax_name)) => {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
syntax_set
|
||||
.find_syntax_by_name(syntax_name)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set })
|
||||
.ok_or_else(|| ErrorKind::UnknownSyntax(syntax_name.to_owned()).into())
|
||||
}
|
||||
|
||||
None => {
|
||||
let file_name = path.file_name().unwrap_or_default();
|
||||
self.get_extension_syntax(file_name)
|
||||
self.get_extension_syntax(file_name)?
|
||||
.or(line_syntax)
|
||||
.ok_or_else(|| {
|
||||
ErrorKind::UndetectedSyntax(path.to_string_lossy().into()).into()
|
||||
@@ -269,24 +328,122 @@ impl HighlightingAssets {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_extension_syntax(&self, file_name: &OsStr) -> Option<&SyntaxReference> {
|
||||
self.syntax_set
|
||||
.find_syntax_by_extension(file_name.to_str().unwrap_or_default())
|
||||
.or_else(|| {
|
||||
self.syntax_set.find_syntax_by_extension(
|
||||
Path::new(file_name)
|
||||
.extension()
|
||||
.and_then(|x| x.to_str())
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
})
|
||||
fn get_extension_syntax(&self, file_name: &OsStr) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let mut syntax = self.find_syntax_by_file_name(file_name)?;
|
||||
if syntax.is_none() {
|
||||
syntax = self.find_syntax_by_file_name_extension(file_name)?;
|
||||
}
|
||||
if syntax.is_none() {
|
||||
syntax = self.get_extension_syntax_with_stripped_suffix(file_name)?;
|
||||
}
|
||||
Ok(syntax)
|
||||
}
|
||||
|
||||
fn get_first_line_syntax(&self, reader: &mut InputReader) -> Option<&SyntaxReference> {
|
||||
String::from_utf8(reader.first_line.clone())
|
||||
.ok()
|
||||
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l))
|
||||
fn find_syntax_by_file_name(&self, file_name: &OsStr) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(syntax_set
|
||||
.find_syntax_by_extension(file_name.to_str().unwrap_or_default())
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
fn find_syntax_by_file_name_extension(
|
||||
&self,
|
||||
file_name: &OsStr,
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let file_path = Path::new(file_name);
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(syntax_set
|
||||
.find_syntax_by_extension(
|
||||
file_path
|
||||
.extension()
|
||||
.and_then(|x| x.to_str())
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
/// If we find an ignored suffix on the file name, e.g. '~', we strip it and
|
||||
/// then try again to find a syntax without it. Note that we do this recursively.
|
||||
fn get_extension_syntax_with_stripped_suffix(
|
||||
&self,
|
||||
file_name: &OsStr,
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let file_path = Path::new(file_name);
|
||||
let mut syntax = None;
|
||||
if let Some(file_str) = file_path.to_str() {
|
||||
for suffix in IGNORED_SUFFIXES.iter() {
|
||||
if let Some(stripped_filename) = file_str.strip_suffix(suffix) {
|
||||
syntax = self.get_extension_syntax(OsStr::new(stripped_filename))?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(syntax)
|
||||
}
|
||||
|
||||
fn get_first_line_syntax(
|
||||
&self,
|
||||
reader: &mut InputReader,
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(String::from_utf8(reader.first_line.clone())
|
||||
.ok()
|
||||
.and_then(|l| syntax_set.find_syntax_by_first_line(&l))
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
}
|
||||
|
||||
/// A SyntaxSet in serialized form, i.e. bincoded and flate2 compressed.
|
||||
/// We keep it in this format since we want to load it lazily.
|
||||
#[derive(Debug)]
|
||||
enum SerializedSyntaxSet {
|
||||
/// The data comes from a user-generated cache file.
|
||||
FromFile(PathBuf),
|
||||
|
||||
/// The data to use is embedded into the bat binary.
|
||||
FromBinary(&'static [u8]),
|
||||
}
|
||||
|
||||
impl SerializedSyntaxSet {
|
||||
fn deserialize(&self) -> Result<SyntaxSet> {
|
||||
match self {
|
||||
SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data)),
|
||||
SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(path, "syntax set"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_serialized_integrated_syntaxset() -> &'static [u8] {
|
||||
include_bytes!("../assets/syntaxes.bin")
|
||||
}
|
||||
|
||||
fn get_integrated_themeset() -> ThemeSet {
|
||||
from_binary(include_bytes!("../assets/themes.bin"))
|
||||
}
|
||||
|
||||
#[cfg(feature = "build-assets")]
|
||||
fn asset_to_cache<T: serde::Serialize>(asset: &T, path: &Path, description: &str) -> Result<()> {
|
||||
print!("Writing {} to {} ... ", description, path.to_string_lossy());
|
||||
syntect::dumps::dump_to_file(asset, &path).chain_err(|| {
|
||||
format!(
|
||||
"Could not save {} to {}",
|
||||
description,
|
||||
path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
println!("okay");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn asset_from_cache<T: serde::de::DeserializeOwned>(path: &Path, description: &str) -> Result<T> {
|
||||
let contents = fs::read(path).chain_err(|| {
|
||||
format!(
|
||||
"Could not load cached {} '{}'",
|
||||
description,
|
||||
path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
from_reader(&contents[..]).chain_err(|| format!("Could not parse cached {}", description))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -296,7 +453,7 @@ mod tests {
|
||||
use std::ffi::OsStr;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::io::{BufReader, Write};
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::input::Input;
|
||||
@@ -316,6 +473,18 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_syntax_name(
|
||||
&self,
|
||||
language: Option<&str>,
|
||||
input: &mut OpenedInput,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> String {
|
||||
self.assets
|
||||
.get_syntax(language, input, mapping)
|
||||
.map(|syntax_in_set| syntax_in_set.syntax.name.clone())
|
||||
.unwrap_or_else(|_| "!no syntax!".to_owned())
|
||||
}
|
||||
|
||||
fn syntax_for_real_file_with_content_os(
|
||||
&self,
|
||||
file_name: &OsStr,
|
||||
@@ -327,29 +496,21 @@ mod tests {
|
||||
writeln!(temp_file, "{}", first_line).unwrap();
|
||||
}
|
||||
|
||||
let input = Input::ordinary_file(file_path.as_os_str());
|
||||
let input = Input::ordinary_file(&file_path);
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
self.assets
|
||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
||||
.name
|
||||
.clone()
|
||||
self.get_syntax_name(None, &mut opened_input, &self.syntax_mapping)
|
||||
}
|
||||
|
||||
fn syntax_for_file_with_content_os(&self, file_name: &OsStr, first_line: &str) -> String {
|
||||
let file_path = self.temp_dir.path().join(file_name);
|
||||
let input = Input::from_reader(Box::new(BufReader::new(first_line.as_bytes())))
|
||||
.with_name(Some(file_path.as_os_str()));
|
||||
.with_name(Some(&file_path));
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
self.assets
|
||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
||||
.name
|
||||
.clone()
|
||||
self.get_syntax_name(None, &mut opened_input, &self.syntax_mapping)
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
@@ -366,14 +527,10 @@ mod tests {
|
||||
}
|
||||
|
||||
fn syntax_for_stdin_with_content(&self, file_name: &str, content: &[u8]) -> String {
|
||||
let input = Input::stdin().with_name(Some(OsStr::new(file_name)));
|
||||
let input = Input::stdin().with_name(Some(file_name));
|
||||
let mut opened_input = input.open(content, None).unwrap();
|
||||
|
||||
self.assets
|
||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
||||
.name
|
||||
.clone()
|
||||
self.get_syntax_name(None, &mut opened_input, &self.syntax_mapping)
|
||||
}
|
||||
|
||||
fn syntax_is_same_for_inputkinds(&self, file_name: &str, content: &str) -> bool {
|
||||
@@ -450,6 +607,7 @@ mod tests {
|
||||
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
||||
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
||||
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
||||
assert_eq!(test.syntax_for_file("test.v"), "Verilog");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -521,15 +679,12 @@ mod tests {
|
||||
.expect("creation of directory succeeds");
|
||||
symlink(&file_path, &file_path_symlink).expect("creation of symbolic link succeeds");
|
||||
|
||||
let input = Input::ordinary_file(file_path_symlink.as_os_str());
|
||||
let input = Input::ordinary_file(&file_path_symlink);
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
test.assets
|
||||
.get_syntax(None, &mut opened_input, &test.syntax_mapping)
|
||||
.unwrap_or_else(|_| test.assets.syntax_set.find_syntax_plain_text())
|
||||
.name,
|
||||
test.get_syntax_name(None, &mut opened_input, &test.syntax_mapping),
|
||||
"SSH Config"
|
||||
);
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ pub struct AssetsMetadata {
|
||||
const FILENAME: &str = "metadata.yaml";
|
||||
|
||||
impl AssetsMetadata {
|
||||
#[cfg(feature = "build-assets")]
|
||||
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
|
||||
AssetsMetadata {
|
||||
bat_version: Some(current_version.to_owned()),
|
||||
@@ -23,6 +24,7 @@ impl AssetsMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "build-assets")]
|
||||
pub(crate) fn save_to_folder(&self, path: &Path) -> Result<()> {
|
||||
let file = File::create(path.join(FILENAME))?;
|
||||
serde_yaml::to_writer(file, self)?;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use atty::{self, Stream};
|
||||
@@ -158,7 +158,7 @@ impl App {
|
||||
WrappingMode::Character
|
||||
}
|
||||
}
|
||||
_ => unreachable!("other values for --paging are not allowed"),
|
||||
_ => unreachable!("other values for --wrap are not allowed"),
|
||||
}
|
||||
} else {
|
||||
// We don't have the tty width when piping to another program.
|
||||
@@ -234,6 +234,7 @@ impl App {
|
||||
.map(LineRanges::from)
|
||||
.map(HighlightedLineRanges)
|
||||
.unwrap_or_default(),
|
||||
use_custom_assets: !self.matches.is_present("no-custom-assets"),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -248,16 +249,19 @@ impl App {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let filenames: Option<Vec<&str>> = self
|
||||
let filenames: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.values_of("file-name")
|
||||
.map(|values| values.collect());
|
||||
.values_of_os("file-name")
|
||||
.map(|values| values.map(Path::new).collect());
|
||||
|
||||
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
||||
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
||||
let mut filenames_or_none: Box<dyn Iterator<Item = Option<&Path>>> = match filenames {
|
||||
Some(filenames) => Box::new(filenames.into_iter().map(Some)),
|
||||
None => Box::new(std::iter::repeat(None)),
|
||||
};
|
||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||
let files: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.values_of_os("FILE")
|
||||
.map(|vs| vs.map(Path::new).collect());
|
||||
|
||||
if files.is_none() {
|
||||
return Ok(vec![new_stdin_input(
|
||||
@@ -297,7 +301,7 @@ impl App {
|
||||
.map(|style_str| {
|
||||
style_str
|
||||
.split(',')
|
||||
.map(|x| StyleComponent::from_str(&x))
|
||||
.map(|x| StyleComponent::from_str(x))
|
||||
.collect::<Result<Vec<StyleComponent>>>()
|
||||
})
|
||||
.transpose()?;
|
||||
|
@@ -18,26 +18,14 @@ pub fn cache_dir() -> Cow<'static, str> {
|
||||
}
|
||||
|
||||
pub fn clear_assets() {
|
||||
let theme_set_path = PROJECT_DIRS.cache_dir().join("themes.bin");
|
||||
let syntax_set_path = PROJECT_DIRS.cache_dir().join("syntaxes.bin");
|
||||
let metadata_file = PROJECT_DIRS.cache_dir().join("metadata.yaml");
|
||||
|
||||
print!("Clearing theme set cache ... ");
|
||||
fs::remove_file(theme_set_path).ok();
|
||||
println!("okay");
|
||||
|
||||
print!("Clearing syntax set cache ... ");
|
||||
fs::remove_file(syntax_set_path).ok();
|
||||
println!("okay");
|
||||
|
||||
print!("Clearing metadata file ... ");
|
||||
fs::remove_file(metadata_file).ok();
|
||||
println!("okay");
|
||||
clear_asset("themes.bin", "theme set cache");
|
||||
clear_asset("syntaxes.bin", "syntax set cache");
|
||||
clear_asset("metadata.yaml", "metadata file");
|
||||
}
|
||||
|
||||
pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
||||
pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<HighlightingAssets> {
|
||||
let cache_dir = PROJECT_DIRS.cache_dir();
|
||||
if let Some(metadata) = AssetsMetadata::load_from_folder(&cache_dir)? {
|
||||
if let Some(metadata) = AssetsMetadata::load_from_folder(cache_dir)? {
|
||||
if !metadata.is_compatible_with(crate_version!()) {
|
||||
return Err(format!(
|
||||
"The binary caches for the user-customized syntaxes and themes \
|
||||
@@ -53,6 +41,16 @@ pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(HighlightingAssets::from_cache(&cache_dir)
|
||||
.unwrap_or_else(|_| HighlightingAssets::from_binary()))
|
||||
let custom_assets = if use_custom_assets {
|
||||
HighlightingAssets::from_cache(cache_dir).ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Ok(custom_assets.unwrap_or_else(HighlightingAssets::from_binary))
|
||||
}
|
||||
|
||||
fn clear_asset(filename: &str, description: &str) {
|
||||
print!("Clearing {} ... ", description);
|
||||
fs::remove_file(PROJECT_DIRS.cache_dir().join(filename)).ok();
|
||||
println!("okay");
|
||||
}
|
||||
|
@@ -294,6 +294,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.arg(
|
||||
Arg::with_name("no-paging")
|
||||
.short("P")
|
||||
.long("no-paging")
|
||||
.alias("no-pager")
|
||||
.overrides_with("no-paging")
|
||||
.hidden(true)
|
||||
@@ -394,8 +395,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
'--style=\"..\"' option to the configuration file or export the \
|
||||
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
|
||||
Possible values:\n\n \
|
||||
* full: enables all available components.\n \
|
||||
* auto: same as 'full', unless the output is piped (default).\n \
|
||||
* full: enables all available components (default).\n \
|
||||
* auto: same as 'full', unless the output is piped.\n \
|
||||
* plain: disables all available components.\n \
|
||||
* changes: show Git modification markers.\n \
|
||||
* header: show filenames before the content.\n \
|
||||
@@ -450,6 +451,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.hidden(true)
|
||||
.help("Do not use the configuration file"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("no-custom-assets")
|
||||
.long("no-custom-assets")
|
||||
.hidden(true)
|
||||
.help("Do not load custom assets"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("config-file")
|
||||
.long("config-file")
|
||||
|
@@ -4,8 +4,9 @@ use std::path::{Path, PathBuf};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
||||
/// This means that the `XDG_CACHE_HOME` and `XDG_CONFIG_HOME` environment variables are
|
||||
/// checked first. The fallback directories are `~/.cache/bat` and `~/.config/bat`, respectively.
|
||||
/// The `XDG_CACHE_HOME` environment variable is checked first. `BAT_CONFIG_DIR`
|
||||
/// is then checked before the `XDG_CONFIG_HOME` environment variable.
|
||||
/// The fallback directories are `~/.cache/bat` and `~/.config/bat`, respectively.
|
||||
pub struct BatProjectDirs {
|
||||
cache_dir: PathBuf,
|
||||
config_dir: PathBuf,
|
||||
@@ -15,16 +16,23 @@ impl BatProjectDirs {
|
||||
fn new() -> Option<BatProjectDirs> {
|
||||
let cache_dir = BatProjectDirs::get_cache_dir()?;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let config_dir_op = env::var_os("XDG_CONFIG_HOME")
|
||||
.map(PathBuf::from)
|
||||
.filter(|p| p.is_absolute())
|
||||
.or_else(|| dirs_next::home_dir().map(|d| d.join(".config")));
|
||||
// Checks whether or not $BAT_CONFIG_DIR exists. If it doesn't, set our config dir
|
||||
// to our system's default configuration home.
|
||||
let config_dir =
|
||||
if let Some(config_dir_op) = env::var_os("BAT_CONFIG_DIR").map(PathBuf::from) {
|
||||
config_dir_op
|
||||
} else {
|
||||
#[cfg(target_os = "macos")]
|
||||
let config_dir_op = env::var_os("XDG_CONFIG_HOME")
|
||||
.map(PathBuf::from)
|
||||
.filter(|p| p.is_absolute())
|
||||
.or_else(|| dirs_next::home_dir().map(|d| d.join(".config")));
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let config_dir_op = dirs_next::config_dir();
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let config_dir_op = dirs_next::config_dir();
|
||||
|
||||
let config_dir = config_dir_op.map(|d| d.join("bat"))?;
|
||||
config_dir_op.map(|d| d.join("bat"))?
|
||||
};
|
||||
|
||||
Some(BatProjectDirs {
|
||||
cache_dir,
|
||||
|
@@ -1,15 +1,15 @@
|
||||
use bat::input::Input;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
|
||||
pub fn new_file_input<'a>(file: &'a Path, name: Option<&'a Path>) -> Input<'a> {
|
||||
named(Input::ordinary_file(file), name.or(Some(file)))
|
||||
}
|
||||
|
||||
pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
|
||||
pub fn new_stdin_input(name: Option<&Path>) -> Input {
|
||||
named(Input::stdin(), name)
|
||||
}
|
||||
|
||||
fn named<'a>(input: Input<'a>, name: Option<&OsStr>) -> Input<'a> {
|
||||
fn named<'a>(input: Input<'a>, name: Option<&Path>) -> Input<'a> {
|
||||
if let Some(provided_name) = name {
|
||||
let mut input = input.with_name(Some(provided_name));
|
||||
input.description_mut().set_kind(Some("File".to_owned()));
|
||||
|
@@ -9,7 +9,6 @@ mod directories;
|
||||
mod input;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::{BufReader, Write};
|
||||
use std::path::Path;
|
||||
@@ -24,12 +23,10 @@ use crate::{
|
||||
};
|
||||
|
||||
use assets::{assets_from_cache_or_binary, cache_dir, clear_assets, config_dir};
|
||||
use clap::crate_version;
|
||||
use directories::PROJECT_DIRS;
|
||||
use globset::GlobMatcher;
|
||||
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
config::Config,
|
||||
controller::Controller,
|
||||
error::*,
|
||||
@@ -40,21 +37,29 @@ use bat::{
|
||||
|
||||
const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.rs");
|
||||
|
||||
#[cfg(feature = "build-assets")]
|
||||
fn build_assets(matches: &clap::ArgMatches) -> Result<()> {
|
||||
let source_dir = matches
|
||||
.value_of("source")
|
||||
.map(Path::new)
|
||||
.unwrap_or_else(|| PROJECT_DIRS.config_dir());
|
||||
let target_dir = matches
|
||||
.value_of("target")
|
||||
.map(Path::new)
|
||||
.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
||||
|
||||
let blank = matches.is_present("blank");
|
||||
|
||||
let assets = bat::assets::HighlightingAssets::from_files(source_dir, !blank)?;
|
||||
assets.save_to_cache(target_dir, clap::crate_version!())
|
||||
}
|
||||
|
||||
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
||||
if matches.is_present("build") {
|
||||
let source_dir = matches
|
||||
.value_of("source")
|
||||
.map(Path::new)
|
||||
.unwrap_or_else(|| PROJECT_DIRS.config_dir());
|
||||
let target_dir = matches
|
||||
.value_of("target")
|
||||
.map(Path::new)
|
||||
.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
||||
|
||||
let blank = matches.is_present("blank");
|
||||
|
||||
let assets = HighlightingAssets::from_files(source_dir, !blank)?;
|
||||
assets.save_to_cache(target_dir, crate_version!())?;
|
||||
#[cfg(feature = "build-assets")]
|
||||
build_assets(matches)?;
|
||||
#[cfg(not(feature = "build-assets"))]
|
||||
println!("bat has been built without the 'build-assets' feature. The 'cache --build' option is not available.");
|
||||
} else if matches.is_present("clear") {
|
||||
clear_assets();
|
||||
}
|
||||
@@ -81,9 +86,9 @@ fn get_syntax_mapping_to_paths<'a>(
|
||||
pub fn get_languages(config: &Config) -> Result<String> {
|
||||
let mut result: String = String::new();
|
||||
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
|
||||
let mut languages = assets
|
||||
.syntaxes()
|
||||
.get_syntaxes()?
|
||||
.iter()
|
||||
.filter(|syntax| !syntax.hidden && !syntax.file_extensions.is_empty())
|
||||
.cloned()
|
||||
@@ -102,8 +107,11 @@ pub fn get_languages(config: &Config) -> Result<String> {
|
||||
true
|
||||
} else {
|
||||
let test_file = Path::new("test").with_extension(extension);
|
||||
match assets.syntax_for_file_name(test_file, &config.syntax_mapping) {
|
||||
Some(syntax) => syntax.name == lang_name,
|
||||
let syntax_in_set = assets
|
||||
.get_syntax_for_file_name(test_file, &config.syntax_mapping)
|
||||
.unwrap(); // safe since .get_syntaxes() above worked
|
||||
match syntax_in_set {
|
||||
Some(syntax_in_set) => syntax_in_set.syntax.name == lang_name,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
@@ -176,7 +184,7 @@ fn theme_preview_file<'a>() -> Input<'a> {
|
||||
}
|
||||
|
||||
pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let assets = assets_from_cache_or_binary(cfg.use_custom_assets)?;
|
||||
let mut config = cfg.clone();
|
||||
let mut style = HashSet::new();
|
||||
style.insert(StyleComponent::Plain);
|
||||
@@ -217,46 +225,64 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||
}
|
||||
|
||||
fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let controller = Controller::new(&config, &assets);
|
||||
let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
|
||||
let controller = Controller::new(config, &assets);
|
||||
controller.run(inputs)
|
||||
}
|
||||
|
||||
#[cfg(feature = "bugreport")]
|
||||
fn invoke_bugreport(app: &App) {
|
||||
use bugreport::{bugreport, collector::*, format::Markdown};
|
||||
let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
|
||||
.unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less".
|
||||
|
||||
let report = bugreport!()
|
||||
.info(SoftwareVersion::default())
|
||||
.info(OperatingSystem::default())
|
||||
.info(CommandLine::default())
|
||||
.info(EnvironmentVariables::list(&[
|
||||
"SHELL",
|
||||
"PAGER",
|
||||
"LESS",
|
||||
"BAT_PAGER",
|
||||
"BAT_CACHE_PATH",
|
||||
"BAT_CONFIG_PATH",
|
||||
"BAT_OPTS",
|
||||
"BAT_STYLE",
|
||||
"BAT_TABS",
|
||||
"BAT_THEME",
|
||||
"XDG_CONFIG_HOME",
|
||||
"XDG_CACHE_HOME",
|
||||
"COLORTERM",
|
||||
"NO_COLOR",
|
||||
"MANPAGER",
|
||||
]))
|
||||
.info(FileContent::new("Config file", config_file()))
|
||||
.info(CompileTimeInformation::default());
|
||||
|
||||
let mut report = if let Ok(resolved_path) = grep_cli::resolve_binary(pager) {
|
||||
report.info(CommandOutput::new(
|
||||
"Less version",
|
||||
resolved_path,
|
||||
&["--version"],
|
||||
))
|
||||
} else {
|
||||
report
|
||||
};
|
||||
|
||||
report.print::<Markdown>();
|
||||
}
|
||||
|
||||
/// Returns `Err(..)` upon fatal errors. Otherwise, returns `Ok(true)` on full success and
|
||||
/// `Ok(false)` if any intermediate errors occurred (were printed).
|
||||
fn run() -> Result<bool> {
|
||||
let app = App::new()?;
|
||||
|
||||
if app.matches.is_present("diagnostic") {
|
||||
use bugreport::{bugreport, collector::*, format::Markdown};
|
||||
let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
|
||||
.unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less".
|
||||
|
||||
bugreport!()
|
||||
.info(SoftwareVersion::default())
|
||||
.info(OperatingSystem::default())
|
||||
.info(CommandLine::default())
|
||||
.info(EnvironmentVariables::list(&[
|
||||
"SHELL",
|
||||
"PAGER",
|
||||
"BAT_PAGER",
|
||||
"BAT_CACHE_PATH",
|
||||
"BAT_CONFIG_PATH",
|
||||
"BAT_OPTS",
|
||||
"BAT_STYLE",
|
||||
"BAT_TABS",
|
||||
"BAT_THEME",
|
||||
"XDG_CONFIG_HOME",
|
||||
"XDG_CACHE_HOME",
|
||||
"COLORTERM",
|
||||
"NO_COLOR",
|
||||
"MANPAGER",
|
||||
]))
|
||||
.info(FileContent::new("Config file", config_file()))
|
||||
.info(CompileTimeInformation::default())
|
||||
.info(CommandOutput::new("Less version", pager, &["--version"]))
|
||||
.print::<Markdown>();
|
||||
|
||||
#[cfg(feature = "bugreport")]
|
||||
invoke_bugreport(&app);
|
||||
#[cfg(not(feature = "bugreport"))]
|
||||
println!("bat has been built without the 'bugreport' feature. The '--diagnostic' option is not available.");
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
@@ -269,7 +295,7 @@ fn run() -> Result<bool> {
|
||||
run_cache_subcommand(cache_matches)?;
|
||||
Ok(true)
|
||||
} else {
|
||||
let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
|
||||
let inputs = vec![Input::ordinary_file("cache")];
|
||||
let config = app.config(&inputs)?;
|
||||
|
||||
run_controller(inputs, &config)
|
||||
|
@@ -82,9 +82,13 @@ pub struct Config<'a> {
|
||||
|
||||
/// Ranges of lines which should be highlighted with a special background color
|
||||
pub highlighted_lines: HighlightedLineRanges,
|
||||
|
||||
/// Whether or not to allow custom assets. If this is false or if custom assets (a.k.a.
|
||||
/// cached assets) are not available, assets from the binary will be used instead.
|
||||
pub use_custom_assets: bool,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "application", feature = "paging"))]
|
||||
#[cfg(all(feature = "minimal-application", feature = "paging"))]
|
||||
pub fn get_pager_executable(config_pager: Option<&str>) -> Option<String> {
|
||||
if let Ok(Some(pager)) = crate::pager::get_pager(config_pager) {
|
||||
Some(pager.bin)
|
||||
|
@@ -45,7 +45,7 @@ impl<'b> Controller<'b> {
|
||||
// Do not launch the pager if NONE of the input files exist
|
||||
let mut paging_mode = self.config.paging_mode;
|
||||
if self.config.paging_mode != PagingMode::Never {
|
||||
let call_pager = inputs.iter().any(|ref input| {
|
||||
let call_pager = inputs.iter().any(|input| {
|
||||
if let InputKind::OrdinaryFile(ref path) = input.kind {
|
||||
Path::new(path).exists()
|
||||
} else {
|
||||
@@ -124,11 +124,11 @@ impl<'b> Controller<'b> {
|
||||
};
|
||||
|
||||
let mut printer: Box<dyn Printer> = if self.config.loop_through {
|
||||
Box::new(SimplePrinter::new(&self.config))
|
||||
Box::new(SimplePrinter::new(self.config))
|
||||
} else {
|
||||
Box::new(InteractivePrinter::new(
|
||||
&self.config,
|
||||
&self.assets,
|
||||
self.config,
|
||||
self.assets,
|
||||
&mut opened_input,
|
||||
#[cfg(feature = "git")]
|
||||
&line_changes,
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#![cfg(feature = "git")]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -17,7 +16,7 @@ pub enum LineChange {
|
||||
|
||||
pub type LineChanges = HashMap<u32, LineChange>;
|
||||
|
||||
pub fn get_git_diff(filename: &OsStr) -> Option<LineChanges> {
|
||||
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
||||
let repo = Repository::discover(&filename).ok()?;
|
||||
|
||||
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
||||
|
@@ -3,7 +3,7 @@ use std::io::Write;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
Clap(::clap::Error) #[cfg(feature = "application")];
|
||||
Clap(::clap::Error) #[cfg(feature = "minimal-application")];
|
||||
Io(::std::io::Error);
|
||||
SyntectError(::syntect::LoadingError);
|
||||
ParseIntError(::std::num::ParseIntError);
|
||||
|
38
src/input.rs
38
src/input.rs
@@ -1,7 +1,7 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead, BufReader, Read};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use clircle::{Clircle, Identifier};
|
||||
use content_inspector::{self, ContentType};
|
||||
@@ -51,7 +51,7 @@ impl InputDescription {
|
||||
|
||||
pub fn title(&self) -> &String {
|
||||
match self.title.as_ref() {
|
||||
Some(ref title) => title,
|
||||
Some(title) => title,
|
||||
None => &self.name,
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ impl InputDescription {
|
||||
}
|
||||
|
||||
pub(crate) enum InputKind<'a> {
|
||||
OrdinaryFile(OsString),
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader(Box<dyn Read + 'a>),
|
||||
}
|
||||
@@ -86,7 +86,7 @@ impl<'a> InputKind<'a> {
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub(crate) struct InputMetadata {
|
||||
pub(crate) user_provided_name: Option<OsString>,
|
||||
pub(crate) user_provided_name: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub struct Input<'a> {
|
||||
@@ -96,7 +96,7 @@ pub struct Input<'a> {
|
||||
}
|
||||
|
||||
pub(crate) enum OpenedInputKind {
|
||||
OrdinaryFile(OsString),
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader,
|
||||
}
|
||||
@@ -109,8 +109,12 @@ pub(crate) struct OpenedInput<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Input<'a> {
|
||||
pub fn ordinary_file(path: &OsStr) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_os_string());
|
||||
pub fn ordinary_file(path: impl AsRef<Path>) -> Self {
|
||||
Self::_ordinary_file(path.as_ref())
|
||||
}
|
||||
|
||||
fn _ordinary_file(path: &Path) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_path_buf());
|
||||
Input {
|
||||
description: kind.description(),
|
||||
metadata: InputMetadata::default(),
|
||||
@@ -140,7 +144,11 @@ impl<'a> Input<'a> {
|
||||
matches!(self.kind, InputKind::StdIn)
|
||||
}
|
||||
|
||||
pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
|
||||
pub fn with_name(self, provided_name: Option<impl AsRef<Path>>) -> Self {
|
||||
self._with_name(provided_name.as_ref().map(|it| it.as_ref()))
|
||||
}
|
||||
|
||||
fn _with_name(mut self, provided_name: Option<&Path>) -> Self {
|
||||
if let Some(name) = provided_name {
|
||||
self.description.name = name.to_string_lossy().to_string()
|
||||
}
|
||||
@@ -203,7 +211,7 @@ impl<'a> Input<'a> {
|
||||
)
|
||||
.into());
|
||||
}
|
||||
file = input_identifier.into_inner().expect("The file was lost in the clircle::Identifier, this should not have happended...");
|
||||
file = input_identifier.into_inner().expect("The file was lost in the clircle::Identifier, this should not have happened...");
|
||||
}
|
||||
|
||||
InputReader::new(BufReader::new(file))
|
||||
@@ -274,21 +282,21 @@ fn basic() {
|
||||
|
||||
let res = reader.read_line(&mut buffer);
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(true, res.unwrap());
|
||||
assert!(res.unwrap());
|
||||
assert_eq!(b"#!/bin/bash\n", &buffer[..]);
|
||||
|
||||
buffer.clear();
|
||||
|
||||
let res = reader.read_line(&mut buffer);
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(true, res.unwrap());
|
||||
assert!(res.unwrap());
|
||||
assert_eq!(b"echo hello", &buffer[..]);
|
||||
|
||||
buffer.clear();
|
||||
|
||||
let res = reader.read_line(&mut buffer);
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(false, res.unwrap());
|
||||
assert!(!res.unwrap());
|
||||
assert!(buffer.is_empty());
|
||||
}
|
||||
|
||||
@@ -303,20 +311,20 @@ fn utf16le() {
|
||||
|
||||
let res = reader.read_line(&mut buffer);
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(true, res.unwrap());
|
||||
assert!(res.unwrap());
|
||||
assert_eq!(b"\xFF\xFE\x73\x00\x0A\x00", &buffer[..]);
|
||||
|
||||
buffer.clear();
|
||||
|
||||
let res = reader.read_line(&mut buffer);
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(true, res.unwrap());
|
||||
assert!(res.unwrap());
|
||||
assert_eq!(b"\x64\x00", &buffer[..]);
|
||||
|
||||
buffer.clear();
|
||||
|
||||
let res = reader.read_line(&mut buffer);
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(false, res.unwrap());
|
||||
assert!(!res.unwrap());
|
||||
assert!(buffer.is_empty());
|
||||
}
|
||||
|
19
src/less.rs
19
src/less.rs
@@ -4,14 +4,16 @@ use std::ffi::OsStr;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
|
||||
let cmd = Command::new(less_path).arg("--version").output().ok()?;
|
||||
let resolved_path = grep_cli::resolve_binary(less_path.as_ref()).ok()?;
|
||||
|
||||
let cmd = Command::new(resolved_path).arg("--version").output().ok()?;
|
||||
parse_less_version(&cmd.stdout)
|
||||
}
|
||||
|
||||
fn parse_less_version(output: &[u8]) -> Option<usize> {
|
||||
if output.starts_with(b"less ") {
|
||||
let version = std::str::from_utf8(&output[5..]).ok()?;
|
||||
let end = version.find(' ')?;
|
||||
let end = version.find(|c: char| !c.is_ascii_digit())?;
|
||||
version[..end].parse::<usize>().ok()
|
||||
} else {
|
||||
None
|
||||
@@ -57,6 +59,19 @@ Home page: http://www.greenwoodsoftware.com/less";
|
||||
assert_eq!(Some(551), parse_less_version(output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_less_version_581_2() {
|
||||
let output = b"less 581.2 (PCRE2 regular expressions)
|
||||
Copyright (C) 1984-2021 Mark Nudelman
|
||||
|
||||
less comes with NO WARRANTY, to the extent permitted by law.
|
||||
For information about the terms of redistribution,
|
||||
see the file named README in the less distribution.
|
||||
Home page: https://greenwoodsoftware.com/less";
|
||||
|
||||
assert_eq!(Some(581), parse_less_version(output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_less_version_wrong_program() {
|
||||
let output = b"more from util-linux 2.34";
|
||||
|
@@ -40,6 +40,8 @@ mod preprocessor;
|
||||
mod pretty_printer;
|
||||
pub(crate) mod printer;
|
||||
pub mod style;
|
||||
#[cfg(feature = "build-assets")]
|
||||
mod syntax_dependencies;
|
||||
pub(crate) mod syntax_mapping;
|
||||
mod terminal;
|
||||
pub(crate) mod wrapping;
|
||||
|
@@ -63,7 +63,14 @@ impl OutputType {
|
||||
return Err(ErrorKind::InvalidPagerValueBat.into());
|
||||
}
|
||||
|
||||
let mut p = Command::new(&pager.bin);
|
||||
let resolved_path = match grep_cli::resolve_binary(&pager.bin) {
|
||||
Ok(path) => path,
|
||||
Err(_) => {
|
||||
return Ok(OutputType::stdout());
|
||||
}
|
||||
};
|
||||
|
||||
let mut p = Command::new(resolved_path);
|
||||
let args = pager.args;
|
||||
|
||||
if pager.kind == PagerKind::Less {
|
||||
|
22
src/pager.rs
22
src/pager.rs
@@ -98,17 +98,17 @@ pub(crate) fn get_pager(config_pager: Option<&str>) -> Result<Option<Pager>, Par
|
||||
Some((bin, args)) => {
|
||||
let kind = PagerKind::from_bin(bin);
|
||||
|
||||
let use_less_instead = match (&source, &kind) {
|
||||
// 'more' and 'most' do not supports colors; automatically use 'less' instead
|
||||
// if the problematic pager came from the generic PAGER env var
|
||||
(PagerSource::EnvVarPager, PagerKind::More) => true,
|
||||
(PagerSource::EnvVarPager, PagerKind::Most) => true,
|
||||
|
||||
// If PAGER=bat, silently use 'less' instead to prevent recursion ...
|
||||
(PagerSource::EnvVarPager, PagerKind::Bat) => true,
|
||||
|
||||
// Never silently use less if BAT_PAGER or --pager has been specified
|
||||
_ => false,
|
||||
let use_less_instead = if source == PagerSource::EnvVarPager {
|
||||
// 'more' and 'most' do not supports colors; automatically use
|
||||
// 'less' instead if the problematic pager came from the
|
||||
// generic PAGER env var.
|
||||
// If PAGER=bat, silently use 'less' instead to prevent
|
||||
// recursion.
|
||||
// Never silently use 'less' if BAT_PAGER or --pager has been
|
||||
// specified.
|
||||
matches!(kind, PagerKind::More | PagerKind::Most | PagerKind::Bat)
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
Ok(Some(if use_less_instead {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
use console::Term;
|
||||
use syntect::parsing::SyntaxReference;
|
||||
@@ -40,10 +40,11 @@ pub struct PrettyPrinter<'a> {
|
||||
|
||||
impl<'a> PrettyPrinter<'a> {
|
||||
pub fn new() -> Self {
|
||||
let mut config = Config::default();
|
||||
|
||||
config.colored_output = true;
|
||||
config.true_color = true;
|
||||
let config = Config {
|
||||
colored_output: true,
|
||||
true_color: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
PrettyPrinter {
|
||||
inputs: vec![],
|
||||
@@ -71,7 +72,7 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
|
||||
/// Add a file which should be pretty-printed
|
||||
pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self {
|
||||
pub fn input_file(&mut self, path: impl AsRef<Path>) -> &mut Self {
|
||||
self.input(Input::from_file(path).kind("File"))
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ impl<'a> PrettyPrinter<'a> {
|
||||
pub fn input_files<I, P>(&mut self, paths: I) -> &mut Self
|
||||
where
|
||||
I: IntoIterator<Item = P>,
|
||||
P: AsRef<OsStr>,
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
self.inputs(paths.into_iter().map(Input::from_file))
|
||||
}
|
||||
@@ -234,7 +235,9 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
|
||||
pub fn syntaxes(&self) -> impl Iterator<Item = &SyntaxReference> {
|
||||
self.assets.syntaxes().iter()
|
||||
// We always use assets from the binary, which are guaranteed to always
|
||||
// be valid, so get_syntaxes() can never fail here
|
||||
self.assets.get_syntaxes().unwrap().iter()
|
||||
}
|
||||
|
||||
/// Pretty-print all specified inputs. This method will "use" all stored inputs.
|
||||
@@ -297,8 +300,8 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
|
||||
/// A new input from a file.
|
||||
pub fn from_file(path: impl AsRef<OsStr>) -> Self {
|
||||
input::Input::ordinary_file(path.as_ref()).into()
|
||||
pub fn from_file(path: impl AsRef<Path>) -> Self {
|
||||
input::Input::ordinary_file(path).into()
|
||||
}
|
||||
|
||||
/// A new input from bytes.
|
||||
@@ -313,8 +316,8 @@ impl<'a> Input<'a> {
|
||||
|
||||
/// The filename of the input.
|
||||
/// This affects syntax detection and changes the default header title.
|
||||
pub fn name(mut self, name: impl AsRef<OsStr>) -> Self {
|
||||
self.input = self.input.with_name(Some(name.as_ref()));
|
||||
pub fn name(mut self, name: impl AsRef<Path>) -> Self {
|
||||
self.input = self.input.with_name(Some(name));
|
||||
self
|
||||
}
|
||||
|
||||
@@ -327,7 +330,7 @@ impl<'a> Input<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// The title for the input (e.g. "http://example.com/example.txt")
|
||||
/// The title for the input (e.g. "Descriptive title")
|
||||
/// This defaults to the file name.
|
||||
pub fn title(mut self, title: impl Into<String>) -> Self {
|
||||
self.input.description_mut().set_title(Some(title.into()));
|
||||
@@ -335,14 +338,14 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<Input<'a>> for input::Input<'a> {
|
||||
fn into(self) -> Input<'a> {
|
||||
Input { input: self }
|
||||
impl<'a> From<input::Input<'a>> for Input<'a> {
|
||||
fn from(input: input::Input<'a>) -> Self {
|
||||
Self { input }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<input::Input<'a>> for Input<'a> {
|
||||
fn into(self) -> input::Input<'a> {
|
||||
self.input
|
||||
impl<'a> From<Input<'a>> for input::Input<'a> {
|
||||
fn from(Input { input }: Input<'a>) -> Self {
|
||||
input
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ use encoding::{DecoderTrap, Encoding};
|
||||
|
||||
use unicode_width::UnicodeWidthChar;
|
||||
|
||||
use crate::assets::HighlightingAssets;
|
||||
use crate::assets::{HighlightingAssets, SyntaxReferenceInSet};
|
||||
use crate::config::Config;
|
||||
#[cfg(feature = "git")]
|
||||
use crate::decorations::LineChangesDecoration;
|
||||
@@ -163,23 +163,29 @@ impl<'a> InteractivePrinter<'a> {
|
||||
panel_width = 0;
|
||||
}
|
||||
|
||||
let highlighter = if input
|
||||
let (highlighter, syntax_set) = if input
|
||||
.reader
|
||||
.content_type
|
||||
.map_or(false, |c| c.is_binary() && !config.show_nonprintable)
|
||||
{
|
||||
None
|
||||
(None, assets.get_syntax_set()?)
|
||||
} else {
|
||||
// Determine the type of syntax for highlighting
|
||||
let syntax = match assets.get_syntax(config.language, input, &config.syntax_mapping) {
|
||||
Ok(syntax) => syntax,
|
||||
Err(Error(ErrorKind::UndetectedSyntax(_), _)) => {
|
||||
assets.syntax_set.find_syntax_plain_text()
|
||||
}
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
let syntax_in_set =
|
||||
match assets.get_syntax(config.language, input, &config.syntax_mapping) {
|
||||
Ok(syntax_in_set) => syntax_in_set,
|
||||
Err(Error(ErrorKind::UndetectedSyntax(_), _)) => {
|
||||
let syntax_set = assets.get_syntax_set()?;
|
||||
let syntax = syntax_set.find_syntax_plain_text();
|
||||
SyntaxReferenceInSet { syntax, syntax_set }
|
||||
}
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
|
||||
Some(HighlightLines::new(syntax, theme))
|
||||
(
|
||||
Some(HighlightLines::new(syntax_in_set.syntax, theme)),
|
||||
syntax_in_set.syntax_set,
|
||||
)
|
||||
};
|
||||
|
||||
Ok(InteractivePrinter {
|
||||
@@ -192,7 +198,7 @@ impl<'a> InteractivePrinter<'a> {
|
||||
#[cfg(feature = "git")]
|
||||
line_changes,
|
||||
highlighter,
|
||||
syntax_set: &assets.syntax_set,
|
||||
syntax_set,
|
||||
background_color_highlight,
|
||||
})
|
||||
}
|
||||
@@ -366,19 +372,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
line_buffer: &[u8],
|
||||
) -> Result<()> {
|
||||
let line = if self.config.show_nonprintable {
|
||||
replace_nonprintable(&line_buffer, self.config.tab_width)
|
||||
replace_nonprintable(line_buffer, self.config.tab_width)
|
||||
} else {
|
||||
match self.content_type {
|
||||
Some(ContentType::BINARY) | None => {
|
||||
return Ok(());
|
||||
}
|
||||
Some(ContentType::UTF_16LE) => UTF_16LE
|
||||
.decode(&line_buffer, DecoderTrap::Replace)
|
||||
.decode(line_buffer, DecoderTrap::Replace)
|
||||
.map_err(|_| "Invalid UTF-16LE")?,
|
||||
Some(ContentType::UTF_16BE) => UTF_16BE
|
||||
.decode(&line_buffer, DecoderTrap::Replace)
|
||||
.decode(line_buffer, DecoderTrap::Replace)
|
||||
.map_err(|_| "Invalid UTF-16BE")?,
|
||||
_ => String::from_utf8_lossy(&line_buffer).to_string(),
|
||||
_ => String::from_utf8_lossy(line_buffer).to_string(),
|
||||
}
|
||||
};
|
||||
|
||||
@@ -414,7 +420,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
let decorations = self
|
||||
.decorations
|
||||
.iter()
|
||||
.map(|ref d| d.generate(line_number, false, self))
|
||||
.map(|d| d.generate(line_number, false, self))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for deco in decorations {
|
||||
@@ -447,8 +453,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
|
||||
if text.len() != text_trimmed.len() {
|
||||
if let Some(background_color) = background_color {
|
||||
let mut ansi_style = Style::default();
|
||||
ansi_style.background = to_ansi_color(background_color, true_color);
|
||||
let ansi_style = Style {
|
||||
background: to_ansi_color(background_color, true_color),
|
||||
..Default::default()
|
||||
};
|
||||
let width = if cursor_total <= cursor_max {
|
||||
cursor_max - cursor_total + 1
|
||||
} else {
|
||||
@@ -523,7 +531,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
"{} ",
|
||||
self.decorations
|
||||
.iter()
|
||||
.map(|ref d| d
|
||||
.map(|d| d
|
||||
.generate(line_number, true, self)
|
||||
.text)
|
||||
.collect::<Vec<String>>()
|
||||
@@ -588,8 +596,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
}
|
||||
|
||||
if let Some(background_color) = background_color {
|
||||
let mut ansi_style = Style::default();
|
||||
ansi_style.background = to_ansi_color(background_color, self.config.true_color);
|
||||
let ansi_style = Style {
|
||||
background: to_ansi_color(background_color, self.config.true_color),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
write!(
|
||||
handle,
|
||||
|
184
src/syntax_dependencies.rs
Normal file
184
src/syntax_dependencies.rs
Normal file
@@ -0,0 +1,184 @@
|
||||
use std::collections::HashMap;
|
||||
use syntect::parsing::syntax_definition::{
|
||||
ContextReference, MatchOperation, MatchPattern, Pattern, SyntaxDefinition,
|
||||
};
|
||||
use syntect::parsing::{Scope, SyntaxSet, SyntaxSetBuilder};
|
||||
|
||||
type SyntaxName = String;
|
||||
|
||||
/// Used to look up what dependencies a given [SyntaxDefinition] has
|
||||
type SyntaxToDependencies = HashMap<SyntaxName, Vec<Dependency>>;
|
||||
|
||||
/// Used to look up which [SyntaxDefinition] corresponds to a given [Dependency]
|
||||
type DependencyToSyntax<'a> = HashMap<Dependency, &'a SyntaxDefinition>;
|
||||
|
||||
/// Represents a dependency on an external `.sublime-syntax` file.
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||
enum Dependency {
|
||||
/// By name. Example YAML: `include: C.sublime-syntax`
|
||||
ByName(String),
|
||||
|
||||
/// By scope. Example YAML: `embed: scope:source.c`
|
||||
ByScope(Scope),
|
||||
}
|
||||
|
||||
/// Generates independent [SyntaxSet]s after analyzing dependencies between syntaxes
|
||||
/// in a [SyntaxSetBuilder], and then prints the reults.
|
||||
pub(crate) fn print_syntax_dependencies(syntax_set_builder: &SyntaxSetBuilder) {
|
||||
println!("Constructing independent SyntaxSets...");
|
||||
let independent_syntax_sets = build_independent_syntax_sets(syntax_set_builder);
|
||||
|
||||
println!("Independent SyntaxSets:");
|
||||
for syntax_set in independent_syntax_sets {
|
||||
let names = syntax_set
|
||||
.syntaxes()
|
||||
.iter()
|
||||
.map(|syntax| &syntax.name)
|
||||
.collect::<Vec<_>>();
|
||||
println!("{:?}", names);
|
||||
}
|
||||
}
|
||||
|
||||
/// Analyzes dependencies between syntaxes in a [SyntaxSetBuilder].
|
||||
/// From that, it builds independent [SyntaxSet]s.
|
||||
fn build_independent_syntax_sets(
|
||||
syntax_set_builder: &'_ SyntaxSetBuilder,
|
||||
) -> impl Iterator<Item = SyntaxSet> + '_ {
|
||||
let syntaxes = syntax_set_builder.syntaxes();
|
||||
|
||||
// Build the data structures we need for dependency resolution
|
||||
let (syntax_to_dependencies, dependency_to_syntax) = generate_maps(syntaxes);
|
||||
|
||||
// Create one independent SyntaxSet from each (non-hidden) SyntaxDefinition
|
||||
syntaxes.iter().filter_map(move |syntax| {
|
||||
if syntax.hidden {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut builder = SyntaxSetDependencyBuilder::new();
|
||||
builder.add_with_dependencies(syntax, &syntax_to_dependencies, &dependency_to_syntax);
|
||||
Some(builder.build())
|
||||
})
|
||||
}
|
||||
|
||||
/// In order to analyze dependencies, we need two key pieces of data.
|
||||
/// First, when we have a [Dependency], we need to know what [SyntaxDefinition] that
|
||||
/// corresponds to. Second, when we have a [SyntaxDefinition], we need to know
|
||||
/// what dependencies it has. This functions generates that data for each syntax.
|
||||
fn generate_maps(syntaxes: &[SyntaxDefinition]) -> (SyntaxToDependencies, DependencyToSyntax) {
|
||||
let mut syntax_to_dependencies = HashMap::new();
|
||||
let mut dependency_to_syntax = HashMap::new();
|
||||
|
||||
for syntax in syntaxes {
|
||||
syntax_to_dependencies.insert(syntax.name.clone(), dependencies_for_syntax(syntax));
|
||||
|
||||
dependency_to_syntax.insert(Dependency::ByName(syntax.name.clone()), syntax);
|
||||
dependency_to_syntax.insert(Dependency::ByScope(syntax.scope), syntax);
|
||||
}
|
||||
|
||||
(syntax_to_dependencies, dependency_to_syntax)
|
||||
}
|
||||
|
||||
/// Gets what external dependencies a given [SyntaxDefinition] has.
|
||||
/// An external dependency is another `.sublime-syntax` file.
|
||||
/// It does that by looking for variants of the following YAML patterns:
|
||||
/// - `include: C.sublime-syntax`
|
||||
/// - `embed: scope:source.c`
|
||||
fn dependencies_for_syntax(syntax: &SyntaxDefinition) -> Vec<Dependency> {
|
||||
let mut dependencies: Vec<Dependency> = syntax
|
||||
.contexts
|
||||
.values()
|
||||
.flat_map(|context| &context.patterns)
|
||||
.flat_map(dependencies_from_pattern)
|
||||
.collect();
|
||||
|
||||
// No need to track a dependency more than once
|
||||
dependencies.dedup();
|
||||
|
||||
dependencies
|
||||
}
|
||||
|
||||
fn dependencies_from_pattern(pattern: &Pattern) -> Vec<Dependency> {
|
||||
match *pattern {
|
||||
Pattern::Match(MatchPattern {
|
||||
operation: MatchOperation::Push(ref context_references),
|
||||
..
|
||||
}) => context_references
|
||||
.iter()
|
||||
.map(dependency_from_context_reference)
|
||||
.collect(),
|
||||
Pattern::Include(ref context_reference) => {
|
||||
vec![dependency_from_context_reference(context_reference)]
|
||||
}
|
||||
_ => vec![],
|
||||
}
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn dependency_from_context_reference(context_reference: &ContextReference) -> Option<Dependency> {
|
||||
match &context_reference {
|
||||
ContextReference::File { ref name, .. } => Some(Dependency::ByName(name.clone())),
|
||||
ContextReference::ByScope { ref scope, .. } => Some(Dependency::ByScope(*scope)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper to construct a [SyntaxSetBuilder] that contains only [SyntaxDefinition]s
|
||||
/// that have dependencies among them.
|
||||
struct SyntaxSetDependencyBuilder {
|
||||
syntax_set_builder: SyntaxSetBuilder,
|
||||
}
|
||||
|
||||
impl SyntaxSetDependencyBuilder {
|
||||
fn new() -> Self {
|
||||
SyntaxSetDependencyBuilder {
|
||||
syntax_set_builder: SyntaxSetBuilder::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a [SyntaxDefinition] to the underlying [SyntaxSetBuilder].
|
||||
/// Also resolve any dependencies it has and add those [SyntaxDefinition]s too.
|
||||
/// This is a recursive process.
|
||||
fn add_with_dependencies(
|
||||
&mut self,
|
||||
syntax: &SyntaxDefinition,
|
||||
syntax_to_dependencies: &SyntaxToDependencies,
|
||||
dependency_to_syntax: &DependencyToSyntax,
|
||||
) {
|
||||
let name = &syntax.name;
|
||||
if self.is_syntax_already_added(name) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.syntax_set_builder.add(syntax.clone());
|
||||
|
||||
let dependencies = syntax_to_dependencies.get(name);
|
||||
if dependencies.is_none() {
|
||||
eprintln!("ERROR: Unknown dependencies for {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
for dependency in dependencies.unwrap() {
|
||||
if let Some(syntax_definition_dependency) = dependency_to_syntax.get(dependency) {
|
||||
self.add_with_dependencies(
|
||||
syntax_definition_dependency,
|
||||
syntax_to_dependencies,
|
||||
dependency_to_syntax,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn is_syntax_already_added(&self, name: &str) -> bool {
|
||||
self.syntax_set_builder
|
||||
.syntaxes()
|
||||
.iter()
|
||||
.any(|syntax| syntax.name == name)
|
||||
}
|
||||
|
||||
fn build(self) -> SyntaxSet {
|
||||
self.syntax_set_builder.build()
|
||||
}
|
||||
}
|
12
tests/.gitattributes
vendored
12
tests/.gitattributes
vendored
@@ -4,9 +4,9 @@ snapshots/** text=auto eol=lf
|
||||
syntax-tests/source/** text=auto eol=lf
|
||||
syntax-tests/highlighted/** text=auto eol=lf
|
||||
|
||||
examples/* linguist-vendored
|
||||
snapshots/* linguist-vendored
|
||||
benchmarks/* linguist-vendored
|
||||
benchmarks/test-src/* linguist-vendored
|
||||
scripts/* linguist-vendored
|
||||
syntax-tests/* linguist-vendored
|
||||
# Linguist overrides
|
||||
benchmarks/** linguist-vendored
|
||||
examples/** linguist-vendored
|
||||
snapshots/** linguist-vendored
|
||||
syntax-tests/highlighted/** linguist-vendored
|
||||
syntax-tests/source/** linguist-vendored
|
||||
|
@@ -30,6 +30,7 @@ fn all_themes_are_present() {
|
||||
"Solarized (light)",
|
||||
"Sublime Snazzy",
|
||||
"TwoDark",
|
||||
"Visual Studio Dark+",
|
||||
"ansi",
|
||||
"base16",
|
||||
"base16-256",
|
||||
|
10
tests/benchmarks/run-benchmarks.sh
vendored
10
tests/benchmarks/run-benchmarks.sh
vendored
@@ -3,9 +3,9 @@ cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||
|
||||
# Check that Hyperfine is installed.
|
||||
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||
echo "'hyperfine' does not seem to be installed."
|
||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||
exit 1
|
||||
echo "'hyperfine' does not seem to be installed."
|
||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine the target directories.
|
||||
@@ -15,7 +15,7 @@ get_target_dir() {
|
||||
| sed 's/^[[:space:]]*target-dir[[:space:]]*=//; s/^[[:space:]]*"//; s/"[[:space:]]*$//' \
|
||||
&& return 0
|
||||
fi
|
||||
|
||||
|
||||
echo "../../target"
|
||||
}
|
||||
|
||||
@@ -68,5 +68,5 @@ echo "### Time to syntax-highlight large files"
|
||||
echo
|
||||
|
||||
for SRC in test-src/*; do
|
||||
hyperfine --warmup 3 "$(printf "%q" "$BAT") --style=full --color=always --paging=never $(printf "%q" "$SRC")"
|
||||
hyperfine --warmup 3 "$(printf "%q" "$BAT") --style=full --color=always --paging=never $(printf "%q" "$SRC")"
|
||||
done
|
||||
|
@@ -40,6 +40,7 @@ fn bat_raw_command_with_config() -> Command {
|
||||
cmd.env_remove("BAT_STYLE");
|
||||
cmd.env_remove("BAT_THEME");
|
||||
cmd.env_remove("BAT_TABS");
|
||||
cmd.env_remove("BAT_CONFIG_DIR");
|
||||
cmd
|
||||
}
|
||||
|
||||
@@ -700,6 +701,16 @@ fn pager_failed_to_parse() {
|
||||
.stderr(predicate::str::contains("Could not parse pager command"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diagnostic_sanity_check() {
|
||||
bat()
|
||||
.arg("--diagnostic")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("BAT_PAGER="))
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_location_test() {
|
||||
bat_with_config()
|
||||
@@ -737,6 +748,16 @@ fn config_location_when_generating() {
|
||||
assert!(tmp_config_path.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_location_from_bat_config_dir_variable() {
|
||||
bat_with_config()
|
||||
.env("BAT_CONFIG_DIR", "conf/")
|
||||
.arg("--config-file")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::is_match("conf/config\n").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_read_arguments_from_file() {
|
||||
bat_with_config()
|
||||
@@ -795,6 +816,17 @@ fn does_not_print_unwanted_file_named_cache() {
|
||||
bat_with_config().arg("cach").assert().failure();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepts_no_custom_assets_arg() {
|
||||
// Just make sure --no-custom-assets is considered a valid arg
|
||||
// Don't bother to actually verify that it works
|
||||
bat()
|
||||
.arg("--no-custom-assets")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unicode_wrap() {
|
||||
bat_with_config()
|
||||
@@ -1101,6 +1133,42 @@ fn show_all_mode() {
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_paging_arg() {
|
||||
bat()
|
||||
.arg("--no-paging")
|
||||
.arg("--color=never")
|
||||
.arg("--decorations=never")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_paging_short_arg() {
|
||||
bat()
|
||||
.arg("-P")
|
||||
.arg("--color=never")
|
||||
.arg("--decorations=never")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_pager_arg() {
|
||||
bat()
|
||||
.arg("--no-pager")
|
||||
.arg("--color=never")
|
||||
.arg("--decorations=never")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plain_mode_does_not_add_nonexisting_newline() {
|
||||
bat()
|
||||
|
@@ -17,13 +17,16 @@ fn no_duplicate_extensions() {
|
||||
// The '.fs' extension appears in F# and GLSL.
|
||||
// We default to F#.
|
||||
"fs",
|
||||
// SystemVerilog and Verilog both use .v files.
|
||||
// We default to Verilog.
|
||||
"v",
|
||||
];
|
||||
|
||||
let assets = HighlightingAssets::from_binary();
|
||||
|
||||
let mut extensions = HashSet::new();
|
||||
|
||||
for syntax in assets.syntaxes() {
|
||||
for syntax in assets.get_syntaxes().expect("this is a #[test]") {
|
||||
for extension in &syntax.file_extensions {
|
||||
assert!(
|
||||
KNOWN_EXCEPTIONS.contains(&extension.as_str()) || extensions.insert(extension),
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# This script goes through all languages that are supported by 'bat'. For each
|
||||
# language, it loops over the correspoinding file extensions and searches a
|
||||
# language, it loops over the corresponding file extensions and searches a
|
||||
# given folder for matching files. It calls 'bat' for each of these files and
|
||||
# measures the highlighting speed (number of characters per second). The script
|
||||
# reports files which lead to slow highlighting speeds or errors during the
|
||||
|
@@ -18,6 +18,7 @@ BAT_OPTIONS = [
|
||||
|
||||
SKIP_FILENAMES = [
|
||||
"LICENSE.md",
|
||||
"NOTICE",
|
||||
"README.md",
|
||||
"bat_options",
|
||||
]
|
||||
|
@@ -1,7 +1,7 @@
|
||||
[3;38;2;102;217;239mfirst[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mlast[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239maddress[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mcity[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mzip[0m
|
||||
[3;38;2;102;217;239mJohn[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mDoe[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[3;38;2;102;217;239ma[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mb[0m
|
||||
[38;2;190;132;255m1[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mha[0m[38;2;248;248;242m [0m
|
||||
[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mha[0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m
|
||||
[3;38;2;102;217;239mha[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[38;2;190;132;255m3[0m[38;2;249;38;114m,[0m[38;2;190;132;255m4[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[3;38;2;166;226;46mfirst[0m[38;2;253;151;31m,[0m[38;2;102;217;239mlast[0m[38;2;253;151;31m,[0m[38;2;190;132;255maddress[0m[38;2;253;151;31m,[0m[38;2;249;38;114mcity[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46mzip[0m
|
||||
[3;38;2;166;226;46mJohn[0m[38;2;253;151;31m,[0m[38;2;102;217;239mDoe[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
[3;38;2;166;226;46ma[0m[38;2;253;151;31m,[0m[38;2;102;217;239mb[0m
|
||||
[3;38;2;166;226;46m1[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mha [0m
|
||||
[38;2;190;132;255m""[0m[38;2;230;219;116mha[0m[38;2;190;132;255m""[0m[38;2;230;219;116m [0m
|
||||
[38;2;230;219;116mha[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
[3;38;2;166;226;46m3[0m[38;2;253;151;31m,[0m[38;2;102;217;239m4[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 276.
|
247
tests/syntax-tests/highlighted/Cabal/semantic.cabal
vendored
Normal file
247
tests/syntax-tests/highlighted/Cabal/semantic.cabal
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
[38;2;190;132;255mcabal-version[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242m2.4[0m
|
||||
|
||||
[38;2;190;132;255mname[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242msemantic[0m
|
||||
[38;2;190;132;255mversion[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242m0.11.0.1[0m
|
||||
[38;2;190;132;255msynopsis[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mFramework and executable for analyzing and diffing untrusted code.[0m
|
||||
[38;2;190;132;255mdescription[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mSemantic is a library for parsing, analyzing, and comparing source code across many languages.[0m
|
||||
[38;2;190;132;255mhomepage[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhttp://github.com/github/semantic#readme[0m
|
||||
[38;2;190;132;255mbug-reports[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhttps://github.com/github/semantic/issues[0m
|
||||
[38;2;190;132;255mlicense[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mMIT[0m
|
||||
[38;2;190;132;255mlicense-file[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mLICENSE[0m
|
||||
[38;2;190;132;255mauthor[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mThe Semantic authors[0m
|
||||
[38;2;190;132;255mmaintainer[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mopensource+semantic@github.com[0m
|
||||
[38;2;190;132;255mcopyright[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242m(c) 2015-2020 GitHub, Inc.[0m
|
||||
[38;2;190;132;255mcategory[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mLanguage[0m
|
||||
[38;2;190;132;255mbuild-type[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mSimple[0m
|
||||
[38;2;190;132;255mstability[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242malpha[0m
|
||||
[38;2;190;132;255mextra-source-files[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mREADME.md[0m
|
||||
|
||||
[38;2;190;132;255mtested-with[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mGHC == 8.10.1[0m
|
||||
|
||||
[38;2;249;38;114mflag[0m[38;2;166;226;46m [0m[38;2;230;219;116mrelease[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mdescription[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mBuild with optimizations on (for CI or deployment builds)[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mdefault[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mFalse[0m
|
||||
|
||||
[38;2;117;113;94m-- GHC extensions shared between targets[0m
|
||||
[38;2;248;248;242mcommon haskell[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mdefault-language[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mHaskell2010[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mdefault-extensions[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mStrictData[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mghc-options[0m[38;2;166;226;46m:[0m
|
||||
[38;2;248;248;242m -Weverything[0m
|
||||
[38;2;248;248;242m -Wno-missing-local-signatures[0m
|
||||
[38;2;248;248;242m -Wno-missing-import-lists[0m
|
||||
[38;2;248;248;242m -Wno-implicit-prelude[0m
|
||||
[38;2;248;248;242m -Wno-safe[0m
|
||||
[38;2;248;248;242m -Wno-unsafe[0m
|
||||
[38;2;248;248;242m -Wno-name-shadowing[0m
|
||||
[38;2;248;248;242m -Wno-monomorphism-restriction[0m
|
||||
[38;2;248;248;242m -Wno-missed-specialisations[0m
|
||||
[38;2;248;248;242m -Wno-all-missed-specialisations[0m
|
||||
[38;2;248;248;242m -Wno-star-is-type[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mcpp-options[0m[38;2;166;226;46m:[0m
|
||||
[38;2;248;248;242m -DBAZEL_BUILD=0[0m
|
||||
[38;2;248;248;242m if (impl(ghc >= 8.8))[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mghc-options[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242m-Wno-missing-deriving-strategies[0m
|
||||
[38;2;248;248;242m if (impl(ghc >= 8.10))[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mghc-options[0m[38;2;166;226;46m:[0m
|
||||
[38;2;248;248;242m -Wno-missing-safe-haskell-mode[0m
|
||||
[38;2;248;248;242m -Wno-prepositive-qualified-module[0m
|
||||
|
||||
[38;2;248;248;242mcommon executable-flags[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mghc-options[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242m-threaded -rtsopts "-with-rtsopts=-N -A4m -n2m"[0m
|
||||
|
||||
[38;2;249;38;114mlibrary[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mimport[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhaskell[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mhs-source-dirs[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242msrc[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mexposed-modules[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mControl.Carrier.Parse.Measured[0m
|
||||
[38;2;248;248;242m , Control.Carrier.Parse.Simple[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- Effects[0m
|
||||
[38;2;248;248;242m , Control.Effect.Parse[0m
|
||||
[38;2;248;248;242m , Control.Effect.Sum.Project[0m
|
||||
[38;2;248;248;242m , Control.Effect.Timeout[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- General datatype definitions & generic algorithms[0m
|
||||
[38;2;248;248;242m , Data.Blob[0m
|
||||
[38;2;248;248;242m , Data.Blob.IO[0m
|
||||
[38;2;248;248;242m , Data.Duration[0m
|
||||
[38;2;248;248;242m , Data.Edit[0m
|
||||
[38;2;248;248;242m , Data.Error[0m
|
||||
[38;2;248;248;242m , Data.Flag[0m
|
||||
[38;2;248;248;242m , Data.Graph.Algebraic[0m
|
||||
[38;2;248;248;242m , Data.Handle[0m
|
||||
[38;2;248;248;242m , Data.Maybe.Exts[0m
|
||||
[38;2;248;248;242m , Data.Semigroup.App[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- Parser glue[0m
|
||||
[38;2;248;248;242m , Parsing.Parser[0m
|
||||
[38;2;248;248;242m , Parsing.TreeSitter[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- API[0m
|
||||
[38;2;248;248;242m , Semantic.Api[0m
|
||||
[38;2;248;248;242m , Semantic.Api.Bridge[0m
|
||||
[38;2;248;248;242m , Semantic.Api.StackGraph[0m
|
||||
[38;2;248;248;242m , Semantic.Api.Symbols[0m
|
||||
[38;2;248;248;242m , Semantic.Api.Terms[0m
|
||||
[38;2;248;248;242m , Semantic.CLI[0m
|
||||
[38;2;248;248;242m , Semantic.Config[0m
|
||||
[38;2;248;248;242m , Semantic.Env[0m
|
||||
[38;2;248;248;242m , Semantic.IO[0m
|
||||
[38;2;248;248;242m , Semantic.Task[0m
|
||||
[38;2;248;248;242m , Semantic.Task.Files[0m
|
||||
[38;2;248;248;242m , Semantic.Telemetry[0m
|
||||
[38;2;248;248;242m , Semantic.Telemetry.AsyncQueue[0m
|
||||
[38;2;248;248;242m , Semantic.Telemetry.Error[0m
|
||||
[38;2;248;248;242m , Semantic.Telemetry.Log[0m
|
||||
[38;2;248;248;242m , Semantic.Telemetry.Stat[0m
|
||||
[38;2;248;248;242m , Semantic.Util[0m
|
||||
[38;2;248;248;242m , Semantic.Util.Pretty[0m
|
||||
[38;2;248;248;242m , Semantic.Version[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- Serialization[0m
|
||||
[38;2;248;248;242m , Serializing.Format[0m
|
||||
[38;2;248;248;242m , Serializing.SExpression.Precise[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- Custom Prelude[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mautogen-modules[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mPaths_semantic[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mother-modules[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mPaths_semantic[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- Except in case of vendored dependencies, these deps should be expressed[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- as caret-operator bounds relative to a version in Stackage.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m-- These are currently pinned to lts-13.13.[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mbuild-depends[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239maeson[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.4.2.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239malgebraic-graphs[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.3[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mansi-terminal[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8.2[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239masync[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.2.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbase[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m4.13[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m5[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbytestring[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.10.8.2[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mcontainers[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.6.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mdirectory-tree[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.12.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mfilepath[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.4.2.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mfused-effects[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mghc-prim[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.7[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mhostname[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mhscolour[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.24.4[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mlens[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m4.17[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m4.20[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mnetwork[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.8.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mnetwork-uri[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.6.1.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239moptparse-applicative[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.14.3[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.16[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mpathtype[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mpretty-show[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.9.5[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mproto-lens[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-analysis[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-ast[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-codeql[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-go[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-java[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-json[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-php[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-proto[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-python[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-ruby[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-scope-graph[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-source[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.1.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-tags[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-tsx[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-typescript[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemilattices[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.0.0.3[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msplit[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.2.3.3[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mstm-chans[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m3.0.0.4[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtext[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.2.3.2[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtime[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.8.0.2[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.10[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.9.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-go[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-java[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.7.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-json[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.7.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-php[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-python[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.9.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-ql[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.1.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-ruby[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-tsx[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtree-sitter-typescript[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.5.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239munix[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.7.2.2[0m
|
||||
|
||||
[38;2;249;38;114mexecutable[0m[38;2;166;226;46m [0m[38;2;230;219;116msemantic[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mimport[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhaskell, executable-flags[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mhs-source-dirs[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mapp[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mmain-is[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mMain.hs[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mbuild-depends[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbase[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic[0m
|
||||
|
||||
[38;2;249;38;114mtest-suite[0m[38;2;166;226;46m [0m[38;2;230;219;116mtest[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mimport[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhaskell, executable-flags[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mtype[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mexitcode-stdio-1.0[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mhs-source-dirs[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mtest[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mmain-is[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mSpec.hs[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mother-modules[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mData.Graph.Spec[0m
|
||||
[38;2;248;248;242m , Data.Language.Spec[0m
|
||||
[38;2;248;248;242m , Data.Semigroup.App.Spec[0m
|
||||
[38;2;248;248;242m , Integration.Spec[0m
|
||||
[38;2;248;248;242m , Semantic.Spec[0m
|
||||
[38;2;248;248;242m , Semantic.CLI.Spec[0m
|
||||
[38;2;248;248;242m , Semantic.IO.Spec[0m
|
||||
[38;2;248;248;242m , Semantic.Stat.Spec[0m
|
||||
[38;2;248;248;242m , Tags.Spec[0m
|
||||
[38;2;248;248;242m , SpecHelpers[0m
|
||||
[38;2;248;248;242m , Generators[0m
|
||||
[38;2;248;248;242m , Properties[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mbuild-depends[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239malgebraic-graphs[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.3[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbase[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m4.13[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m5[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbytestring[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.10.8.2[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mfused-effects[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mGlob[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.10.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mhedgehog[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mhspec[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.6[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;190;132;255m3[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mhspec-expectations[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8.2[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mnetwork[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.8.0.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mpathtype[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-analysis[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-ast[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-proto[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-source[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.1.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-tags[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemilattices[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.2.3[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty-golden[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.3.2[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty-hedgehog[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.0.0.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty-hspec[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.1.5.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty-hunit[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.10.0.2[0m
|
||||
|
||||
[38;2;249;38;114mtest-suite[0m[38;2;166;226;46m [0m[38;2;230;219;116mparse-examples[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mimport[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhaskell, executable-flags[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mtype[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mexitcode-stdio-1.0[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mhs-source-dirs[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mtest[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mmain-is[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mExamples.hs[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mbuild-depends[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239masync[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m2.2.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbase[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mfused-effects[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mGlob[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mlens[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m4.17[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m4.20[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mpathtype[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mprocess[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.6.3.0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-analysis[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-ast[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-proto[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtasty-hunit[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mtext[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.2.3.2[0m
|
||||
|
||||
[38;2;249;38;114mbenchmark[0m[38;2;166;226;46m [0m[38;2;230;219;116mbenchmarks[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mimport[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhaskell, executable-flags[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mhs-source-dirs[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mbench[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mtype[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mexitcode-stdio-1.0[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mmain-is[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mMain.hs[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mother-modules[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mTagging[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mghc-options[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242m-static[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mbuild-depends[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mbase[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mfused-effects[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mgauge[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.2.5[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mGlob[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239mpathtype[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.8.1[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-analysis[0m[38;2;248;248;242m ^[0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m , [0m[38;2;102;217;239msemantic-proto[0m
|
||||
|
||||
[38;2;249;38;114msource-repository[0m[38;2;166;226;46m [0m[38;2;230;219;116mhead[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mtype[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mgit[0m
|
||||
[38;2;166;226;46m [0m[38;2;190;132;255mlocation[0m[38;2;166;226;46m:[0m[38;2;166;226;46m [0m[38;2;248;248;242mhttps://github.com/github/semantic[0m
|
391
tests/syntax-tests/highlighted/CoffeeScript/coffeescript.coffee
vendored
Normal file
391
tests/syntax-tests/highlighted/CoffeeScript/coffeescript.coffee
vendored
Normal file
@@ -0,0 +1,391 @@
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m CoffeeScript can be used both on the server, as a command-line compiler based[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m on Node.js/V8, or to run CoffeeScript directly in the browser. This module[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m contains the main entry functions for tokenizing, parsing, and compiling[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m source CoffeeScript into JavaScript.[0m
|
||||
|
||||
[38;2;249;38;114m{[0m[38;2;248;248;242mLexer[0m[38;2;249;38;114m} =[0m[38;2;248;248;242m [0m[38;2;102;217;239mrequire[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./lexer[0m[38;2;230;219;116m'[0m
|
||||
[38;2;249;38;114m{[0m[38;2;248;248;242mparser[0m[38;2;249;38;114m} =[0m[38;2;248;248;242m [0m[38;2;102;217;239mrequire[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./parser[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242mhelpers [0m[38;2;249;38;114m= [0m[38;2;102;217;239mrequire[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./helpers[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242mSourceMap [0m[38;2;249;38;114m= [0m[38;2;102;217;239mrequire[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./sourcemap[0m[38;2;230;219;116m'[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Require `package.json`, which is two levels above this file, as this file is[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m evaluated from `lib/coffeescript`.[0m
|
||||
[38;2;248;248;242mpackageJson [0m[38;2;249;38;114m= [0m[38;2;102;217;239mrequire[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m../../package.json[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m The current CoffeeScript version number.[0m
|
||||
[38;2;248;248;242mexports.VERSION [0m[38;2;249;38;114m= [0m[38;2;248;248;242mpackageJson[0m[38;2;248;248;242m.[0m[38;2;248;248;242mversion[0m
|
||||
|
||||
[38;2;248;248;242mexports.FILE_EXTENSIONS [0m[38;2;249;38;114m= [0m[38;2;248;248;242mFILE_EXTENSIONS [0m[38;2;249;38;114m= [0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116m.coffee[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116m.litcoffee[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116m.coffee.md[0m[38;2;230;219;116m'[0m[38;2;248;248;242m][0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Expose helpers for testing.[0m
|
||||
[38;2;248;248;242mexports.helpers [0m[38;2;249;38;114m= [0m[38;2;248;248;242mhelpers[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Function that allows for btoa in both nodejs and the browser.[0m
|
||||
[38;2;166;226;46mbase64encod[0m[38;2;166;226;46me[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(src)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;249;38;114mswitch[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mtypeof[0m[38;2;248;248;242m Buffer [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mfunction[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m Buffer[0m[38;2;248;248;242m.[0m[38;2;102;217;239mfrom[0m[38;2;255;255;255m([0m[38;2;248;248;242msrc[0m[38;2;255;255;255m)[0m[38;2;248;248;242m.[0m[38;2;102;217;239mtoString[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116mbase64[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mtypeof[0m[38;2;248;248;242m btoa [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mfunction[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m The contents of a `<script>` block are encoded via UTF-16, so if any extended[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m characters are used in the block, btoa will fail as it maxes out at UTF-8.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m See https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m for the gory details, and for the solution implemented here.[0m
|
||||
[38;2;248;248;242m btoa [0m[38;2;102;217;239mencodeURIComponent[0m[38;2;255;255;255m([0m[38;2;248;248;242msrc[0m[38;2;255;255;255m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mreplace [0m[38;2;246;170;17m/%([0-9A-F]{2})/g[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31m(match, p1)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mString[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfromCharCode [0m[38;2;230;219;116m'[0m[38;2;230;219;116m0x[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m p1[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mthrow[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mError[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116mUnable to base64 encode inline sourcemap.[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Function wrapper to add source file information to SyntaxErrors thrown by the[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m lexer/parser/compiler.[0m
|
||||
[38;2;166;226;46mwithPrettyError[0m[38;2;166;226;46ms[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(fn)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m(code, options = {})[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtry[0m
|
||||
[38;2;248;248;242m fn[0m[38;2;248;248;242m.[0m[38;2;102;217;239mcall[0m[38;2;248;248;242m [0m[38;2;255;255;255m@[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcode[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcatch[0m[38;2;248;248;242m err[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mthrow[0m[38;2;248;248;242m err [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mtypeof[0m[38;2;248;248;242m code [0m[38;2;249;38;114misnt[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mstring[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Support `CoffeeScript.nodes(tokens)`.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mthrow[0m[38;2;248;248;242m helpers[0m[38;2;248;248;242m.[0m[38;2;248;248;242mupdateSyntaxError err[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcode[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfilename[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m For each compiled file, save its source in memory in case we need to[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m recompile it later. We might need to recompile if the first compilation[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m didn’t create a source map (faster) but something went wrong and we need[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m a stack trace. Assuming that most of the time, code isn’t throwing[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m exceptions, it’s probably more efficient to compile twice only when we[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m need a stack trace, rather than always generating a source map even when[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m it’s not likely to be used. Save in form of `filename`: [`(source)`][0m
|
||||
[38;2;248;248;242msources [0m[38;2;249;38;114m= [0m[38;2;248;248;242m{[0m[38;2;248;248;242m}[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Also save source maps if generated, in form of `(source)`: [`(source map)`].[0m
|
||||
[38;2;248;248;242msourceMaps [0m[38;2;249;38;114m= [0m[38;2;248;248;242m{[0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m This is exported to enable an external module to implement caching of[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m compilation results. When the compiled js source is loaded from cache, the[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m original coffee code should be added with this method in order to enable the[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Error.prepareStackTrace below to correctly adjust the stack trace for the[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m corresponding file (the source map will be generated on demand).[0m
|
||||
[38;2;248;248;242mexports.registerCompiled [0m[38;2;249;38;114m= [0m[38;2;166;226;46mregisterCompile[0m[38;2;166;226;46md[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(filename, source, sourcemap)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
|
||||
[38;2;248;248;242m sources[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m] [0m[38;2;249;38;114m?[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m sources[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;248;248;242m.[0m[38;2;102;217;239mpush[0m[38;2;248;248;242m source[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sourcemap[0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m sourceMaps[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m] [0m[38;2;249;38;114m?[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m sourceMaps[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;248;248;242m.[0m[38;2;102;217;239mpush[0m[38;2;248;248;242m sourcemap[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Compile CoffeeScript code to JavaScript, using the Coffee/Jison compiler.[0m
|
||||
[38;2;117;113;94m#[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m If `options.sourceMap` is specified, then `options.filename` must also be[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m specified. All options that can be passed to `SourceMap#generate` may also[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m be passed here.[0m
|
||||
[38;2;117;113;94m#[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m This returns a javascript string, unless `options.sourceMap` is passed,[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m in which case this returns a `{js, v3SourceMap, sourceMap}`[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m object, where sourceMap is a sourcemap.coffee#SourceMap object, handy for[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m doing programmatic lookups.[0m
|
||||
[38;2;248;248;242mexports.compile [0m[38;2;249;38;114m= [0m[38;2;248;248;242mcompile [0m[38;2;249;38;114m= [0m[38;2;248;248;242mwithPrettyErrors [0m[3;38;2;253;151;31m(code, options = {})[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Clone `options`, to avoid mutating the `options` object passed in.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242moptions [0m[38;2;249;38;114m= [0m[3;38;2;166;226;46mObject[0m[38;2;248;248;242m.[0m[38;2;248;248;242massign [0m[38;2;248;248;242m{[0m[38;2;248;248;242m}[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Always generate a source map if no filename is passed in, since without a[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m a filename we have no way to retrieve this source later in the event that[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m we need to recompile it to get a source map for `prepareStackTrace`.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mgenerateSourceMap [0m[38;2;249;38;114m= [0m[38;2;248;248;242moptions[0m[38;2;248;248;242m.[0m[38;2;248;248;242msourceMap [0m[38;2;249;38;114mor[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242minlineMap [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfilename[0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfilename [0m[38;2;249;38;114m= [0m[38;2;248;248;242moptions[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfilename [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;248;248;242m checkShebangLine filename[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcode[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mmap [0m[38;2;249;38;114m= [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSourceMap[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m generateSourceMap[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtokens [0m[38;2;249;38;114m= [0m[38;2;248;248;242mlexer[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtokenize code[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Pass a list of referenced variables, so that generated variables won’t get[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m the same name.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242moptions.referencedVars [0m[38;2;249;38;114m= [0m[38;2;255;255;255m([0m
|
||||
[38;2;248;248;242m token[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m] [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m token [0m[38;2;249;38;114min[0m[38;2;248;248;242m tokens [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m token[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mIDENTIFIER[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Check for import or export; if found, force bare mode.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114munless[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mbare[0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mbare [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;190;132;255myes[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m token [0m[38;2;249;38;114min[0m[38;2;248;248;242m tokens[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m token[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116mIMPORT[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mEXPORT[0m[38;2;230;219;116m'[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242moptions.bare [0m[38;2;249;38;114m= [0m[38;2;190;132;255myes[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mbreak[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mnodes [0m[38;2;249;38;114m= [0m[38;2;248;248;242mparser[0m[38;2;248;248;242m.[0m[38;2;248;248;242mparse tokens[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m If all that was requested was a POJO representation of the nodes, e.g.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m the abstract syntax tree (AST), we can stop now and just return that[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m (after fixing the location data for the root/`File`»`Program` node,[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m which might’ve gotten misaligned from the original source due to the[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m `clean` function in the lexer).[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mast[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mnodes.allCommentTokens [0m[38;2;249;38;114m= [0m[38;2;248;248;242mhelpers[0m[38;2;248;248;242m.[0m[38;2;248;248;242mextractAllCommentTokens tokens[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceCodeNumberOfLines [0m[38;2;249;38;114m= [0m[38;2;255;255;255m([0m[38;2;248;248;242mcode[0m[38;2;248;248;242m.[0m[38;2;248;248;242mmatch[0m[38;2;255;255;255m([0m[38;2;246;170;17m/\r?\n/g[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceCodeLastLine [0m[38;2;249;38;114m= [0m[38;2;246;170;17m/.*$/[0m[38;2;248;248;242m.[0m[38;2;248;248;242mexec[0m[38;2;255;255;255m([0m[38;2;248;248;242mcode[0m[38;2;255;255;255m)[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] [0m[38;2;117;113;94m#[0m[38;2;117;113;94m `.*` matches all but line break characters.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast [0m[38;2;249;38;114m= [0m[38;2;248;248;242mnodes[0m[38;2;248;248;242m.[0m[38;2;248;248;242mast options[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mrange [0m[38;2;249;38;114m= [0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcode[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.start [0m[38;2;249;38;114m= [0m[38;2;248;248;242mast.program.start [0m[38;2;249;38;114m= [0m[38;2;248;248;242mrange[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.end [0m[38;2;249;38;114m= [0m[38;2;248;248;242mast.program.end [0m[38;2;249;38;114m= [0m[38;2;248;248;242mrange[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.range [0m[38;2;249;38;114m= [0m[38;2;248;248;242mast.program.range [0m[38;2;249;38;114m= [0m[38;2;248;248;242mrange[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.loc.start [0m[38;2;249;38;114m= [0m[38;2;248;248;242mast.program.loc.start [0m[38;2;249;38;114m= [0m[38;2;248;248;242m{[0m[38;2;248;248;242mline[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcolumn[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.loc.end.line [0m[38;2;249;38;114m= [0m[38;2;248;248;242mast.program.loc.end.line [0m[38;2;249;38;114m= [0m[38;2;248;248;242msourceCodeNumberOfLines[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.loc.end.column [0m[38;2;249;38;114m= [0m[38;2;248;248;242mast.program.loc.end.column [0m[38;2;249;38;114m= [0m[38;2;248;248;242msourceCodeLastLine[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mast.tokens [0m[38;2;249;38;114m= [0m[38;2;248;248;242mtokens[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m ast[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfragments [0m[38;2;249;38;114m= [0m[38;2;248;248;242mnodes[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcompileToFragments options[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcurrentLine [0m[38;2;249;38;114m= [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m currentLine [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mheader[0m
|
||||
[38;2;248;248;242m currentLine [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mshiftLine[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcurrentColumn [0m[38;2;249;38;114m= [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mjs [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m fragment [0m[38;2;249;38;114min[0m[38;2;248;248;242m fragments[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Update the sourcemap with data from each fragment.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m generateSourceMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Do not include empty, whitespace, or semicolon-only fragments.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m fragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlocationData [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m [0m[38;2;246;170;17m/^[;\s]*$/[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtest fragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m
|
||||
[38;2;248;248;242m map[0m[38;2;248;248;242m.[0m[38;2;248;248;242madd[0m[38;2;255;255;255m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242mfragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlocationData[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfirst_line[0m[38;2;248;248;242m, [0m[38;2;248;248;242mfragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlocationData[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfirst_column[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242mcurrentLine[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcurrentColumn[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242mnoReplace[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m}[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mnewLines [0m[38;2;249;38;114m= [0m[38;2;248;248;242mhelpers[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcount fragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m currentLine [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m newLines[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m newLines[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcurrentColumn [0m[38;2;249;38;114m= [0m[38;2;248;248;242mfragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;248;248;242mfragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlastIndexOf[0m[38;2;255;255;255m([0m[38;2;230;219;116m"[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m currentColumn [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m fragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Copy the code from each fragment into the final JavaScript.[0m
|
||||
[38;2;248;248;242m js [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m fragment[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mheader[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mheader [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116mGenerated by CoffeeScript [0m[38;2;230;159;102m#{[0m[38;2;255;255;255m@VERSION[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mjs [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116m// [0m[38;2;230;159;102m#{[0m[38;2;230;219;116mheader[0m[38;2;230;159;102m}[0m[38;2;190;132;255m\n[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mjs[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m generateSourceMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mv3SourceMap [0m[38;2;249;38;114m= [0m[38;2;248;248;242mmap[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgenerate options[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcode[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mtypeof[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile [0m[38;2;249;38;114misnt[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mobject[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m This only happens if run via the Node API and `transpile` is set to[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m something other than an object.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mthrow[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mError[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mThe transpile option must be given an object with options to pass to Babel[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Get the reference to Babel that we have been passed if this compiler[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m is run via the CLI or Node API.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtranspiler [0m[38;2;249;38;114m= [0m[38;2;248;248;242moptions[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mdelete[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtranspilerOptions [0m[38;2;249;38;114m= [0m[3;38;2;166;226;46mObject[0m[38;2;248;248;242m.[0m[38;2;248;248;242massign [0m[38;2;248;248;242m{[0m[38;2;248;248;242m}[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtranspile[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m See https://github.com/babel/babel/issues/827#issuecomment-77573107:[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Babel can take a v3 source map object as input in `inputSourceMap`[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m and it will return an *updated* v3 source map object in its output.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m v3SourceMap [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m transpilerOptions[0m[38;2;248;248;242m.[0m[38;2;248;248;242minputSourceMap[0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtranspilerOptions.inputSourceMap [0m[38;2;249;38;114m= [0m[38;2;248;248;242mv3SourceMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtranspilerOutput [0m[38;2;249;38;114m= [0m[38;2;248;248;242mtranspiler js[0m[38;2;248;248;242m, [0m[38;2;248;248;242mtranspilerOptions[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mjs [0m[38;2;249;38;114m= [0m[38;2;248;248;242mtranspilerOutput[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcode[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m v3SourceMap [0m[38;2;249;38;114mand[0m[38;2;248;248;242m transpilerOutput[0m[38;2;248;248;242m.[0m[38;2;102;217;239mmap[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mv3SourceMap [0m[38;2;249;38;114m= [0m[38;2;248;248;242mtranspilerOutput[0m[38;2;248;248;242m.[0m[38;2;102;217;239mmap[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242minlineMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mencoded [0m[38;2;249;38;114m= [0m[38;2;248;248;242mbase64encode JSON[0m[38;2;248;248;242m.[0m[38;2;248;248;242mstringify v3SourceMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceMapDataURI [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116m//# sourceMappingURL=data:application/json;base64,[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mencoded[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceURL [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116m//# sourceURL=[0m[38;2;230;159;102m#{[0m[38;2;230;219;116moptions[0m[38;2;230;219;116m.[0m[38;2;230;219;116mfilename [0m[38;2;249;38;114m?[0m[38;2;230;219;116m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mcoffeescript[0m[38;2;230;219;116m'[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mjs [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mjs[0m[38;2;230;159;102m}[0m[38;2;190;132;255m\n[0m[38;2;230;159;102m#{[0m[38;2;230;219;116msourceMapDataURI[0m[38;2;230;159;102m}[0m[38;2;190;132;255m\n[0m[38;2;230;159;102m#{[0m[38;2;230;219;116msourceURL[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m registerCompiled filename[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcode[0m[38;2;248;248;242m, [0m[38;2;248;248;242mmap[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m options[0m[38;2;248;248;242m.[0m[38;2;248;248;242msourceMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m js[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceMap[0m[38;2;248;248;242m:[0m[38;2;248;248;242m map[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mv3SourceMap[0m[38;2;248;248;242m:[0m[38;2;248;248;242m JSON[0m[38;2;248;248;242m.[0m[38;2;248;248;242mstringify v3SourceMap[0m[38;2;248;248;242m, [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m js[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Tokenize a string of CoffeeScript code, and return the array of tokens.[0m
|
||||
[38;2;248;248;242mexports.tokens [0m[38;2;249;38;114m= [0m[38;2;248;248;242mwithPrettyErrors [0m[3;38;2;253;151;31m(code, options)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m lexer[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtokenize code[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Parse a string of CoffeeScript code or an array of lexed tokens, and[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m return the AST. You can then compile it by calling `.compile()` on the root,[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m or traverse it by using `.traverseChildren()` with a callback.[0m
|
||||
[38;2;248;248;242mexports.nodes [0m[38;2;249;38;114m= [0m[38;2;248;248;242mwithPrettyErrors [0m[3;38;2;253;151;31m(source, options)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msource [0m[38;2;249;38;114m= [0m[38;2;248;248;242mlexer[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtokenize source[0m[38;2;248;248;242m, [0m[38;2;248;248;242moptions [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mtypeof[0m[38;2;248;248;242m source [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mstring[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m parser[0m[38;2;248;248;242m.[0m[38;2;248;248;242mparse source[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m This file used to export these methods; leave stubs that throw warnings[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m instead. These methods have been moved into `index.coffee` to provide[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m separate entrypoints for Node and non-Node environments, so that static[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m analysis tools don’t choke on Node packages when compiling for a non-Node[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m environment.[0m
|
||||
[38;2;248;248;242mexports.run [0m[38;2;249;38;114m= [0m[38;2;248;248;242mexports.eval [0m[38;2;249;38;114m= [0m[38;2;166;226;46mexports.registe[0m[38;2;166;226;46mr[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mthrow[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mError[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mrequire index.coffee, not this file[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Instantiate a Lexer for our use here.[0m
|
||||
[38;2;248;248;242mlexer [0m[38;2;249;38;114m= [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mLexer[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m The real Lexer produces a generic stream of tokens. This object provides a[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m thin wrapper around it, compatible with the Jison API. We can then pass it[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m directly as a “Jison lexer.”[0m
|
||||
[38;2;248;248;242mparser.lexer [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242myylloc[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mrange[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242moptions[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mranges[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255myes[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mle[0m[38;2;166;226;46mx[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtoken [0m[38;2;249;38;114m= [0m[38;2;248;248;242mparser[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtokens[0m[38;2;248;248;242m[[0m[38;2;255;255;255m@pos[0m[38;2;249;38;114m++[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m token[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m[[0m[38;2;248;248;242mtag[0m[38;2;248;248;242m, [0m[38;2;255;255;255m@yytext[0m[38;2;248;248;242m, [0m[38;2;255;255;255m@yylloc[0m[38;2;249;38;114m] =[0m[38;2;248;248;242m token[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mparser.errorToken [0m[38;2;249;38;114m= [0m[38;2;248;248;242mtoken[0m[38;2;248;248;242m.[0m[38;2;248;248;242morigin [0m[38;2;249;38;114mor[0m[38;2;248;248;242m token[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255m@yylineno[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m@yylloc[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfirst_line[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtag [0m[38;2;249;38;114m= [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m tag[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46msetInpu[0m[38;2;166;226;46mt[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(tokens)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mparser.tokens [0m[38;2;249;38;114m= [0m[38;2;248;248;242mtokens[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255m@pos[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mupcomingInpu[0m[38;2;166;226;46mt[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Make all the AST nodes visible to the parser.[0m
|
||||
[38;2;248;248;242mparser.yy [0m[38;2;249;38;114m= [0m[38;2;102;217;239mrequire[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./nodes[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Override Jison's default error handling function.[0m
|
||||
[38;2;166;226;46mparser.yy.parseErro[0m[38;2;166;226;46mr[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(message, {token})[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Disregard Jison's message, it contains redundant line number information.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Disregard the token, we take its value directly from the lexer in case[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m the error is caused by a generated token which might refer to its origin.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m{[0m[38;2;248;248;242merrorToken[0m[38;2;248;248;242m, [0m[38;2;248;248;242mtokens[0m[38;2;249;38;114m} =[0m[38;2;248;248;242m parser[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m[[0m[38;2;248;248;242merrorTag[0m[38;2;248;248;242m, [0m[38;2;248;248;242merrorText[0m[38;2;248;248;242m, [0m[38;2;248;248;242merrorLoc[0m[38;2;249;38;114m] =[0m[38;2;248;248;242m errorToken[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242merrorText [0m[38;2;249;38;114m= [0m[38;2;249;38;114mswitch[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m errorToken [0m[38;2;249;38;114mis[0m[38;2;248;248;242m tokens[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokens[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mend of input[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m errorTag [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116mINDENT[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mOUTDENT[0m[38;2;230;219;116m'[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mindentation[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m errorTag [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116mIDENTIFIER[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mNUMBER[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mINFINITY[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mSTRING[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mSTRING_START[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mREGEX[0m[38;2;230;219;116m'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116mREGEX_START[0m[38;2;230;219;116m'[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m errorTag[0m[38;2;248;248;242m.[0m[38;2;248;248;242mreplace[0m[38;2;255;255;255m([0m[38;2;246;170;17m/_START$/[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtoLowerCase[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m helpers[0m[38;2;248;248;242m.[0m[38;2;248;248;242mnameWhitespaceCharacter errorText[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m The second argument has a `loc` property, which should have the location[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m data for this token. Unfortunately, Jison seems to send an outdated `loc`[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m (from the previous token), so we take the location information directly[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m from the lexer.[0m
|
||||
[38;2;248;248;242m helpers[0m[38;2;248;248;242m.[0m[38;2;248;248;242mthrowSyntaxError [0m[38;2;230;219;116m"[0m[38;2;230;219;116munexpected [0m[38;2;230;159;102m#{[0m[38;2;230;219;116merrorText[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;248;248;242merrorLoc[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Based on http://v8.googlecode.com/svn/branches/bleeding_edge/src/messages.js[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Modified to handle sourceMap[0m
|
||||
[38;2;166;226;46mformatSourcePositio[0m[38;2;166;226;46mn[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(frame, getSourceMapping)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfilename [0m[38;2;249;38;114m= [0m[38;2;190;132;255mundefined[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfileLocation [0m[38;2;249;38;114m= [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m frame[0m[38;2;248;248;242m.[0m[38;2;248;248;242misNative[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfileLocation [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116mnative[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m frame[0m[38;2;248;248;242m.[0m[38;2;248;248;242misEval[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfilename [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetScriptNameOrSourceURL[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfileLocation [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mframe[0m[38;2;230;219;116m.[0m[38;2;230;219;116mgetEvalOrigin[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;230;159;102m}[0m[38;2;230;219;116m, [0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114munless[0m[38;2;248;248;242m filename[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfilename [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetFileName[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
|
||||
[38;2;248;248;242m filename [0m[38;2;249;38;114mor=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mline [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetLineNumber[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcolumn [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetColumnNumber[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Check for a sourceMap position[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msource [0m[38;2;249;38;114m= [0m[38;2;248;248;242mgetSourceMapping filename[0m[38;2;248;248;242m, [0m[38;2;248;248;242mline[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcolumn[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfileLocation [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m source[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfilename[0m[38;2;230;159;102m}[0m[38;2;230;219;116m:[0m[38;2;230;159;102m#{[0m[38;2;230;219;116msource[0m[38;2;230;219;116m[[0m[38;2;190;132;255m0[0m[38;2;230;219;116m][0m[38;2;230;159;102m}[0m[38;2;230;219;116m:[0m[38;2;230;159;102m#{[0m[38;2;230;219;116msource[0m[38;2;230;219;116m[[0m[38;2;190;132;255m1[0m[38;2;230;219;116m][0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfilename[0m[38;2;230;159;102m}[0m[38;2;230;219;116m:[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mline[0m[38;2;230;159;102m}[0m[38;2;230;219;116m:[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mcolumn[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfunctionName [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetFunctionName[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242misConstructor [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242misConstructor[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242misMethodCall [0m[38;2;249;38;114m= [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242misToplevel[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mor[0m[38;2;248;248;242m isConstructor[0m[38;2;255;255;255m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m isMethodCall[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mmethodName [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetMethodName[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtypeName [0m[38;2;249;38;114m= [0m[38;2;248;248;242mframe[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetTypeName[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m functionName[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtp [0m[38;2;249;38;114m= [0m[38;2;248;248;242mas [0m[38;2;249;38;114m= [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m typeName [0m[38;2;249;38;114mand[0m[38;2;248;248;242m functionName[0m[38;2;248;248;242m.[0m[38;2;102;217;239mindexOf[0m[38;2;248;248;242m typeName[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mtp [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mtypeName[0m[38;2;230;159;102m}[0m[38;2;230;219;116m.[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m methodName [0m[38;2;249;38;114mand[0m[38;2;248;248;242m functionName[0m[38;2;248;248;242m.[0m[38;2;102;217;239mindexOf[0m[38;2;255;255;255m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mmethodName[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114misnt[0m[38;2;248;248;242m functionName[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m-[0m[38;2;248;248;242m methodName[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mas [0m[38;2;249;38;114m= [0m[38;2;230;219;116m"[0m[38;2;230;219;116m [as [0m[38;2;230;159;102m#{[0m[38;2;230;219;116mmethodName[0m[38;2;230;159;102m}[0m[38;2;230;219;116m][0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mtp[0m[38;2;230;159;102m}[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfunctionName[0m[38;2;230;159;102m}[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mas[0m[38;2;230;159;102m}[0m[38;2;230;219;116m ([0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfileLocation[0m[38;2;230;159;102m}[0m[38;2;230;219;116m)[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mtypeName[0m[38;2;230;159;102m}[0m[38;2;230;219;116m.[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mmethodName [0m[38;2;249;38;114mor[0m[38;2;230;219;116m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m[38;2;230;159;102m}[0m[38;2;230;219;116m ([0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfileLocation[0m[38;2;230;159;102m}[0m[38;2;230;219;116m)[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m isConstructor[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mnew [0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfunctionName [0m[38;2;249;38;114mor[0m[38;2;230;219;116m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m[38;2;230;159;102m}[0m[38;2;230;219;116m ([0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfileLocation[0m[38;2;230;159;102m}[0m[38;2;230;219;116m)[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m functionName[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfunctionName[0m[38;2;230;159;102m}[0m[38;2;230;219;116m ([0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfileLocation[0m[38;2;230;159;102m}[0m[38;2;230;219;116m)[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m fileLocation[0m
|
||||
|
||||
[38;2;166;226;46mgetSourceMa[0m[38;2;166;226;46mp[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(filename, line, column)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Skip files that we didn’t compile, like Node system files that appear in[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m the stack trace, as they never have source maps.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m [0m[38;2;249;38;114munless[0m[38;2;248;248;242m filename [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114mor[0m[38;2;248;248;242m filename[0m[38;2;248;248;242m.[0m[38;2;102;217;239mslice[0m[38;2;255;255;255m([0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlastIndexOf[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116m.[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m FILE_EXTENSIONS[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m filename [0m[38;2;249;38;114misnt[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m sourceMaps[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m sourceMaps[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;248;248;242m[[0m[38;2;248;248;242msourceMaps[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m CoffeeScript compiled in a browser or via `CoffeeScript.compile` or `.run`[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m may get compiled with `options.filename` that’s missing, which becomes[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m `<anonymous>`; but the runtime might request the stack trace with the[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m filename of the script file. See if we have a source map cached under[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m `<anonymous>` that matches the error.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sourceMaps[0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m[38;2;248;248;242m][0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Work backwards from the most recent anonymous source maps, until we find[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m one that works. This isn’t foolproof; there is a chance that multiple[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m source maps will have line/column pairs that match. But we have no other[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m way to match them. `frame.getFunction().toString()` doesn’t always work,[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m and it’s not foolproof either.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m map [0m[38;2;249;38;114min[0m[38;2;248;248;242m sourceMaps[0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116m<anonymous>[0m[38;2;230;219;116m'[0m[38;2;248;248;242m] [0m[38;2;249;38;114mby[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceLocation [0m[38;2;249;38;114m= [0m[38;2;248;248;242mmap[0m[38;2;248;248;242m.[0m[38;2;248;248;242msourceLocation [0m[38;2;248;248;242m[[0m[38;2;248;248;242mline [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcolumn [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m map [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sourceLocation[0m[38;2;249;38;114m?[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m][0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m sourceLocation[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;249;38;114m?[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m If all else fails, recompile this source to get a source map. We need the[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m previous section (for `<anonymous>`) despite this option, because after it[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m gets compiled we will still need to look it up from[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m `sourceMaps['<anonymous>']` in order to find and return it. That’s why we[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m start searching from the end in the previous block, because most of the[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m time the source map we want is the last one.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sources[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242manswer [0m[38;2;249;38;114m= [0m[38;2;248;248;242mcompile sources[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;248;248;242m[[0m[38;2;248;248;242msources[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m][0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfilename[0m[38;2;248;248;242m:[0m[38;2;248;248;242m filename[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceMap[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255myes[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mliterate[0m[38;2;248;248;242m:[0m[38;2;248;248;242m helpers[0m[38;2;248;248;242m.[0m[38;2;248;248;242misLiterate filename[0m
|
||||
[38;2;248;248;242m answer[0m[38;2;248;248;242m.[0m[38;2;248;248;242msourceMap[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Based on [michaelficarra/CoffeeScriptRedux](http://goo.gl/ZTx1p)[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m NodeJS / V8 have no support for transforming positions in stack traces using[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m sourceMap, so we must monkey-patch Error to display CoffeeScript source[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m positions.[0m
|
||||
[38;2;166;226;46mError.prepareStackTrac[0m[38;2;166;226;46me[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(err, stack)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mgetSourceMappin[0m[38;2;166;226;46mg[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(filename, line, column)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msourceMap [0m[38;2;249;38;114m= [0m[38;2;248;248;242mgetSourceMap filename[0m[38;2;248;248;242m, [0m[38;2;248;248;242mline[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcolumn[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242manswer [0m[38;2;249;38;114m= [0m[38;2;248;248;242msourceMap[0m[38;2;248;248;242m.[0m[38;2;248;248;242msourceLocation [0m[38;2;248;248;242m[[0m[38;2;248;248;242mline [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mcolumn [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m] [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sourceMap[0m[38;2;249;38;114m?[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m answer[0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242manswer[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242manswer[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m] [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m] [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mframes [0m[38;2;249;38;114m= [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m frame [0m[38;2;249;38;114min[0m[38;2;248;248;242m stack[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mbreak[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m frame[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetFunction[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m exports[0m[38;2;248;248;242m.[0m[38;2;248;248;242mrun[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m at [0m[38;2;230;159;102m#{[0m[38;2;230;219;116mformatSourcePosition frame[0m[38;2;230;219;116m, [0m[38;2;230;219;116mgetSourceMapping[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;159;102m#{[0m[38;2;230;219;116merr[0m[38;2;230;219;116m.[0m[38;2;102;217;239mtoString[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;230;159;102m}[0m[38;2;190;132;255m\n[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mframes[0m[38;2;230;219;116m.[0m[38;2;102;217;239mjoin[0m[38;2;230;219;116m [0m[38;2;230;219;116m'[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m'[0m[38;2;230;159;102m}[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;166;226;46mcheckShebangLin[0m[38;2;166;226;46me[0m[38;2;166;226;46m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(file, input)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mfirstLine [0m[38;2;249;38;114m= [0m[38;2;248;248;242minput[0m[38;2;248;248;242m.[0m[38;2;248;248;242msplit[0m[38;2;255;255;255m([0m[38;2;246;170;17m/$/m[0m[38;2;255;255;255m)[0m[38;2;248;248;242m[[0m[38;2;190;132;255m0[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mrest [0m[38;2;249;38;114m= [0m[38;2;248;248;242mfirstLine[0m[38;2;249;38;114m?[0m[38;2;248;248;242m.[0m[38;2;248;248;242mmatch[0m[38;2;255;255;255m([0m[38;2;246;170;17m/^#!\s*([^\s]+\s*)(.*)/[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242margs [0m[38;2;249;38;114m= [0m[38;2;248;248;242mrest[0m[38;2;249;38;114m?[0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;249;38;114m?[0m[38;2;248;248;242m.[0m[38;2;248;248;242msplit[0m[38;2;255;255;255m([0m[38;2;246;170;17m/\s/[0m[38;2;255;255;255m)[0m[38;2;248;248;242m.[0m[38;2;102;217;239mfilter[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m(s)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m s [0m[38;2;249;38;114misnt[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m args[0m[38;2;249;38;114m?[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength [0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m console[0m[38;2;248;248;242m.[0m[38;2;102;217;239merror[0m[38;2;248;248;242m [0m[38;2;230;219;116m'''[0m
|
||||
[38;2;230;219;116m The script to be run begins with a shebang line with more than one[0m
|
||||
[38;2;230;219;116m argument. This script will fail on platforms such as Linux which only[0m
|
||||
[38;2;230;219;116m allow a single argument.[0m
|
||||
[38;2;230;219;116m [0m[38;2;230;219;116m'''[0m
|
||||
[38;2;248;248;242m console[0m[38;2;248;248;242m.[0m[38;2;102;217;239merror[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mThe shebang line was: '[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfirstLine[0m[38;2;230;159;102m}[0m[38;2;230;219;116m' in file '[0m[38;2;230;159;102m#{[0m[38;2;230;219;116mfile[0m[38;2;230;159;102m}[0m[38;2;230;219;116m'[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m console[0m[38;2;248;248;242m.[0m[38;2;102;217;239merror[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mThe arguments were: [0m[38;2;230;159;102m#{[0m[38;2;230;219;116mJSON[0m[38;2;230;219;116m.[0m[38;2;230;219;116mstringify args[0m[38;2;230;159;102m}[0m[38;2;230;219;116m"[0m
|
182
tests/syntax-tests/highlighted/F#/string.fs
vendored
Normal file
182
tests/syntax-tests/highlighted/F#/string.fs
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
[38;2;117;113;94m// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.[0m
|
||||
|
||||
[38;2;249;38;114mnamespace[0m[38;2;166;226;46m [0m[38;2;166;226;46mMicrosoft.FSharp.Core[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mSystem[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mSystem[0m[38;2;166;226;46m.[0m[38;2;166;226;46mText[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mMicrosoft[0m[38;2;166;226;46m.[0m[38;2;166;226;46mFSharp[0m[38;2;166;226;46m.[0m[38;2;166;226;46mCore[0m[38;2;166;226;46m.[0m[38;2;166;226;46mLanguagePrimitives[0m[38;2;166;226;46m.[0m[38;2;166;226;46mIntrinsicOperators[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mMicrosoft[0m[38;2;166;226;46m.[0m[38;2;166;226;46mFSharp[0m[38;2;166;226;46m.[0m[38;2;166;226;46mCore[0m[38;2;166;226;46m.[0m[38;2;166;226;46mOperators[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mMicrosoft[0m[38;2;166;226;46m.[0m[38;2;166;226;46mFSharp[0m[38;2;166;226;46m.[0m[38;2;166;226;46mCore[0m[38;2;166;226;46m.[0m[38;2;166;226;46mOperators[0m[38;2;166;226;46m.[0m[38;2;166;226;46mChecked[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mMicrosoft[0m[38;2;166;226;46m.[0m[38;2;166;226;46mFSharp[0m[38;2;166;226;46m.[0m[38;2;166;226;46mCollections[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mopen[0m[38;2;248;248;242m [0m[38;2;166;226;46mMicrosoft[0m[38;2;166;226;46m.[0m[38;2;166;226;46mFSharp[0m[38;2;166;226;46m.[0m[38;2;166;226;46mPrimitives[0m[38;2;166;226;46m.[0m[38;2;166;226;46mBasics[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompilationRepresentation[0m[38;2;249;38;114m([0m[38;2;102;217;239mCompilationRepresentationFlags.ModuleSuffix[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<RequireQualifiedAccess>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmodule[0m[38;2;166;226;46m [0m[38;2;166;226;46mString [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<Literal>][0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/// LOH threshold is calculated from Internal.Utilities.Library.LOH_SIZE_THRESHOLD_BYTES,[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/// and is equal to 80_000 / sizeof<char>[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mLOH_CHAR_THRESHOLD[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m40_000[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mLength[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mlength[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m isNull str [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m str.Length[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mConcat[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mconcat[0m[3;38;2;253;151;31m sep [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstrings [0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mseq[0m[38;2;249;38;114m<[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m>[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mconcatArray[0m[3;38;2;253;151;31m sep [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstrings[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mstring [0m[38;2;249;38;114m[[0m[38;2;249;38;114m][0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m length sep [0m[38;2;249;38;114mwith[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m String.Concat strings[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// following line should be used when this overload becomes part of .NET Standard (it's only in .NET Core)[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//| 1 -> String.Join(sep.[0], strings, 0, strings.Length)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m String.Join[0m[38;2;249;38;114m([0m[38;2;248;248;242msep[0m[38;2;249;38;114m,[0m[38;2;248;248;242m strings[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m,[0m[38;2;248;248;242m strings.Length[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m strings [0m[38;2;249;38;114mwith[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m:[0m[38;2;248;248;242m? array[0m[38;2;249;38;114m<[0m[38;2;248;248;242mstring[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;249;38;114mas[0m[38;2;248;248;242m arr [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m concatArray sep arr[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m:[0m[38;2;248;248;242m? list[0m[38;2;249;38;114m<[0m[38;2;248;248;242mstring[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;249;38;114mas[0m[38;2;248;248;242m lst [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m lst [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m List.toArray [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m concatArray sep[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m
|
||||
[38;2;248;248;242m String.Join[0m[38;2;249;38;114m([0m[38;2;248;248;242msep[0m[38;2;249;38;114m,[0m[38;2;248;248;242m strings[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mIterate[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242miter[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31maction [0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;166;226;46mchar [0m[38;2;249;38;114m->[0m[38;2;166;226;46m unit[0m[38;2;249;38;114m)[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;248;248;242mString.IsNullOrEmpty str[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mto[0m[38;2;248;248;242m str.Length [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mdo[0m
|
||||
[38;2;248;248;242m action str.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mIterateIndexed[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242miteri[0m[3;38;2;253;151;31m action [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;248;248;242mString.IsNullOrEmpty str[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mf[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m OptimizedClosures.FSharpFunc[0m[38;2;249;38;114m<[0m[38;2;249;38;114m_[0m[38;2;249;38;114m,[0m[38;2;249;38;114m_[0m[38;2;249;38;114m,[0m[38;2;249;38;114m_[0m[38;2;249;38;114m>[0m[38;2;248;248;242m.Adapt[0m[38;2;249;38;114m([0m[38;2;248;248;242maction[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mto[0m[38;2;248;248;242m str.Length [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mdo[0m
|
||||
[38;2;248;248;242m f.Invoke[0m[38;2;249;38;114m([0m[38;2;248;248;242mi[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mMap[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mmap[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mmapping[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mchar [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mchar[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m String.IsNullOrEmpty str [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m String.Empty[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mresult[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m str.ToCharArray[0m[38;2;190;132;255m()[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet mutable[0m[38;2;248;248;242m [0m[38;2;248;248;242mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m c [0m[38;2;249;38;114min[0m[38;2;248;248;242m result [0m[38;2;249;38;114mdo[0m
|
||||
[38;2;248;248;242m result.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m mapping c[0m
|
||||
[38;2;248;248;242m i [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m String[0m[38;2;249;38;114m([0m[38;2;248;248;242mresult[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mMapIndexed[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mmapi[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mmapping[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mint [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mchar [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mchar[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mlen[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m length str[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m len [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m String.Empty[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mresult[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m str.ToCharArray[0m[38;2;190;132;255m()[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mf[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m OptimizedClosures.FSharpFunc[0m[38;2;249;38;114m<[0m[38;2;249;38;114m_[0m[38;2;249;38;114m,[0m[38;2;249;38;114m_[0m[38;2;249;38;114m,[0m[38;2;249;38;114m_[0m[38;2;249;38;114m>[0m[38;2;248;248;242m.Adapt[0m[38;2;249;38;114m([0m[38;2;248;248;242mmapping[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet mutable[0m[38;2;248;248;242m [0m[38;2;248;248;242mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhile[0m[38;2;248;248;242m i [0m[38;2;249;38;114m<[0m[38;2;248;248;242m len [0m[38;2;249;38;114mdo[0m
|
||||
[38;2;248;248;242m result.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m f.Invoke[0m[38;2;249;38;114m([0m[38;2;248;248;242mi[0m[38;2;249;38;114m,[0m[38;2;248;248;242m result.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m i [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m String[0m[38;2;249;38;114m([0m[38;2;248;248;242mresult[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mFilter[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mfilter[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mpredicate[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mchar [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mbool[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mlen[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m length str[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m len [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m String.Empty[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melif[0m[38;2;248;248;242m len [0m[38;2;249;38;114m>[0m[38;2;248;248;242m LOH[0m[38;2;249;38;114m_[0m[38;2;248;248;242mCHAR[0m[38;2;249;38;114m_[0m[38;2;248;248;242mTHRESHOLD [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// By using SB here, which is twice slower than the optimized path, we prevent LOH allocations [0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// and 'stop the world' collections if the filtering results in smaller strings.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// We also don't pre-allocate SB here, to allow for less mem pressure when filter result is small.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mres[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m StringBuilder[0m[38;2;190;132;255m()[0m
|
||||
[38;2;248;248;242m str [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m iter [0m[38;2;249;38;114m([0m[38;2;249;38;114mfun[0m[3;38;2;253;151;31m c [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m predicate c [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m res.Append c [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m ignore[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m res.ToString[0m[38;2;190;132;255m()[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Must do it this way, since array.fs is not yet in scope, but this is safe[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mtarget[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked len[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet mutable[0m[38;2;248;248;242m [0m[38;2;248;248;242mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m c [0m[38;2;249;38;114min[0m[38;2;248;248;242m str [0m[38;2;249;38;114mdo[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m predicate c [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m target.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m c[0m
|
||||
[38;2;248;248;242m i [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
|
||||
[38;2;248;248;242m String[0m[38;2;249;38;114m([0m[38;2;248;248;242mtarget[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m,[0m[38;2;248;248;242m i[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mCollect[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mcollect[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mmapping[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mchar [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m String.IsNullOrEmpty str [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m String.Empty[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mres[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m StringBuilder str.Length[0m
|
||||
[38;2;248;248;242m str [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m iter [0m[38;2;249;38;114m([0m[38;2;249;38;114mfun[0m[3;38;2;253;151;31m c [0m[38;2;249;38;114m->[0m[38;2;248;248;242m res.Append[0m[38;2;249;38;114m([0m[38;2;248;248;242mmapping c[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m ignore[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m res.ToString[0m[38;2;190;132;255m()[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mInitialize[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242minit[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mcount[0m[38;2;249;38;114m:[0m[38;2;166;226;46mint[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31minitializer[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mint[0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m count [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m invalidArgInputMustBeNonNegative [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcount[0m[38;2;230;219;116m"[0m[38;2;248;248;242m count[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mres[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m StringBuilder count[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mto[0m[38;2;248;248;242m count [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mdo[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m res.Append[0m[38;2;249;38;114m([0m[38;2;248;248;242minitializer i[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m ignore[0m
|
||||
[38;2;248;248;242m res.ToString[0m[38;2;190;132;255m()[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mReplicate[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mreplicate[0m[3;38;2;253;151;31m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mcount[0m[38;2;249;38;114m:[0m[38;2;166;226;46mint[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m count [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m invalidArgInputMustBeNonNegative [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcount[0m[38;2;230;219;116m"[0m[38;2;248;248;242m count[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mlen[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m length str[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m len [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m count [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m String.Empty[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melif[0m[38;2;248;248;242m len [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m String[0m[38;2;249;38;114m([0m[38;2;248;248;242mstr.[0m[38;2;249;38;114m[[0m[38;2;190;132;255m0[0m[38;2;249;38;114m][0m[38;2;249;38;114m,[0m[38;2;248;248;242m count[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melif[0m[38;2;248;248;242m count [0m[38;2;249;38;114m<[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m4[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m count [0m[38;2;249;38;114mwith[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m str[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m String.Concat[0m[38;2;249;38;114m([0m[38;2;248;248;242mstr[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m String.Concat[0m[38;2;249;38;114m([0m[38;2;248;248;242mstr[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m String.Concat[0m[38;2;249;38;114m([0m[38;2;248;248;242mstr[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str[0m[38;2;249;38;114m,[0m[38;2;248;248;242m str[0m[38;2;249;38;114m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Using the primitive, because array.fs is not yet in scope. It's safe: both len and count are positive.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mtarget[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked [0m[38;2;249;38;114m([0m[38;2;248;248;242mlen [0m[38;2;249;38;114m*[0m[38;2;248;248;242m count[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242msource[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m str.ToCharArray[0m[38;2;190;132;255m()[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// O(log(n)) performance loop:[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Copy first string, then keep copying what we already copied [0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// (i.e., doubling it) until we reach or pass the halfway point[0m
|
||||
[38;2;248;248;242m Array.Copy[0m[38;2;249;38;114m([0m[38;2;248;248;242msource[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m,[0m[38;2;248;248;242m target[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m,[0m[38;2;248;248;242m len[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet mutable[0m[38;2;248;248;242m [0m[38;2;248;248;242mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m len[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhile[0m[38;2;248;248;242m i [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m target.Length [0m[38;2;249;38;114mdo[0m
|
||||
[38;2;248;248;242m Array.Copy[0m[38;2;249;38;114m([0m[38;2;248;248;242mtarget[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m,[0m[38;2;248;248;242m target[0m[38;2;249;38;114m,[0m[38;2;248;248;242m i[0m[38;2;249;38;114m,[0m[38;2;248;248;242m i[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m i [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m i [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// finally, copy the remain half, or less-then half[0m
|
||||
[38;2;248;248;242m Array.Copy[0m[38;2;249;38;114m([0m[38;2;248;248;242mtarget[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;249;38;114m,[0m[38;2;248;248;242m target[0m[38;2;249;38;114m,[0m[38;2;248;248;242m i[0m[38;2;249;38;114m,[0m[38;2;248;248;242m target.Length [0m[38;2;249;38;114m-[0m[38;2;248;248;242m i[0m[38;2;249;38;114m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m String[0m[38;2;249;38;114m([0m[38;2;248;248;242mtarget[0m[38;2;249;38;114m)[0m
|
||||
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mForAll[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mforall[0m[3;38;2;253;151;31m predicate [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m String.IsNullOrEmpty str [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;249;38;114m rec[0m[38;2;248;248;242m [0m[38;2;248;248;242mcheck[0m[3;38;2;253;151;31m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;248;248;242mi [0m[38;2;249;38;114m>[0m[38;2;249;38;114m=[0m[38;2;248;248;242m str.Length[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;248;248;242mpredicate str.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m check [0m[38;2;249;38;114m([0m[38;2;248;248;242mi[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;249;38;114m)[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m check [0m[38;2;190;132;255m0[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m[<CompiledName[0m[38;2;249;38;114m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mExists[0m[38;2;230;219;116m"[0m[38;2;249;38;114m)[0m[38;2;102;217;239m>][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mexists[0m[3;38;2;253;151;31m predicate [0m[38;2;249;38;114m([0m[3;38;2;253;151;31mstr[0m[38;2;249;38;114m:[0m[38;2;166;226;46mstring[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m String.IsNullOrEmpty str [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlet[0m[38;2;249;38;114m rec[0m[38;2;248;248;242m [0m[38;2;248;248;242mcheck[0m[3;38;2;253;151;31m i [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;248;248;242mi [0m[38;2;249;38;114m<[0m[38;2;248;248;242m str.Length[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;249;38;114m([0m[38;2;248;248;242mpredicate str.[0m[38;2;249;38;114m[[0m[38;2;248;248;242mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m check [0m[38;2;249;38;114m([0m[38;2;248;248;242mi[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;249;38;114m)[0m[38;2;249;38;114m)[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m check [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m
|
323
tests/syntax-tests/highlighted/Fortran (Fixed Form)/quicksort_real_F77.F
vendored
Normal file
323
tests/syntax-tests/highlighted/Fortran (Fixed Form)/quicksort_real_F77.F
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
[38;2;117;113;94mC Fortran 77 implementation of a quicksort algorithm for arrays with[0m
|
||||
[38;2;117;113;94mC real entries.[0m
|
||||
[38;2;117;113;94mC ----------[0m
|
||||
[38;2;117;113;94mC June 2019 [0m
|
||||
[38;2;117;113;94mC Jason Allen Anema, Ph.D.[0m
|
||||
[38;2;117;113;94mC Division of Statistical Genomics[0m
|
||||
[38;2;117;113;94mC Department of Genetics[0m
|
||||
[38;2;117;113;94mC Washington University School of Medicine in St. Louis[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;117;113;94mC This work is partially supported NIH grant AG023746[0m
|
||||
[38;2;117;113;94mC ----------[0m
|
||||
[38;2;117;113;94mC Insertion sort is used for short arrays, as quicksort is slower on[0m
|
||||
[38;2;117;113;94mC these.[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;117;113;94mC Hoare partition scheme is used (sweeping left and right), as it does[0m
|
||||
[38;2;117;113;94mC three times fewer swaps on average that the Lamuto partition scheme.[0m
|
||||
[38;2;117;113;94mC In conjunction with this, tripartite partition is performed[0m
|
||||
[38;2;117;113;94mC concurrently (solving the "Dutch National Flag problem"). This avoids [0m
|
||||
[38;2;117;113;94mC horrible runtimes on highly repetitive arrays. For example, without [0m
|
||||
[38;2;117;113;94mC this, an array of random zeros and ones would have a runtime of[0m
|
||||
[38;2;117;113;94mC O(N^2), but now has a runtime of O(N). The runtime for this algorthm[0m
|
||||
[38;2;117;113;94mC on arrays with k highly repetitive entries is now O(kN).[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;117;113;94mC For medium length (sub)arrays, pivots are choosen using[0m
|
||||
[38;2;117;113;94mC Median-of-Three, and those three items are sorted. For longer (sub)arrays[0m
|
||||
[38;2;117;113;94mC the pseudomedian of nine (Median of medians). This avoids O(N^2) runtime on[0m
|
||||
[38;2;117;113;94mC nonrandom inputs such as increasing and decreasing sequences. [0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC See Louis Bentley, Jon & McIlroy, Douglas. (1993). Engineering a Sort Function.[0m
|
||||
[38;2;117;113;94mC Softw., Pract. Exper.. 23. 1249-1265. 10.1002/spe.4380231105 for details. [0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC The ordering on elements of the array are defined by a comparison[0m
|
||||
[38;2;117;113;94mC function,compar, that is a user-supplied INTEGER*2 function of the form[0m
|
||||
[38;2;117;113;94mC compar(a,b) which returns:[0m
|
||||
[38;2;117;113;94mC -1 if a precedes b[0m
|
||||
[38;2;117;113;94mC +1 if b precedes a[0m
|
||||
[38;2;117;113;94mC 0 is a and b are considered equivalent[0m
|
||||
[38;2;117;113;94mC and thus defines a total ordering.[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;117;113;94mC If one would like to use the standard order on integers, the[0m
|
||||
[38;2;117;113;94mC compar function could be written in a file "compint.F" as:[0m
|
||||
[38;2;117;113;94mC ----------------------------------------------------------------[0m
|
||||
[38;2;117;113;94mC INTEGER*2 FUNCTION compint(a,b)[0m
|
||||
[38;2;117;113;94mC INTEGER a, b[0m
|
||||
[38;2;117;113;94mC if(a.lt.b)then[0m
|
||||
[38;2;117;113;94mC compint = -1[0m
|
||||
[38;2;117;113;94mC elseif(a.gt.b)then[0m
|
||||
[38;2;117;113;94mC compint = +1[0m
|
||||
[38;2;117;113;94mC else[0m
|
||||
[38;2;117;113;94mC compint = 0[0m
|
||||
[38;2;117;113;94mC endif[0m
|
||||
[38;2;117;113;94mC END[0m
|
||||
[38;2;117;113;94mC ----------------------------------------------------------------[0m
|
||||
[38;2;117;113;94mC Then in your program, call quicksort with:[0m
|
||||
[38;2;117;113;94mC call quicksort_real_F77(array, n, compint)[0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC The maximal length of an array in this implementation is (2^31-1),[0m
|
||||
[38;2;117;113;94mC but can be changed to allow for length up to (2^63-1) by changing the[0m
|
||||
[38;2;117;113;94mC data types of the relevant variables and constants. If you wish to [0m
|
||||
[38;2;117;113;94mC sort longer arrays, of length N, you'll need to customize variable [0m
|
||||
[38;2;117;113;94mC and constant types and set mstack to be at least (2*log_2(N)+2). [0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC ----------------------------------------------------------------[0m
|
||||
[38;2;117;113;94mC Copyright 2019 Jason Allen Anema[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;117;113;94mC Permission is hereby granted, free of charge, to any person obtaining[0m
|
||||
[38;2;117;113;94mC a copy of this software and associated documentation files (the "Software"),[0m
|
||||
[38;2;117;113;94mC to deal in the Software without restriction, including without limitation the[0m
|
||||
[38;2;117;113;94mC rights to use, copy, modify, merge, publish, distribute, sublicense, and/or[0m
|
||||
[38;2;117;113;94mC sell copies of the Software, and to permit persons to whom the Software is[0m
|
||||
[38;2;117;113;94mC furnished to do so, subject to the following conditions:[0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC The above copyright notice and this permission notice shall be included[0m
|
||||
[38;2;117;113;94mC in all copies or substantial portions of the Software.[0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS[0m
|
||||
[38;2;117;113;94mC OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,[0m
|
||||
[38;2;117;113;94mC FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL[0m
|
||||
[38;2;117;113;94mC THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER[0m
|
||||
[38;2;117;113;94mC LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING[0m
|
||||
[38;2;117;113;94mC FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS[0m
|
||||
[38;2;117;113;94mC IN THE SOFTWARE.[0m
|
||||
[38;2;117;113;94mC -------------------------------------------------------------------[0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mSUBROUTINE[0m[38;2;248;248;242m [0m[38;2;166;226;46mquicksort_real_F77[0m[38;2;248;248;242m([0m[3;38;2;253;151;31marray[0m[38;2;248;248;242m,[0m[3;38;2;253;151;31mn[0m[38;2;248;248;242m,[0m[3;38;2;253;151;31mcompar[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mINTEGER[0m[38;2;248;248;242m n, maxins, maxmid, mstack[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mREAL[0m[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(n)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mPARAMETER[0m[38;2;248;248;242m (maxins[0m[38;2;249;38;114m = [0m[38;2;190;132;255m7[0m[38;2;248;248;242m, maxmid[0m[38;2;249;38;114m = [0m[38;2;190;132;255m40[0m[38;2;248;248;242m, mstack[0m[38;2;249;38;114m = [0m[38;2;190;132;255m128[0m[38;2;248;248;242m)[0m
|
||||
[38;2;117;113;94mC maxins: maximal size of (sub)arrays to be sorted with[0m
|
||||
[38;2;117;113;94mC insertion sort.[0m
|
||||
[38;2;117;113;94mC maxmid: maximal size of (sub)arrays that will be quicksorted with[0m
|
||||
[38;2;117;113;94mC Median-of-Three pivots.[0m
|
||||
[38;2;117;113;94mC mstack: maximal size of required auxiliary storage (a stack), plus 2 [0m
|
||||
[38;2;117;113;94mC extra spots, which tracks the starts and ends of yet unsorted [0m
|
||||
[38;2;117;113;94mC subarrays. mstack = 130 is large enough to handle arrays up to [0m
|
||||
[38;2;117;113;94mC length 2^63-1. This maximal size follows from[0m
|
||||
[38;2;117;113;94mC processing smaller arrays first and pigeonhole principal.[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mINTEGER[0m[38;2;248;248;242m a, d, i, j, k, s, lo, mid, hi, tstack, [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(mstack)[0m
|
||||
[38;2;117;113;94mC a, d, i, j, k, s: indices[0m
|
||||
[38;2;117;113;94mC lo, mid, and hi: their natural location in a (sub)array[0m
|
||||
[38;2;117;113;94mC tstack: equal to twice the number of additional subarrays still [0m
|
||||
[38;2;117;113;94mC needing to be sorted[0m
|
||||
[38;2;117;113;94mC bstack: stack of the endpoints of unsorted subarrays[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mINTEGER[0m[38;2;248;248;242m pm1, pm2, pm3, pm4, pm5, pm6, pm7, pm8, pm9[0m
|
||||
[38;2;117;113;94mC for pseudomedian of nine positions in (sub)arrays[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mREAL[0m[38;2;248;248;242m piv, temp[0m
|
||||
[38;2;117;113;94mC piv is to store the pivot's value[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mEXTERNAL[0m[38;2;248;248;242m compar[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mINTEGER[0m[38;2;249;38;114m*[0m[38;2;190;132;255m2[0m[38;2;248;248;242m compar[0m
|
||||
[38;2;117;113;94mC compar is a user-supplied INTEGER*2 function of the form[0m
|
||||
[38;2;117;113;94mC compar(a,b) which returns:[0m
|
||||
[38;2;117;113;94mC -1 if a precedes b[0m
|
||||
[38;2;117;113;94mC +1 if b precedes a[0m
|
||||
[38;2;117;113;94mC 0 is a and b are considered equivalent[0m
|
||||
[38;2;117;113;94mC and thus defines a total ordering. [0m
|
||||
[38;2;248;248;242m tstack[0m[38;2;249;38;114m = [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m lo[0m[38;2;249;38;114m = [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m hi[0m[38;2;249;38;114m = [0m[38;2;248;248;242mn[0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC Insertion sort subarrays of size maxins or less[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1.[0m[38;2;248;248;242mle.maxins)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mdo[0m[38;2;248;248;242m [0m[38;2;190;132;255m10[0m[38;2;248;248;242m, i[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, hi, 1[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mdo[0m[3;38;2;253;151;31m 11 [0m[38;2;248;248;242mj[0m[38;2;249;38;114m = [0m[38;2;248;248;242mi [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, lo, [0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j), temp)[0m[38;2;249;38;114m.le.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m2[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114m=[0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m11[0m[38;2;248;248;242m [0m[38;2;249;38;114mcontinue[0m
|
||||
[38;2;248;248;242m j[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m10[0m[38;2;248;248;242m [0m[38;2;249;38;114mcontinue[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(tstack[0m[38;2;249;38;114m.eq.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;249;38;114mreturn[0m
|
||||
[38;2;117;113;94mC Pop the bstack, and start new partitioning[0m
|
||||
[38;2;248;248;242m hi[0m[38;2;249;38;114m = [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(tstack)[0m
|
||||
[38;2;248;248;242m lo[0m[38;2;249;38;114m = [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(tstack[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m tstack[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtstack [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;117;113;94mC Use Median-of-Three as choice of pivot (median of lo, middle, hi)[0m
|
||||
[38;2;117;113;94mC and reorder those elements appropriately when subarrays are medium[0m
|
||||
[38;2;117;113;94mC length (between maxins and maxmid)[0m
|
||||
[38;2;248;248;242m mid[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo[0m[38;2;249;38;114m.le.[0m[38;2;248;248;242mmaxmid)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Use pseudomedian of nine (Median of medians) as choice of pivot when [0m
|
||||
[38;2;117;113;94mC subarrays are longer than maxmid. Note that doing it this way requires only 12[0m
|
||||
[38;2;117;113;94mC comparisons for finding the pivot.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melseif[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1.[0m[38;2;248;248;242mgt.maxmid)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m pm1[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo[0m
|
||||
[38;2;248;248;242m pm5[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m pm9[0m[38;2;249;38;114m = [0m[38;2;248;248;242mhi[0m
|
||||
[38;2;248;248;242m pm3[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (pm5[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m pm7[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpm5 [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mpm5)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m pm2[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (pm3[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m pm4[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpm3 [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (pm5[0m[38;2;249;38;114m-[0m[38;2;248;248;242mpm3)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m pm6[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpm5 [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (pm7[0m[38;2;249;38;114m-[0m[38;2;248;248;242mpm5)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m pm8[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpm7 [0m[38;2;249;38;114m+[0m[38;2;248;248;242m (pm9[0m[38;2;249;38;114m-[0m[38;2;248;248;242mpm7)[0m[38;2;249;38;114m/[0m[38;2;190;132;255m2[0m
|
||||
[38;2;117;113;94mC Median and sorting for pm1, pm2, pm3[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm1))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm1)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm1)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm3), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm1))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm3)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm3)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm1)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm1)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm3), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm3)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm3)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Median and sorting for pm4, pm5, pm6[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm4))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm4)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm4)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm6), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm4))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm6)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm6)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm4)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm4)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm6), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm6)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm6)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Median and sorting for pm7, pm8, pm9[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm7))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm7)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm7)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm9), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm7))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm9)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm9)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm7)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm7)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm9), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm9)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm9)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Median of the medians (which are now pm2, pm5, pm8)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm2)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8), [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5))[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm8)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(pm5)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Pivot assigned for medium and long length subarrays.[0m
|
||||
[38;2;117;113;94mC Note that pm5 = mid[0m
|
||||
[38;2;248;248;242m piv[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(mid)[0m
|
||||
[38;2;117;113;94mC Initialize pointers for partitioning[0m
|
||||
[38;2;248;248;242m i[0m[38;2;249;38;114m = [0m[38;2;248;248;242mlo[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m j[0m[38;2;249;38;114m = [0m[38;2;248;248;242mhi[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m
|
||||
[38;2;117;113;94mC Initialize counts of repeat values of pivot.[0m
|
||||
[38;2;248;248;242m a[0m[38;2;249;38;114m = [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m d[0m[38;2;249;38;114m = [0m[38;2;190;132;255m0[0m
|
||||
[38;2;117;113;94mC Beginning of outer loop for placing pivot.[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m3[0m[38;2;248;248;242m [0m[38;2;249;38;114mcontinue[0m
|
||||
[38;2;117;113;94mC Scan up to find an element > piv.[0m
|
||||
[38;2;248;248;242m i[0m[38;2;249;38;114m = [0m[38;2;248;248;242mi [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;117;113;94mC Check if pointers crossed.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m.lt.[0m[38;2;248;248;242mi)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m5[0m
|
||||
[38;2;117;113;94mC Check if i pointer hit hi boundary.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(i[0m[38;2;249;38;114m.eq.[0m[38;2;248;248;242mhi)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m4[0m
|
||||
[38;2;117;113;94mC [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i), piv)[0m[38;2;249;38;114m.eq.[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m3[0m
|
||||
[38;2;117;113;94mC Check for copies of pivot from scanning right. [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i), piv)[0m[38;2;249;38;114m.eq.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo[0m[38;2;249;38;114m+[0m[38;2;248;248;242ma)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo[0m[38;2;249;38;114m+[0m[38;2;248;248;242ma)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpiv[0m
|
||||
[38;2;248;248;242m a[0m[38;2;249;38;114m = [0m[38;2;248;248;242ma [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m3[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Beginning of innerloop for placing pivot.[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m4[0m[38;2;248;248;242m [0m[38;2;249;38;114mcontinue[0m
|
||||
[38;2;117;113;94mC Scan down to find an element < piv.[0m
|
||||
[38;2;248;248;242m j[0m[38;2;249;38;114m = [0m[38;2;248;248;242mj [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;117;113;94mC Check if pointers crossed.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m.lt.[0m[38;2;248;248;242mi)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m5[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j), piv)[0m[38;2;249;38;114m.eq.[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m4[0m
|
||||
[38;2;117;113;94mC Check for copies of pivot from scanning left. [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m([0m[38;2;248;248;242mcompar[0m[38;2;248;248;242m([0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j), piv)[0m[38;2;249;38;114m.eq.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242md)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242md)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpiv[0m
|
||||
[38;2;248;248;242m d[0m[38;2;249;38;114m = [0m[38;2;248;248;242md [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m4[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC Check if pointers crossed.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m.lt.[0m[38;2;248;248;242mi)[0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m5[0m
|
||||
[38;2;117;113;94mC Exchange elements[0m
|
||||
[38;2;248;248;242m temp[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtemp[0m
|
||||
[38;2;117;113;94mC End of outermost loop for placing pivot.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m3[0m
|
||||
[38;2;117;113;94mC Insert all copies of pivot in appropriate place[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m5[0m[38;2;248;248;242m s[0m[38;2;249;38;114m = [0m[38;2;102;217;239mMIN[0m[38;2;248;248;242m(a, j[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo[0m[38;2;249;38;114m-[0m[38;2;248;248;242ma[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mDO[0m[3;38;2;253;151;31m 6 [0m[38;2;248;248;242mk[0m[38;2;249;38;114m = [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, s[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(lo[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;249;38;114m+[0m[38;2;248;248;242mk)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i[0m[38;2;249;38;114m-[0m[38;2;248;248;242mk)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(i[0m[38;2;249;38;114m-[0m[38;2;248;248;242mk)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpiv[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m6[0m[38;2;248;248;242m [0m[38;2;249;38;114mCONTINUE[0m
|
||||
[38;2;248;248;242m s[0m[38;2;249;38;114m = [0m[38;2;102;217;239mMIN[0m[38;2;248;248;242m(d, hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mj[0m[38;2;249;38;114m-[0m[38;2;248;248;242md)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mDO[0m[3;38;2;253;151;31m 7 [0m[38;2;248;248;242mk[0m[38;2;249;38;114m = [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, s[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;249;38;114m-[0m[38;2;248;248;242mk)[0m[38;2;249;38;114m = [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m+[0m[38;2;248;248;242mk)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242marray[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m+[0m[38;2;248;248;242mk)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mpiv[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m7[0m[38;2;248;248;242m [0m[38;2;249;38;114mCONTINUE[0m
|
||||
[38;2;117;113;94mC Increase effective stack size[0m
|
||||
[38;2;248;248;242m tstack[0m[38;2;249;38;114m = [0m[38;2;248;248;242mtstack [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m
|
||||
[38;2;117;113;94mC Push pointers to larger subarray on stack for later processing,[0m
|
||||
[38;2;117;113;94mC process smaller subarray immediately. [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(tstack[0m[38;2;249;38;114m.gt.[0m[38;2;248;248;242mmstack) [0m[38;2;249;38;114mTHEN[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mWRITE[0m[38;2;248;248;242m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m,[0m[38;2;249;38;114m*[0m[38;2;248;248;242m)[0m[38;2;230;219;116m'Stack size is too small in quicksort fortran code quicksort_real_F77.F'[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mWRITE[0m[38;2;248;248;242m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m,[0m[38;2;249;38;114m*[0m[38;2;248;248;242m)[0m[38;2;230;219;116m'Are you sure you want to sort an array this long?'[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mWRITE[0m[38;2;248;248;242m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m,[0m[38;2;249;38;114m*[0m[38;2;248;248;242m)[0m[38;2;230;219;116m'Your array has more than 2^63-1 entries?'[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mWRITE[0m[38;2;248;248;242m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m,[0m[38;2;249;38;114m*[0m[38;2;248;248;242m)[0m[38;2;230;219;116m'If so, set mstack parameter to be at least:'[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mWRITE[0m[38;2;248;248;242m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m,[0m[38;2;249;38;114m*[0m[38;2;248;248;242m)[0m[38;2;230;219;116m'2*ceiling(log_2(N))+2, for N = length of array,'[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mWRITE[0m[38;2;248;248;242m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m,[0m[38;2;249;38;114m*[0m[38;2;248;248;242m)[0m[38;2;230;219;116m'and recompile this subroutine.'[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mRETURN[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m(hi[0m[38;2;249;38;114m-[0m[38;2;248;248;242mj[0m[38;2;249;38;114m-[0m[38;2;248;248;242md[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1.[0m[38;2;248;248;242mge.j[0m[38;2;249;38;114m-[0m[38;2;248;248;242ma[0m[38;2;249;38;114m-[0m[38;2;248;248;242mlo)[0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(tstack)[0m[38;2;249;38;114m = [0m[38;2;248;248;242mhi[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(tstack[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114m = [0m[38;2;102;217;239mMIN[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m+[0m[38;2;248;248;242md[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, hi)[0m
|
||||
[38;2;248;248;242m hi[0m[38;2;249;38;114m=[0m[38;2;102;217;239mMAX[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m-[0m[38;2;248;248;242ma,lo)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(tstack)[0m[38;2;249;38;114m=[0m[38;2;102;217;239mMAX[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m-[0m[38;2;248;248;242ma,lo)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mbstack[0m[38;2;248;248;242m(tstack[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;249;38;114m=[0m[38;2;248;248;242mlo[0m
|
||||
[38;2;248;248;242m lo[0m[38;2;249;38;114m=[0m[38;2;102;217;239mMIN[0m[38;2;248;248;242m(j[0m[38;2;249;38;114m+[0m[38;2;248;248;242md[0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m[38;2;248;248;242m,hi)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;117;113;94mC[0m
|
||||
[38;2;117;113;94mC end of outermost if statement [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgoto[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m1[0m
|
||||
[38;2;117;113;94mC END of subroutine quicksort[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mEND[0m
|
119
tests/syntax-tests/highlighted/Fortran (Modern)/test_savetxt.f90
vendored
Normal file
119
tests/syntax-tests/highlighted/Fortran (Modern)/test_savetxt.f90
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
[38;2;249;38;114mprogram[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_savetxt[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstdlib_kinds[0m[38;2;248;248;242m, [0m[38;2;249;38;114monly[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mint32[0m[38;2;248;248;242m, sp, dp[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstdlib_io[0m[38;2;248;248;242m, [0m[38;2;249;38;114monly[0m[38;2;248;248;242m:[0m[38;2;248;248;242m loadtxt, savetxt[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstdlib_error[0m[38;2;248;248;242m, [0m[38;2;249;38;114monly[0m[38;2;248;248;242m:[0m[38;2;248;248;242m check[0m
|
||||
[38;2;249;38;114mimplicit[0m[38;2;248;248;242m [0m[38;2;249;38;114mnone[0m
|
||||
|
||||
[3;38;2;102;217;239mcharacter(:)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mallocatable[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
|
||||
[38;2;248;248;242moutpath [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mget_outpath[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m//[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/tmp.dat"[0m
|
||||
|
||||
[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mtest_iint32[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mtest_rsp[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mtest_rdp[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mtest_csp[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mtest_cdp[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;249;38;114mcontains[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mget_outpath[0m[38;2;248;248;242m([0m[38;2;248;248;242m) [0m[38;2;249;38;114mresult[0m[38;2;248;248;242m([0m[3;38;2;253;151;31moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m integer [0m[38;2;249;38;114m::[0m[38;2;248;248;242m ierr[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(256)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255margv[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(:)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mallocatable[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mget_command_argument[0m[38;2;248;248;242m([0m[38;2;190;132;255m1[0m[38;2;248;248;242m, argv, status[0m[38;2;249;38;114m=[0m[38;2;248;248;242mierr[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mierr[0m[38;2;249;38;114m==[0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m outpath [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mtrim[0m[38;2;248;248;242m([0m[38;2;248;248;242margv[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m outpath [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m'.'[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;249;38;114mif[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mget_outpath[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_iint32[0m[38;2;248;248;242m([0m[3;38;2;253;151;31moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(*)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mintent[0m[38;2;248;248;242m([0m[38;2;190;132;255min[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242minteger[0m[38;2;248;248;242m([0m[38;2;102;217;239mint32[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md[0m[38;2;248;248;242m([0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;248;248;242me[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242minteger[0m[38;2;248;248;242m([0m[38;2;102;217;239mint32[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, allocatable [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md2[0m[38;2;248;248;242m([0m[38;2;248;248;242m:[0m[38;2;248;248;242m,[0m[38;2;248;248;242m :[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m d [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242md[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m e [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, e[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242me[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m
|
||||
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_rsp[0m[38;2;248;248;242m([0m[3;38;2;253;151;31moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(*)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mintent[0m[38;2;248;248;242m([0m[38;2;190;132;255min[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreal[0m[38;2;248;248;242m([0m[38;2;248;248;242msp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md[0m[38;2;248;248;242m([0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;248;248;242me[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreal[0m[38;2;248;248;242m([0m[38;2;248;248;242msp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, allocatable [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md2[0m[38;2;248;248;242m([0m[38;2;248;248;242m:[0m[38;2;248;248;242m,[0m[38;2;248;248;242m :[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m d [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242md[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._sp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m e [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, e[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242me[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._sp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_rsp[0m
|
||||
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_rdp[0m[38;2;248;248;242m([0m[3;38;2;253;151;31moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(*)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mintent[0m[38;2;248;248;242m([0m[38;2;190;132;255min[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreal[0m[38;2;248;248;242m([0m[38;2;248;248;242mdp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md[0m[38;2;248;248;242m([0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;248;248;242me[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreal[0m[38;2;248;248;242m([0m[38;2;248;248;242mdp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, allocatable [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md2[0m[38;2;248;248;242m([0m[38;2;248;248;242m:[0m[38;2;248;248;242m,[0m[38;2;248;248;242m :[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m d [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242md[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._dp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m e [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, e[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242me[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._dp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_rdp[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_csp[0m[38;2;248;248;242m([0m[3;38;2;253;151;31moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(*)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mintent[0m[38;2;248;248;242m([0m[38;2;190;132;255min[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcomplex[0m[38;2;248;248;242m([0m[38;2;248;248;242msp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md[0m[38;2;248;248;242m([0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;248;248;242me[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcomplex[0m[38;2;248;248;242m([0m[38;2;248;248;242msp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, allocatable [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md2[0m[38;2;248;248;242m([0m[38;2;248;248;242m:[0m[38;2;248;248;242m,[0m[38;2;248;248;242m :[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m d [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mcmplx[0m[38;2;248;248;242m([0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,kind[0m[38;2;249;38;114m=[0m[38;2;248;248;242msp[0m[38;2;248;248;242m)[0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242md[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._sp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m e [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mcmplx[0m[38;2;248;248;242m([0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,kind[0m[38;2;249;38;114m=[0m[38;2;248;248;242msp[0m[38;2;248;248;242m)[0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, e[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242me[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._sp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_csp[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_cdp[0m[38;2;248;248;242m([0m[3;38;2;253;151;31moutpath[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcharacter(*)[0m[38;2;248;248;242m, [0m[38;2;249;38;114mintent[0m[38;2;248;248;242m([0m[38;2;190;132;255min[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;255;255;255moutpath[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcomplex[0m[38;2;248;248;242m([0m[38;2;248;248;242mdp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md[0m[38;2;248;248;242m([0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;248;248;242me[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mcomplex[0m[38;2;248;248;242m([0m[38;2;248;248;242mdp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, allocatable [0m[38;2;249;38;114m::[0m[38;2;248;248;242m [0m[38;2;248;248;242md2[0m[38;2;248;248;242m([0m[38;2;248;248;242m:[0m[38;2;248;248;242m,[0m[38;2;248;248;242m :[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m d [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mcmplx[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._dp[0m[38;2;248;248;242m, [0m[38;2;190;132;255m1._dp[0m[38;2;248;248;242m,kind[0m[38;2;249;38;114m=[0m[38;2;248;248;242mdp[0m[38;2;248;248;242m)[0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242md[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._dp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m e [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mcmplx[0m[38;2;248;248;242m([0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,kind[0m[38;2;249;38;114m=[0m[38;2;248;248;242mdp[0m[38;2;248;248;242m)[0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mreshape[0m[38;2;248;248;242m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m, [0m[38;2;190;132;255m4[0m[38;2;248;248;242m, [0m[38;2;190;132;255m5[0m[38;2;248;248;242m, [0m[38;2;190;132;255m6[0m[38;2;248;248;242m][0m[38;2;248;248;242m, [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239msavetxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, e[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mloadtxt[0m[38;2;248;248;242m([0m[38;2;248;248;242moutpath, d2[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mshape[0m[38;2;248;248;242m([0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcall[0m[38;2;248;248;242m [0m[38;2;102;217;239mcheck[0m[38;2;248;248;242m([0m[38;2;102;217;239mall[0m[38;2;248;248;242m([0m[38;2;102;217;239mabs[0m[38;2;248;248;242m([0m[38;2;248;248;242me[0m[38;2;249;38;114m-[0m[38;2;248;248;242md2[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;102;217;239mepsilon[0m[38;2;248;248;242m([0m[38;2;190;132;255m1._dp[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114msubroutine[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_cdp[0m
|
||||
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114mprogram[0m[38;2;248;248;242m [0m[38;2;166;226;46mtest_savetxt[0m
|
5
tests/syntax-tests/highlighted/Fortran Namelist/test.namelist
vendored
Normal file
5
tests/syntax-tests/highlighted/Fortran Namelist/test.namelist
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
[38;2;249;38;114m&[0m[3;38;2;102;217;239mTEST[0m
|
||||
[38;2;249;38;114mFOO[0m[38;2;249;38;114m=[0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m
|
||||
[38;2;249;38;114mBAR[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1.0[0m[38;2;248;248;242m,[0m
|
||||
[38;2;249;38;114mBAZ[0m[38;2;249;38;114m=[0m[38;2;230;219;116m'Hello, World!'[0m
|
||||
[38;2;249;38;114m/[0m
|
126
tests/syntax-tests/highlighted/Groff/rustdoc.1
vendored
Normal file
126
tests/syntax-tests/highlighted/Groff/rustdoc.1
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mTH[0m[38;2;248;248;242m [0m[38;2;166;226;46mRUSTDOC[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m1[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m<INSERT DATE HERE>[0m[38;2;230;219;116m"[0m[38;2;248;248;242m "rustdoc <INSERT VERSION HERE>" "User Commands"[0m
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46mNAME[0m
|
||||
[38;2;248;248;242mrustdoc [0m[38;2;190;132;255m\-[0m[38;2;248;248;242m generate documentation from Rust source code[0m
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46mSYNOPSIS[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mB[0m[38;2;248;248;242m [0m[1;38;2;249;38;114mrustdoc[0m
|
||||
[38;2;248;248;242m[[0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mOPTIONS[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m] [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mINPUT[0m[38;2;249;38;114m\fR[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46mDESCRIPTION[0m
|
||||
[38;2;248;248;242mThis tool generates API reference documentation by extracting comments from[0m
|
||||
[38;2;248;248;242msource code written in the Rust language, available at[0m
|
||||
[38;2;248;248;242m<[0m[38;2;249;38;114m\fB[0m[1;38;2;249;38;114mhttps://www.rust-lang.org[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m>. It accepts several input formats and[0m
|
||||
[38;2;248;248;242mprovides several output formats for the generated documentation.[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46mOPTIONS[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mr[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m, [0m[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114minput[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mformat[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFORMAT[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mrust[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mw[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m, [0m[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114moutput[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mformat[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFORMAT[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mhtml[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mo[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m, [0m[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114moutput[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mOUTPUT[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242mwhere to place the output (default: [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mdoc/[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m for html)[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mpasses[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mLIST[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mspace[0m[38;2;190;132;255m\[hy][0m[38;2;248;248;242mseparated list of passes to run (default: '')[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mno[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mdefaults[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mdon't run the default passes[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mplugins[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mLIST[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mspace-separated list of plugins to run (default: '')[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mplugin[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mpath[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mDIR[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mdirectory to load plugins from (default: [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112m/tmp/rustdoc_ng/plugins[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mtarget[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mTRIPLE[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mtarget triple to document[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcrate[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mname[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mNAME[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mspecify the name of this crate[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mL[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m, [0m[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mlibrary[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mpath[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mDIR[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mdirectory to add to crate search path[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcfg[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mSPEC[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mpass a [0m[38;2;249;38;114m\fI[0m[3;38;2;190;132;255m\-[0m[3;38;2;190;132;255m\-[0m[3;38;2;228;46;112mcfg[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m to rustc[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mextern[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mVAL[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mpass an [0m[38;2;249;38;114m\fI[0m[3;38;2;190;132;255m\-[0m[3;38;2;190;132;255m\-[0m[3;38;2;228;46;112mextern[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m to rustc[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mtest[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mrun code examples as tests[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mtest[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114margs[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mARGS[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mpass arguments to the test runner[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mhtml[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114min[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mheader[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFILE[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mfile to add to <head>[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mhtml[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mbefore[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcontent[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFILES[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mfiles to include inline between <body> and the content of a rendered Markdown[0m
|
||||
[38;2;248;248;242mfile or generated documentation[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mmarkdown[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mbefore[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcontent[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFILES[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mfiles to include inline between <body> and the content of a rendered[0m
|
||||
[38;2;248;248;242mMarkdown file or generated documentation[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mhtml[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mafter[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcontent[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFILES[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mfiles to include inline between the content and </body> of a rendered[0m
|
||||
[38;2;248;248;242mMarkdown file or generated documentation[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mmarkdown[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mafter[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcontent[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFILES[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mfiles to include inline between the content and </body> of a rendered[0m
|
||||
[38;2;248;248;242mMarkdown file or generated documentation[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mmarkdown[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcss[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mFILES[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mCSS files to include via <link> in a rendered Markdown file Markdown file or[0m
|
||||
[38;2;248;248;242mgenerated documentation[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mmarkdown[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mplayground[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114murl[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mURL[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mURL to send code snippets to[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mmarkdown[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mno[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mtoc[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mdon't include table of contents[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mh[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m, [0m[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mextend[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mcss[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mto redefine some css rules with a given file to generate doc with your own theme[0m
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mTP[0m
|
||||
[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mV[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m, [0m[38;2;249;38;114m\fB[0m[1;38;2;190;132;255m\-[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mversion[0m[38;2;249;38;114m\fR[0m
|
||||
[38;2;248;248;242mPrint rustdoc's version[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46m"OUTPUT FORMATS"[0m
|
||||
|
||||
[38;2;248;248;242mThe rustdoc tool can generate output in an HTML format.[0m
|
||||
|
||||
[38;2;248;248;242mIf using an HTML format, then the specified output destination will be the root[0m
|
||||
[38;2;248;248;242mdirectory of an HTML structure for all the documentation.[0m
|
||||
[38;2;248;248;242mPages will be placed into this directory, and source files will also[0m
|
||||
[38;2;248;248;242mpossibly be rendered into it as well.[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46m"EXAMPLES"[0m
|
||||
|
||||
[38;2;248;248;242mTo generate documentation for the source in the current directory:[0m
|
||||
[38;2;248;248;242m $ rustdoc hello.rs[0m
|
||||
|
||||
[38;2;248;248;242mList all available passes that rustdoc has, along with default passes:[0m
|
||||
[38;2;248;248;242m $ rustdoc [0m[38;2;190;132;255m\-[0m[38;2;190;132;255m\-[0m[38;2;248;248;242mpasses list[0m
|
||||
|
||||
[38;2;248;248;242mThe generated HTML can be viewed with any standard web browser.[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46m"SEE ALSO"[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[38;2;249;38;114mBR[0m[38;2;248;248;242m [0m[1;38;2;249;38;114mrustc[0m[38;2;248;248;242m (1)[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46m"BUGS"[0m
|
||||
[38;2;248;248;242mSee <[0m[38;2;249;38;114m\fB[0m[1;38;2;249;38;114mhttps://github.com/rust[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mlang/rust/issues[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m>[0m
|
||||
[38;2;248;248;242mfor issues.[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46m"AUTHOR"[0m
|
||||
[38;2;248;248;242mSee the version control history or <[0m[38;2;249;38;114m\fB[0m[1;38;2;249;38;114mhttps://thanks.rust[0m[1;38;2;190;132;255m\-[0m[1;38;2;249;38;114mlang.org[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m>[0m
|
||||
|
||||
[38;2;249;38;114m.[0m[3;38;2;102;217;239mSH[0m[38;2;248;248;242m [0m[38;2;166;226;46m"COPYRIGHT"[0m
|
||||
[38;2;248;248;242mThis work is dual[0m[38;2;190;132;255m\[hy][0m[38;2;248;248;242mlicensed under Apache[0m[38;2;190;132;255m\ [0m[38;2;248;248;242m2.0 and MIT terms.[0m
|
||||
[38;2;248;248;242mSee [0m[38;2;249;38;114m\fI[0m[3;38;2;228;46;112mCOPYRIGHT[0m[38;2;249;38;114m\fR[0m[38;2;248;248;242m file in the rust source distribution.[0m
|
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.bak
vendored
Normal file
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.bak
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m foo.bak (editor etc backup) should highlight same as foo[0m
|
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.dpkg-dist
vendored
Normal file
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.dpkg-dist
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m foo.dpkg-dist (Debian dpkg backup) should highlight same as foo[0m
|
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.dpkg-old
vendored
Normal file
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.dpkg-old
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m foo.dpkg-old (Debian dpkg backup) should highlight same as foo[0m
|
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.in
vendored
Normal file
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.in
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m foo.in (build system input) should highlight same as foo[0m
|
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.in.in
vendored
Normal file
1
tests/syntax-tests/highlighted/Ignored suffixes/test.rs.in.in
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m foo.in.in (build system input, doubly replaced) should highlight same as foo[0m
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user