mirror of
https://github.com/sharkdp/bat.git
synced 2025-07-26 00:39:45 +01:00
Compare commits
1 Commits
master
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
b58bd7cd1a |
.github/workflows
.gitmodulesCHANGELOG.mdCargo.lockCargo.tomlREADME.mdassets
build
doc
src
tests
23
.github/workflows/Auto-merge-dependabot-PRs.yml
vendored
Normal file
23
.github/workflows/Auto-merge-dependabot-PRs.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# This workflow triggers auto-merge of any PR that dependabot creates so that
|
||||
# PRs will be merged automatically without maintainer intervention if CI passes
|
||||
name: Auto-merge dependabot PRs
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
auto-merge:
|
||||
if: github.repository == 'sharkdp/bat' && startsWith(github.head_ref, 'dependabot/')
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: auto-merge
|
||||
url: https://github.com/sharkdp/bat/blob/main/.github/workflows/Auto-merge-dependabot-PRs.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.AUTO_MERGE_GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
gh pr review ${{ github.event.pull_request.number }} --comment --body "If CI passes, this dependabot PR will be [auto-merged](https://github.com/sharkdp/bat/blob/main/.github/workflows/Auto-merge-dependabot-PRs.yml) 🚀"
|
||||
- run: |
|
||||
gh pr merge --auto --squash ${{ github.event.pull_request.number }}
|
4
.github/workflows/CICD.yml
vendored
4
.github/workflows/CICD.yml
vendored
@@ -168,12 +168,12 @@ jobs:
|
||||
- { target: aarch64-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: arm64, use-cross: true }
|
||||
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-latest, dpkg_arch: armhf, use-cross: true }
|
||||
- { target: arm-unknown-linux-musleabihf, os: ubuntu-latest, dpkg_arch: musl-linux-armhf, use-cross: true }
|
||||
- { target: i686-pc-windows-msvc , os: windows-2025, }
|
||||
- { target: i686-pc-windows-msvc , os: windows-2019, }
|
||||
- { target: i686-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: i686, use-cross: true }
|
||||
- { target: i686-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: musl-linux-i686, use-cross: true }
|
||||
- { target: x86_64-apple-darwin , os: macos-13, }
|
||||
- { target: aarch64-apple-darwin , os: macos-14, }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2025, }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2019, }
|
||||
- { target: x86_64-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: amd64, use-cross: true }
|
||||
- { target: x86_64-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: musl-linux-amd64, use-cross: true }
|
||||
env:
|
||||
|
11
.gitmodules
vendored
11
.gitmodules
vendored
@@ -196,7 +196,7 @@
|
||||
branch = bat-source
|
||||
[submodule "assets/syntaxes/02_Extra/Lean"]
|
||||
path = assets/syntaxes/02_Extra/Lean
|
||||
url = https://github.com/leanprover/vscode-lean4.git
|
||||
url = https://github.com/leanprover/vscode-lean.git
|
||||
[submodule "assets/syntaxes/02_Extra/Zig"]
|
||||
path = assets/syntaxes/02_Extra/Zig
|
||||
url = https://github.com/ziglang/sublime-zig-language.git
|
||||
@@ -269,12 +269,3 @@
|
||||
[submodule "assets/syntaxes/02_Extra/sublime-odin"]
|
||||
path = assets/syntaxes/02_Extra/sublime-odin
|
||||
url = https://github.com/odin-lang/sublime-odin
|
||||
[submodule "assets/syntaxes/02_Extra/typst-syntax-highlight"]
|
||||
path = assets/syntaxes/02_Extra/typst-syntax-highlight
|
||||
url = https://github.com/hyrious/typst-syntax-highlight
|
||||
[submodule "assets/themes/Catppuccin"]
|
||||
path = assets/themes/Catppuccin
|
||||
url = https://github.com/SchweGELBin/catppuccin-bat-sub.git
|
||||
[submodule "assets/syntaxes/02_Extra/SmartVHDL"]
|
||||
path = assets/syntaxes/02_Extra/SmartVHDL
|
||||
url = https://github.com/TheClams/SmartVHDL
|
||||
|
19
CHANGELOG.md
19
CHANGELOG.md
@@ -7,27 +7,17 @@
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix UTF-8 BOM not being stripped for syntax detection, see #3314 (@krikera)
|
||||
- Fix `BAT_THEME_DARK` and `BAT_THEME_LIGHT` being ignored, see issue #3171 and PR #3168 (@bash)
|
||||
- Prevent `--list-themes` from outputting default theme info to stdout when it is piped, see #3189 (@einfachIrgendwer0815)
|
||||
- Rename some submodules to fix Dependabot submodule updates, see issue #3198 and PR #3201 (@victor-gp)
|
||||
- Make highlight tests fail when new syntaxes don't have fixtures PR #3255 (@dan-hipschman)
|
||||
- Fix crash for multibyte characters in file path, see issue #3230 and PR #3245 (@HSM95)
|
||||
- Add missing mappings for various bash/zsh files, see PR #3262 (@AdamGaskins)
|
||||
- Send all bat errors to stderr by default, see #3336 (@JerryImMouse)
|
||||
- Make --map-syntax target case insensitive to match --language, see #3206 (@keith-hall)
|
||||
|
||||
## Other
|
||||
|
||||
- Update base16 README links to community driven base16 work #2871 (@JamyGolden)
|
||||
- Work around build failures when building `bat` from vendored sources #3179 (@dtolnay)
|
||||
- CICD: Stop building for x86_64-pc-windows-gnu which fails #3261 (Enselic)
|
||||
- CICD: CICD: replace windows-2019 runners with windows-2025 #3339 (@cyqsimon)
|
||||
- Build script: replace string-based codegen with quote-based codegen #3340 (@cyqsimon)
|
||||
- Improve code coverage of `--list-languages` parameter #2942 (@sblondon)
|
||||
- Only start offload worker thread when there's more than 1 core #2956 (@cyqsimon)
|
||||
- Update terminal-colorsaurus (the library used for dark/light detection) to 1.0, see #3347 (@bash)
|
||||
- Update console dependency to 0.16, see #3351 (@musicinmybrain)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
@@ -41,18 +31,9 @@
|
||||
- Add debsources syntax to highlight `/etc/apt/sources.list` files, see #3215 (@keith-hall)
|
||||
- Add syntax definition and test file for GDScript highlighting, see #3236 (@chetanjangir0)
|
||||
- Add syntax test file for Odin highlighting, see #3241 (@chetanjangir0)
|
||||
- Update quadlet syntax mapping rules to cover quadlets in subdirectories #3299 (@cyqsimon)
|
||||
- Add syntax Typst #3300 (@cskeeters)
|
||||
- Map `.mill` files to Scala syntax for Mill build tool configuration files #3311 (@krikera)
|
||||
- Add syntax highlighting for VHDL, see #3337 (@JerryImMouse)
|
||||
- Add syntax mapping for certbot certificate configuration #3338 (@cyqsimon)
|
||||
- Update Lean syntax from Lean 3 to Lean 4 #3322 (@YDX-2147483647)
|
||||
|
||||
## Themes
|
||||
|
||||
- Add Catppuccin, see #3317 (@SchweGELBin)
|
||||
- Updated Catppuccin, see #3333 (@SchweGELBin)
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
# v0.25.0
|
||||
|
211
Cargo.lock
generated
211
Cargo.lock
generated
@@ -141,9 +141,6 @@ dependencies = [
|
||||
"path_abs",
|
||||
"plist",
|
||||
"predicates",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"semver",
|
||||
"serde",
|
||||
@@ -152,14 +149,13 @@ dependencies = [
|
||||
"serde_yaml",
|
||||
"serial_test",
|
||||
"shell-words",
|
||||
"syn",
|
||||
"syntect",
|
||||
"tempfile",
|
||||
"terminal-colorsaurus",
|
||||
"thiserror 2.0.11",
|
||||
"toml",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"unicode-width 0.1.14",
|
||||
"wait-timeout",
|
||||
"walkdir",
|
||||
"wild",
|
||||
@@ -304,15 +300,15 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.16.0"
|
||||
version = "0.15.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e09ced7ebbccb63b4c65413d821f2e00ce54c5ca4514ddc6b3c892fdbcbc69d"
|
||||
checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"unicode-width",
|
||||
"windows-sys 0.60.2",
|
||||
"unicode-width 0.2.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -563,9 +559,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.2"
|
||||
version = "1.0.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||
checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
@@ -613,7 +609,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.13.3+wasi-0.2.2",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -976,9 +972,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||
checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
@@ -1093,7 +1089,7 @@ dependencies = [
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1166,21 +1162,11 @@ dependencies = [
|
||||
"termtree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.95"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1196,9 +1182,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.40"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -1344,9 +1330,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.0.0"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
|
||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1454,9 +1440,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
version = "2.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1536,9 +1522,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "terminal-colorsaurus"
|
||||
version = "1.0.0"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f7226dad4b1817567c1e2f5d453897ef36abe79def7783af3fa241a694e30b3"
|
||||
checksum = "858625398bdd5da7a96e8ad33a10031a50c3a5ad50d5aaa81a2827369a9c216c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
@@ -1546,14 +1532,13 @@ dependencies = [
|
||||
"mio",
|
||||
"terminal-trx",
|
||||
"windows-sys 0.59.0",
|
||||
"xterm-color",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal-trx"
|
||||
version = "0.2.4"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "975b4233aefa1b02456d5e53b22c61653c743e308c51cf4181191d8ce41753ab"
|
||||
checksum = "57a5b836e7f4f81afe61b5cd399eee774f25edcfd47009a76e29f53bb6487833"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
@@ -1659,43 +1644,39 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.9.1"
|
||||
version = "0.8.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0207d6ed1852c2a124c1fbec61621acb8330d2bf969a5d0643131e9affd985a5"
|
||||
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.7.0"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.0.0"
|
||||
name = "toml_edit"
|
||||
version = "0.22.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5c1c469eda89749d2230d8156a5969a69ffe0d6d01200581cdc6110674d293e"
|
||||
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b679217f2848de74cabd3e8fc5e6d66f40b7da40f8e1954d92054d9010690fd5"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
@@ -1714,6 +1695,12 @@ version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.0"
|
||||
@@ -1842,7 +1829,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132"
|
||||
dependencies = [
|
||||
"windows-core 0.56.0",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1852,7 +1839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
||||
dependencies = [
|
||||
"windows-core 0.57.0",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1864,7 +1851,7 @@ dependencies = [
|
||||
"windows-implement 0.56.0",
|
||||
"windows-interface 0.56.0",
|
||||
"windows-result",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1876,7 +1863,7 @@ dependencies = [
|
||||
"windows-implement 0.57.0",
|
||||
"windows-interface 0.57.0",
|
||||
"windows-result",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1929,7 +1916,7 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1938,7 +1925,7 @@ version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1947,16 +1934,7 @@ version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||
dependencies = [
|
||||
"windows-targets 0.53.2",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1965,30 +1943,14 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm 0.52.6",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.53.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.53.0",
|
||||
"windows_aarch64_msvc 0.53.0",
|
||||
"windows_i686_gnu 0.53.0",
|
||||
"windows_i686_gnullvm 0.53.0",
|
||||
"windows_i686_msvc 0.53.0",
|
||||
"windows_x86_64_gnu 0.53.0",
|
||||
"windows_x86_64_gnullvm 0.53.0",
|
||||
"windows_x86_64_msvc 0.53.0",
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1997,101 +1959,56 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.11"
|
||||
version = "0.6.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
|
||||
checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
@@ -2114,12 +2031,6 @@ version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
|
||||
|
||||
[[package]]
|
||||
name = "xterm-color"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4de5f056fb9dc8b7908754867544e26145767187aaac5a98495e88ad7cb8a80f"
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
|
14
Cargo.toml
14
Cargo.toml
@@ -45,14 +45,14 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
nu-ansi-term = "0.50.0"
|
||||
ansi_colours = "^1.2"
|
||||
bincode = "1.0"
|
||||
console = "0.16.0"
|
||||
flate2 = "1.1"
|
||||
console = "0.15.10"
|
||||
flate2 = "1.0"
|
||||
once_cell = "1.20"
|
||||
thiserror = "2.0"
|
||||
wild = { version = "2.2", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
shell-words = { version = "1.1.0", optional = true }
|
||||
unicode-width = "0.2.0"
|
||||
unicode-width = "0.1.13"
|
||||
globset = "0.4"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
@@ -68,7 +68,7 @@ walkdir = { version = "2.5", optional = true }
|
||||
bytesize = { version = "1.3.0" }
|
||||
encoding_rs = "0.8.35"
|
||||
execute = { version = "0.2.13", optional = true }
|
||||
terminal-colorsaurus = "1.0"
|
||||
terminal-colorsaurus = "0.4"
|
||||
unicode-segmentation = "1.12.0"
|
||||
itertools = "0.13.0"
|
||||
|
||||
@@ -108,15 +108,11 @@ anyhow = "1.0.97"
|
||||
indexmap = { version = "2.8.0", features = ["serde"] }
|
||||
itertools = "0.14.0"
|
||||
once_cell = "1.20"
|
||||
prettyplease = "0.2.35"
|
||||
proc-macro2 = "1.0.95"
|
||||
quote = "1.0.40"
|
||||
regex = "1.10.6"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_with = { version = "3.12.0", default-features = false, features = ["macros"] }
|
||||
syn = { version = "2.0.104", features = ["full"] }
|
||||
toml = { version = "0.9.1", features = ["preserve_order"] }
|
||||
toml = { version = "0.8.19", features = ["preserve_order"] }
|
||||
walkdir = "2.5"
|
||||
|
||||
[build-dependencies.clap]
|
||||
|
63
README.md
63
README.md
@@ -21,9 +21,8 @@
|
||||
|
||||
### Sponsors
|
||||
|
||||
A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br>
|
||||
A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsor</a>:<br>
|
||||
|
||||
<p>
|
||||
<a href="https://www.warp.dev/bat">
|
||||
<img src="doc/sponsors/warp-logo.png" width="200" alt="Warp">
|
||||
<br>
|
||||
@@ -31,13 +30,6 @@ A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsors</a>
|
||||
<br>
|
||||
<sub>Available on MacOS, Linux, Windows</sub>
|
||||
</a>
|
||||
</p><p>
|
||||
<a href="https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=bat">
|
||||
<img src="doc/sponsors/graphite-logo.jpeg" width="200" alt="Graphite">
|
||||
<br>
|
||||
<strong>Graphite is the AI developer productivity platform helping<br>teams on GitHub ship higher quality software, faster</strong>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
### Syntax highlighting
|
||||
|
||||
@@ -121,7 +113,7 @@ bat f - g # output 'f', then stdin, then 'g'.
|
||||
#### `fzf`
|
||||
|
||||
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
||||
use `bat`'s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||
option to restrict the load times for long files:
|
||||
|
||||
```bash
|
||||
@@ -178,7 +170,7 @@ You can combine `bat` with `git diff` to view lines around code changes with pro
|
||||
highlighting:
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --relative --diff-filter=d -z | xargs --null bat --diff
|
||||
git diff --name-only --relative --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
|
||||
@@ -257,8 +249,7 @@ abbr -a --position anywhere -- -h '-h | bat -plhelp'
|
||||
|
||||
This way, you can keep on using `cp --help`, but get colorized help pages.
|
||||
|
||||
Be aware that in some cases, `-h` may not be a shorthand of `--help` (for example with `ls`). In cases where you need to use `-h`
|
||||
as a command argument you can prepend `\` to the arguement (eg. `ls \-h`) to escape the aliasing defined above.
|
||||
Be aware that in some cases, `-h` may not be a shorthand of `--help` (for example with `ls`).
|
||||
|
||||
Please report any issues with the help syntax in [this repository](https://github.com/victor-gp/cmd-help-sublime-syntax).
|
||||
|
||||
@@ -285,11 +276,6 @@ mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
```
|
||||
|
||||
an example alias for `batcat` as `bat`:
|
||||
```bash
|
||||
alias bat="batcat"
|
||||
```
|
||||
|
||||
### On Ubuntu (using most recent `.deb` packages)
|
||||
*... and other Debian-based Linux distributions.*
|
||||
|
||||
@@ -433,7 +419,7 @@ take a look at the ["Using `bat` on Windows"](#using-bat-on-windows) section.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
You will need to install the [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist#latest-microsoft-visual-c-redistributable-version)
|
||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||
|
||||
#### With WinGet
|
||||
|
||||
@@ -474,25 +460,14 @@ binaries are also available: look for archives with `musl` in the file name.
|
||||
If you want to build `bat` from source, you need Rust 1.74.0 or
|
||||
higher. You can then use `cargo` to build everything:
|
||||
|
||||
#### From local source
|
||||
```bash
|
||||
cargo install --path . --locked
|
||||
```
|
||||
> [!NOTE]
|
||||
> The `--path .` above specifies the directory of the source code and NOT where `bat` will be installed.
|
||||
> For more information see the docs for [`cargo install`](https://doc.rust-lang.org/cargo/commands/cargo-install.html).
|
||||
|
||||
#### From `crates.io`
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
```
|
||||
|
||||
Note that additional files like the man page or shell completion
|
||||
files can not be installed automatically in both these ways.
|
||||
If installing from a local source, they will be generated by `cargo`
|
||||
and should be available in the cargo target folder under `build`.
|
||||
files can not be installed in this way. They will be generated by `cargo` and should be available in the cargo target folder (under `build`).
|
||||
|
||||
Furthermore, shell completions are also available by running:
|
||||
Shell completions are also available by running:
|
||||
```bash
|
||||
bat --completion <shell>
|
||||
# see --help for supported shells
|
||||
@@ -506,8 +481,8 @@ Use `bat --list-themes` to get a list of all available themes for syntax
|
||||
highlighting. To select the `TwoDark` theme, call `bat` with the
|
||||
`--theme=TwoDark` option or set the `BAT_THEME` environment variable to
|
||||
`TwoDark`. Use `export BAT_THEME="TwoDark"` in your shell's startup file to
|
||||
make the change permanent. Alternatively, use `bat`'s
|
||||
[configuration file](#configuration-file).
|
||||
make the change permanent. Alternatively, use `bat`s
|
||||
[configuration file](https://github.com/sharkdp/bat#configuration-file).
|
||||
|
||||
If you want to preview the different themes on a custom file, you can use
|
||||
the following command (you need [`fzf`](https://github.com/junegunn/fzf) for this):
|
||||
@@ -520,7 +495,7 @@ You can use the `--theme-dark` / `--theme-light` options or the `BAT_THEME_DARK`
|
||||
to customize the themes used. This is especially useful if you frequently switch between dark and light mode.
|
||||
|
||||
You can also use a custom theme by following the
|
||||
['Adding new themes' section below](#adding-new-themes).
|
||||
['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
|
||||
|
||||
### 8-bit themes
|
||||
|
||||
@@ -529,12 +504,12 @@ even when truecolor support is available:
|
||||
|
||||
- `ansi` looks decent on any terminal. It uses 3-bit colors: black, red, green,
|
||||
yellow, blue, magenta, cyan, and white.
|
||||
- `base16` is designed for [base16](https://github.com/tinted-theming/home) terminal themes. It uses
|
||||
- `base16` is designed for [base16](https://github.com/chriskempson/base16) terminal themes. It uses
|
||||
4-bit colors (3-bit colors plus bright variants) in accordance with the
|
||||
[base16 styling guidelines](https://github.com/tinted-theming/home/blob/main/styling.md).
|
||||
- `base16-256` is designed for [tinted-shell](https://github.com/tinted-theming/tinted-shell).
|
||||
[base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md).
|
||||
- `base16-256` is designed for [base16-shell](https://github.com/chriskempson/base16-shell).
|
||||
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 tinted-shell.
|
||||
because you have a 256-color terminal but are not using base16-shell.
|
||||
|
||||
Although these themes are more restricted, they have three advantages over truecolor themes. They:
|
||||
|
||||
@@ -544,11 +519,11 @@ Although these themes are more restricted, they have three advantages over truec
|
||||
|
||||
### Output style
|
||||
|
||||
You can use the `--style` option to control the appearance of `bat`'s output.
|
||||
You can use the `--style` option to control the appearance of `bat`s output.
|
||||
You can use `--style=numbers,changes`, for example, to show only Git changes
|
||||
and line numbers but no grid and no file header. Set the `BAT_STYLE` environment
|
||||
variable to make these changes permanent or use `bat`'s
|
||||
[configuration file](#configuration-file).
|
||||
variable to make these changes permanent or use `bat`s
|
||||
[configuration file](https://github.com/sharkdp/bat#configuration-file).
|
||||
|
||||
>[!tip]
|
||||
> If you specify a default style in `bat`'s config file, you can change which components
|
||||
@@ -665,7 +640,7 @@ If you want to pass command-line arguments to the pager, you can also set them v
|
||||
export BAT_PAGER="less -RF"
|
||||
```
|
||||
|
||||
Instead of using environment variables, you can also use `bat`'s [configuration file](#configuration-file) to configure the pager (`--pager` option).
|
||||
Instead of using environment variables, you can also use `bat`s [configuration file](https://github.com/sharkdp/bat#configuration-file) to configure the pager (`--pager` option).
|
||||
|
||||
|
||||
### Using `less` as a pager
|
||||
@@ -872,7 +847,7 @@ bash assets/create.sh
|
||||
cargo install --path . --locked --force
|
||||
```
|
||||
|
||||
If you want to build an application that uses `bat`'s pretty-printing
|
||||
If you want to build an application that uses `bat`s pretty-printing
|
||||
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
||||
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
||||
when you depend on `bat` as a library.
|
||||
|
BIN
assets/acknowledgements.bin
vendored
BIN
assets/acknowledgements.bin
vendored
Binary file not shown.
14
assets/manual/bat.1.in
vendored
14
assets/manual/bat.1.in
vendored
@@ -203,18 +203,8 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
|
||||
\&..) to display in addition to the file contents. The argument is a comma\-separated list
|
||||
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="..").
|
||||
.IP
|
||||
When styles are specified in multiple places, the "nearest" set of styles take precedence.
|
||||
The command\-line arguments are the highest priority, followed by the BAT_STYLE environment
|
||||
variable, and then the configuration file. If any set of styles consists entirely of
|
||||
components prefixed with "+" or "\-", it will modify the previous set of styles instead of
|
||||
replacing them.
|
||||
.IP
|
||||
By default, the following components are enabled:
|
||||
changes, grid, header\-filename, numbers, snip
|
||||
.IP
|
||||
Possible values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
|
||||
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
||||
values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
|
||||
rule, numbers, snip.
|
||||
.HP
|
||||
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
||||
|
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/Apache
vendored
2
assets/syntaxes/02_Extra/Apache
vendored
Submodule assets/syntaxes/02_Extra/Apache updated: c438c352db...cf6cefc51e
2
assets/syntaxes/02_Extra/JavaScript_(Babel)
vendored
2
assets/syntaxes/02_Extra/JavaScript_(Babel)
vendored
Submodule assets/syntaxes/02_Extra/JavaScript_(Babel) updated: f4579f9107...2b3608cd8b
2
assets/syntaxes/02_Extra/Lean
vendored
2
assets/syntaxes/02_Extra/Lean
vendored
Submodule assets/syntaxes/02_Extra/Lean updated: 514362b5c7...29a03a8aba
157
assets/syntaxes/02_Extra/Lean.sublime-syntax
vendored
157
assets/syntaxes/02_Extra/Lean.sublime-syntax
vendored
@@ -1,130 +1,125 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/syntax.html
|
||||
name: Lean 4
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Lean
|
||||
file_extensions:
|
||||
- lean
|
||||
scope: source.lean4
|
||||
scope: source.lean
|
||||
contexts:
|
||||
main:
|
||||
- include: comments
|
||||
- match: \b(Prop|Type|Sort)\b
|
||||
scope: storage.type.lean4
|
||||
- match: '\battribute\b\s*\[[^\]]*\]'
|
||||
scope: storage.modifier.lean4
|
||||
- match: '@\[[^\]]*\]'
|
||||
scope: storage.modifier.lean4
|
||||
- match: \b(?<!\.)(global|local|scoped|partial|unsafe|private|protected|noncomputable)(?!\.)\b
|
||||
scope: storage.modifier.lean4
|
||||
- match: \b(sorry|admit|stop)\b
|
||||
scope: invalid.illegal.lean4
|
||||
- match: '#(print|eval|reduce|check|check_failure)\b'
|
||||
scope: keyword.other.lean4
|
||||
- match: \bderiving\s+instance\b
|
||||
scope: keyword.other.command.lean4
|
||||
- match: '\b(?<!\.)(inductive|coinductive|structure|theorem|axiom|abbrev|lemma|def|instance|class|constant)\b\s+(\{[^}]*\})?'
|
||||
- match: '\b(?<!\.)(inductive|coinductive|structure|theorem|axiom|axioms|abbreviation|lemma|definition|def|instance|class|constant)\b\s+(\{[^}]*\})?'
|
||||
captures:
|
||||
1: keyword.other.definitioncommand.lean4
|
||||
1: keyword.other.definitioncommand.lean
|
||||
push:
|
||||
- meta_scope: meta.definitioncommand.lean4
|
||||
- match: '(?=\bwith\b|\bextends\b|\bwhere\b|[:\|\(\[\{⦃<>])'
|
||||
- meta_scope: meta.definitioncommand.lean
|
||||
- match: '(?=\bwith\b|\bextends\b|[:\|\(\[\{⦃<>])'
|
||||
pop: true
|
||||
- include: comments
|
||||
- include: definitionName
|
||||
- match: ','
|
||||
- match: \b(?<!\.)(theorem|show|have|from|suffices|nomatch|def|class|structure|instance|set_option|initialize|builtin_initialize|example|inductive|coinductive|axiom|constant|universe|universes|variable|variables|import|open|export|theory|prelude|renaming|hiding|exposing|do|by|let|extends|mutual|mut|where|rec|syntax|macro_rules|macro|deriving|fun|section|namespace|end|infix|infixl|infixr|postfix|prefix|notation|abbrev|if|then|else|calc|match|with|for|in|unless|try|catch|finally|return|continue|break)(?!\.)\b
|
||||
scope: keyword.other.lean4
|
||||
- match: ","
|
||||
- match: \b(Prop|Type|Sort)\b
|
||||
scope: storage.type.lean
|
||||
- match: '\battribute\b\s*\[[^\]]*\]'
|
||||
scope: storage.modifier.lean
|
||||
- match: '@\[[^\]]*\]'
|
||||
scope: storage.modifier.lean
|
||||
- match: \b(?<!\.)(private|meta|mutual|protected|noncomputable)\b
|
||||
scope: keyword.control.definition.modifier.lean
|
||||
- match: \b(sorry)\b
|
||||
scope: invalid.illegal.lean
|
||||
- match: '#print\s+(def|definition|inductive|instance|structure|axiom|axioms|class)\b'
|
||||
scope: keyword.other.command.lean
|
||||
- match: '#(print|eval|reduce|check|help|exit|find|where)\b'
|
||||
scope: keyword.other.command.lean
|
||||
- match: \b(?<!\.)(import|export|prelude|theory|definition|def|abbreviation|instance|renaming|hiding|exposing|parameter|parameters|begin|constant|constants|lemma|variable|variables|theorem|example|open|axiom|inductive|coinductive|with|structure|universe|universes|alias|precedence|reserve|postfix|prefix|infix|infixl|infixr|notation|end|using|namespace|section|local|set_option|extends|include|omit|class|classes|instances|raw|run_cmd|restate_axiom)(?!\.)\b
|
||||
scope: keyword.other.lean
|
||||
- match: \b(?<!\.)(calc|have|this|match|do|suffices|show|by|in|at|let|forall|fun|exists|assume|from|obtain|haveI|λ)(?!\.)\b
|
||||
scope: keyword.other.lean
|
||||
- match: «
|
||||
push:
|
||||
- meta_content_scope: entity.name.lean4
|
||||
- meta_content_scope: entity.name.lean
|
||||
- match: »
|
||||
pop: true
|
||||
- match: (s!)"
|
||||
captures:
|
||||
1: keyword.other.lean4
|
||||
push:
|
||||
- meta_scope: string.interpolated.lean4
|
||||
- match: '"'
|
||||
pop: true
|
||||
- match: '(\{)'
|
||||
captures:
|
||||
1: keyword.other.lean4
|
||||
push:
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: keyword.other.lean4
|
||||
pop: true
|
||||
- include: main
|
||||
- match: '\\[\\"ntr'']'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: \b(?<!\.)(if|then|else)\b
|
||||
scope: keyword.control.lean
|
||||
- match: '"'
|
||||
push:
|
||||
- meta_scope: string.quoted.double.lean4
|
||||
- match: '"'
|
||||
pop: true
|
||||
- match: '\\[\\"ntr'']'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: \b(true|false)\b
|
||||
scope: constant.language.lean4
|
||||
- match: '''[^\\'']'''
|
||||
scope: string.quoted.single.lean4
|
||||
- match: '''(\\(x[0-9A-Fa-f][0-9A-Fa-f]|u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]|.))'''
|
||||
scope: string.quoted.single.lean4
|
||||
captures:
|
||||
1: constant.character.escape.lean4
|
||||
0: punctuation.definition.string.begin.lean
|
||||
push:
|
||||
- meta_scope: string.quoted.double.lean
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.lean
|
||||
pop: true
|
||||
- match: '\\[\\"nt'']'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '''[^\\'']'''
|
||||
scope: string.quoted.single.lean
|
||||
- match: '''(\\(x..|u....|.))'''
|
||||
scope: string.quoted.single.lean
|
||||
captures:
|
||||
1: constant.character.escape.lean
|
||||
- match: '`+[^\[(]\S+'
|
||||
scope: entity.name.lean4
|
||||
- match: '\b([0-9]+|0([xX][0-9a-fA-F]+)|[-]?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?)\b'
|
||||
scope: constant.numeric.lean4
|
||||
scope: entity.name.lean
|
||||
- match: '\b([0-9]+|0([xX][0-9a-fA-F]+))\b'
|
||||
scope: constant.numeric.lean
|
||||
blockComment:
|
||||
- match: /-
|
||||
push:
|
||||
- meta_scope: comment.block.lean4
|
||||
- match: '-/'
|
||||
- meta_scope: comment.block.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
comments:
|
||||
- include: dashComment
|
||||
- include: docComment
|
||||
- include: stringBlock
|
||||
- include: modDocComment
|
||||
- include: blockComment
|
||||
dashComment:
|
||||
- match: '--'
|
||||
- match: (--)
|
||||
captures:
|
||||
0: punctuation.definition.comment.lean
|
||||
push:
|
||||
- meta_scope: comment.line.double-dash.lean4
|
||||
- meta_scope: comment.line.double-dash.lean
|
||||
- match: $
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
definitionName:
|
||||
- match: '\b[^:«»\(\)\{\}[:space:]=→λ∀?][^:«»\(\)\{\}[:space:]]*'
|
||||
scope: entity.name.function.lean4
|
||||
scope: entity.name.function.lean
|
||||
- match: «
|
||||
push:
|
||||
- meta_content_scope: entity.name.function.lean4
|
||||
- meta_content_scope: entity.name.function.lean
|
||||
- match: »
|
||||
pop: true
|
||||
docComment:
|
||||
- match: /--
|
||||
push:
|
||||
- meta_scope: comment.block.documentation.lean4
|
||||
- match: '-/'
|
||||
- meta_scope: comment.block.documentation.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
modDocComment:
|
||||
- match: /-!
|
||||
push:
|
||||
- meta_scope: comment.block.documentation.lean4
|
||||
- match: '-/'
|
||||
- meta_scope: comment.block.documentation.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
stringBlock:
|
||||
- match: /-"
|
||||
push:
|
||||
- meta_scope: comment.block.string.lean
|
||||
- match: '"-/'
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
|
1
assets/syntaxes/02_Extra/SmartVHDL
vendored
1
assets/syntaxes/02_Extra/SmartVHDL
vendored
Submodule assets/syntaxes/02_Extra/SmartVHDL deleted from b45507ddc8
Submodule assets/syntaxes/02_Extra/typst-syntax-highlight deleted from 3f2561d4d8
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
1
assets/themes/Catppuccin
vendored
1
assets/themes/Catppuccin
vendored
Submodule assets/themes/Catppuccin deleted from ccf194fdc9
2
assets/themes/zenburn
vendored
2
assets/themes/zenburn
vendored
Submodule assets/themes/zenburn updated: 4f21745723...9c588ebc11
@@ -9,8 +9,6 @@ use anyhow::{anyhow, bail};
|
||||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
use once_cell::sync::Lazy;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, ToTokens, TokenStreamExt};
|
||||
use regex::Regex;
|
||||
use serde_derive::Deserialize;
|
||||
use serde_with::DeserializeFromStr;
|
||||
@@ -36,14 +34,13 @@ impl FromStr for MappingTarget {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ToTokens for MappingTarget {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let t = match self {
|
||||
Self::MapTo(syntax) => quote! { MappingTarget::MapTo(#syntax) },
|
||||
Self::MapToUnknown => quote! { MappingTarget::MapToUnknown },
|
||||
Self::MapExtensionToUnknown => quote! { MappingTarget::MapExtensionToUnknown },
|
||||
};
|
||||
tokens.append_all(t);
|
||||
impl MappingTarget {
|
||||
fn codegen(&self) -> String {
|
||||
match self {
|
||||
Self::MapTo(syntax) => format!(r###"MappingTarget::MapTo(r#"{syntax}"#)"###),
|
||||
Self::MapToUnknown => "MappingTarget::MapToUnknown".into(),
|
||||
Self::MapExtensionToUnknown => "MappingTarget::MapExtensionToUnknown".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,17 +116,22 @@ impl FromStr for Matcher {
|
||||
Ok(Self(non_empty_segments))
|
||||
}
|
||||
}
|
||||
impl ToTokens for Matcher {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let t = match self.0.as_slice() {
|
||||
[] => unreachable!("0-length matcher should never be created"),
|
||||
[MatcherSegment::Text(text)] => {
|
||||
quote! { Lazy::new(|| Some(build_matcher_fixed(#text))) }
|
||||
impl Matcher {
|
||||
fn codegen(&self) -> String {
|
||||
match self.0.len() {
|
||||
0 => unreachable!("0-length matcher should never be created"),
|
||||
// if-let guard would be ideal here
|
||||
// see: https://github.com/rust-lang/rust/issues/51114
|
||||
1 if self.0[0].is_text() => {
|
||||
let s = self.0[0].text().unwrap();
|
||||
format!(r###"Lazy::new(|| Some(build_matcher_fixed(r#"{s}"#)))"###)
|
||||
}
|
||||
// parser logic ensures that this case can only happen when there are dynamic segments
|
||||
segs @ [_, ..] => quote! { Lazy::new(|| build_matcher_dynamic(&[ #(#segs),* ])) },
|
||||
};
|
||||
tokens.append_all(t);
|
||||
_ => {
|
||||
let segs = self.0.iter().map(MatcherSegment::codegen).join(", ");
|
||||
format!(r###"Lazy::new(|| build_matcher_dynamic(&[{segs}]))"###)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,15 +143,6 @@ enum MatcherSegment {
|
||||
Text(String),
|
||||
Env(String),
|
||||
}
|
||||
impl ToTokens for MatcherSegment {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let t = match self {
|
||||
Self::Text(text) => quote! { MatcherSegment::Text(#text) },
|
||||
Self::Env(env) => quote! { MatcherSegment::Env(#env) },
|
||||
};
|
||||
tokens.append_all(t);
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
impl MatcherSegment {
|
||||
fn is_text(&self) -> bool {
|
||||
@@ -170,6 +163,12 @@ impl MatcherSegment {
|
||||
Self::Env(t) => Some(t),
|
||||
}
|
||||
}
|
||||
fn codegen(&self) -> String {
|
||||
match self {
|
||||
Self::Text(s) => format!(r###"MatcherSegment::Text(r#"{s}"#)"###),
|
||||
Self::Env(s) => format!(r###"MatcherSegment::Env(r#"{s}"#)"###),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A struct that models a single .toml file in /src/syntax_mapping/builtins/.
|
||||
@@ -195,19 +194,22 @@ impl MappingDefModel {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct MappingList(Vec<(Matcher, MappingTarget)>);
|
||||
impl ToTokens for MappingList {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let len = self.0.len();
|
||||
let array_items = self
|
||||
impl MappingList {
|
||||
fn codegen(&self) -> String {
|
||||
let array_items: Vec<_> = self
|
||||
.0
|
||||
.iter()
|
||||
.map(|(matcher, target)| quote! { (#matcher, #target) });
|
||||
.map(|(matcher, target)| {
|
||||
format!("({m}, {t})", m = matcher.codegen(), t = target.codegen())
|
||||
})
|
||||
.collect();
|
||||
let len = array_items.len();
|
||||
|
||||
let t = quote! {
|
||||
/// Generated by build script from /src/syntax_mapping/builtins/.
|
||||
pub(crate) static BUILTIN_MAPPINGS: [(Lazy<Option<GlobMatcher>>, MappingTarget); #len] = [#(#array_items),*];
|
||||
};
|
||||
tokens.append_all(t);
|
||||
format!(
|
||||
"/// Generated by build script from /src/syntax_mapping/builtins/.\n\
|
||||
pub(crate) static BUILTIN_MAPPINGS: [(Lazy<Option<GlobMatcher>>, MappingTarget); {len}] = [\n{items}\n];",
|
||||
items = array_items.join(",\n")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,15 +291,10 @@ pub fn build_static_mappings() -> anyhow::Result<()> {
|
||||
|
||||
let mappings = read_all_mappings()?;
|
||||
|
||||
// IMPRV: parse + unparse is a bit cringe, but there seems to be no better
|
||||
// option given the limited APIs of `prettyplease`
|
||||
let rs_src = syn::parse_file(&mappings.to_token_stream().to_string())?;
|
||||
let rs_src_pretty = prettyplease::unparse(&rs_src);
|
||||
|
||||
let codegen_path = Path::new(&env::var_os("OUT_DIR").ok_or(anyhow!("OUT_DIR is unset"))?)
|
||||
.join("codegen_static_syntax_mappings.rs");
|
||||
|
||||
fs::write(codegen_path, rs_src_pretty)?;
|
||||
fs::write(codegen_path, mappings.codegen())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -163,7 +163,7 @@ git show v0.6.0:src/main.rs | bat -l rs
|
||||
볼 수 있습니다:
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --diff-filter=d -z | xargs --null bat --diff
|
||||
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
이것을 별도의 도구로 쓰고 싶다면
|
||||
@@ -461,11 +461,11 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
|
||||
- `ansi`는 어떤 터미널에서도 무난하게 보입니다. 이는 3비트 색상을 사용합니다:
|
||||
검정, 빨강, 녹색, 노랑, 파랑, 마젠타, 시안, 하양.
|
||||
- `base16`은 [base16](https://github.com/tinted-theming/home) 터미널 테마를 위해
|
||||
- `base16`은 [base16](https://github.com/chriskempson/base16) 터미널 테마를 위해
|
||||
디자인되었습니다.
|
||||
이는 [base16 스타일 가이드라인](https://github.com/tinted-theming/home/blob/main/styling.md)에
|
||||
이는 [base16 스타일 가이드라인](https://github.com/chriskempson/base16/blob/master/styling.md)에
|
||||
따라 4비트 색상(3비트 색상에 밝은 변형 추가)을 사용합니다.
|
||||
- `base16-256`는 [base16-shell](https://github.com/tinted-theming/base16-shell)을
|
||||
- `base16-256`는 [base16-shell](https://github.com/chriskempson/base16-shell)을
|
||||
위해 디자인되었습니다.
|
||||
이는 16부터 21의 일부 밝은 색상을 8비트 색상으로 대치합니다.
|
||||
단지 256-색상 터미널을 쓰지만 base16-shell을 쓰지 않는다고 해서 이것을
|
||||
|
@@ -150,7 +150,7 @@ git show v0.6.0:src/main.rs | bat -l rs
|
||||
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --diff-filter=d -z | xargs --null bat --diff
|
||||
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
|
||||
@@ -401,8 +401,8 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
`bat` 自带三个 [8-bit 色彩](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 主题:
|
||||
|
||||
- `ansi` 适应于大部分终端。它使用 3-bit 色彩:黑红绿黄蓝洋红靛青白。
|
||||
- `base16`专为 [base16](https://github.com/tinted-theming/home) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/tinted-theming/home/blob/main/styling.md) 制作。
|
||||
- `base16-25`专为 [base16-shell](https://github.com/tinted-theming/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
|
||||
- `base16`专为 [base16](https://github.com/chriskempson/base16) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md) 制作。
|
||||
- `base16-25`专为 [base16-shell](https://github.com/chriskempson/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
|
||||
|
||||
尽管这些主题具有诸多限制,但具有一些 truecolor 主题不具有的三个优点:
|
||||
|
||||
|
@@ -26,7 +26,7 @@ in the `.sublime-syntax` format.
|
||||
4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the
|
||||
`bat` binary.
|
||||
|
||||
5. Use `bat --list-languages` to check if the new languages are available. You may want to do something like ``export PATH="`pwd`/target/debug:$PATH"`` to ensure the locally compiled version is the one being used.
|
||||
5. Use `bat --list-languages` to check if the new languages are available. You may want to do something like `export PATH="`pwd`/target/debug:$PATH"` to ensure the locally compiled version is the one being used.
|
||||
|
||||
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
|
||||
|
||||
@@ -102,4 +102,4 @@ The following files have been manually modified after converting from a `.tmLang
|
||||
https://github.com/seanjames777/SML-Language-Definition/blob/master/sml.tmLanguage
|
||||
* `Cabal.sublime_syntax` has been added manually from
|
||||
https://github.com/SublimeHaskell/SublimeHaskell/ - we don't want to include the whole submodule because it includes other syntaxes ("Haskell improved") as well.
|
||||
* `Lean.sublime-syntax` has been added manually from https://github.com/leanprover/vscode-lean4/blob/master/vscode-lean4/syntaxes/lean4.json via conversion.
|
||||
* `Lean.sublime-syntax` has been added manually from https://github.com/leanprover/vscode-lean/blob/master/syntaxes/lean.json via conversion.
|
||||
|
Binary file not shown.
Before ![]() (image error) Size: 28 KiB |
@@ -163,7 +163,7 @@ impl HighlightingAssets {
|
||||
|
||||
if let Some(MappingTarget::MapTo(syntax_name)) = syntax_match {
|
||||
return self
|
||||
.find_syntax_by_token(syntax_name)?
|
||||
.find_syntax_by_name(syntax_name)?
|
||||
.ok_or_else(|| Error::UnknownSyntax(syntax_name.to_owned()));
|
||||
}
|
||||
|
||||
@@ -259,13 +259,6 @@ impl HighlightingAssets {
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
fn find_syntax_by_token(&self, token: &str) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(syntax_set
|
||||
.find_syntax_by_token(token)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
fn get_syntax_for_file_name(
|
||||
&self,
|
||||
file_name: &OsStr,
|
||||
@@ -305,11 +298,7 @@ impl HighlightingAssets {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(String::from_utf8(reader.first_line.clone())
|
||||
.ok()
|
||||
.and_then(|l| {
|
||||
// Strip UTF-8 BOM if present
|
||||
let line = l.strip_prefix('\u{feff}').unwrap_or(&l);
|
||||
syntax_set.find_syntax_by_first_line(line)
|
||||
})
|
||||
.and_then(|l| syntax_set.find_syntax_by_first_line(&l))
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
}
|
||||
@@ -544,41 +533,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn syntax_detection_first_line_with_utf8_bom() {
|
||||
let test = SyntaxDetectionTest::new();
|
||||
|
||||
// Test that XML files are detected correctly even with UTF-8 BOM
|
||||
// The BOM should be stripped before first-line syntax detection
|
||||
let xml_with_bom = "\u{feff}<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("unknown_file", xml_with_bom),
|
||||
"XML"
|
||||
);
|
||||
|
||||
// Test the specific .csproj case mentioned in the issue
|
||||
// Even if .csproj has extension mapping, this tests first-line fallback
|
||||
let csproj_content_with_bom = "\u{feff}<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("test.csproj", csproj_content_with_bom),
|
||||
"XML"
|
||||
);
|
||||
|
||||
// Test that shell scripts are detected correctly even with UTF-8 BOM
|
||||
let script_with_bom = "\u{feff}#!/bin/bash";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("unknown_script", script_with_bom),
|
||||
"Bourne Again Shell (bash)"
|
||||
);
|
||||
|
||||
// Test that PHP files are detected correctly even with UTF-8 BOM
|
||||
let php_with_bom = "\u{feff}<?php";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("unknown_php", php_with_bom),
|
||||
"PHP"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn syntax_detection_with_custom_mapping() {
|
||||
let mut test = SyntaxDetectionTest::new();
|
||||
|
@@ -95,9 +95,6 @@ fn include_license_in_acknowledgments(license_text: &str) -> bool {
|
||||
// Apache 2.0
|
||||
"Apache License Version 2.0, January 2004 http://www.apache.org/licenses/",
|
||||
"Licensed under the Apache License, Version 2.0 (the \"License\");",
|
||||
|
||||
// CC BY 4.0
|
||||
"Creative Commons Attribution 4.0 International Public License",
|
||||
];
|
||||
|
||||
license_contains_marker(license_text, &markers)
|
||||
|
@@ -3,7 +3,6 @@ use std::env;
|
||||
use std::io::IsTerminal;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::thread::available_parallelism;
|
||||
|
||||
use crate::{
|
||||
clap_app,
|
||||
@@ -150,9 +149,7 @@ impl App {
|
||||
// start building glob matchers for builtin mappings immediately
|
||||
// this is an appropriate approach because it's statistically likely that
|
||||
// all the custom mappings need to be checked
|
||||
if available_parallelism()?.get() > 1 {
|
||||
syntax_mapping.start_offload_build_all();
|
||||
}
|
||||
syntax_mapping.start_offload_build_all();
|
||||
|
||||
if let Some(values) = self.matches.get_many::<String>("ignored-suffix") {
|
||||
for suffix in values {
|
||||
|
@@ -67,13 +67,7 @@ pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
|
||||
.ok();
|
||||
}
|
||||
_ => {
|
||||
writeln!(
|
||||
&mut std::io::stderr().lock(),
|
||||
"{}: {}",
|
||||
Red.paint("[bat error]"),
|
||||
error
|
||||
)
|
||||
.ok();
|
||||
writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -1,2 +0,0 @@
|
||||
[mappings]
|
||||
"Scala" = ["*.mill"]
|
@@ -1,5 +1,7 @@
|
||||
# see `man quadlet`
|
||||
[mappings]
|
||||
"INI" = [
|
||||
"**/containers/systemd/**/*.{container,volume,network,kube,image}",
|
||||
"**/containers/systemd/*.{container,volume,network,kube,image}",
|
||||
"**/containers/systemd/users/*.{container,volume,network,kube,image}",
|
||||
"**/containers/systemd/users/*/*.{container,volume,network,kube,image}",
|
||||
]
|
||||
|
@@ -1,3 +0,0 @@
|
||||
# See https://eff-certbot.readthedocs.io/en/stable/using.html#configuration-file
|
||||
[mappings]
|
||||
"INI" = ["/etc/letsencrypt/renewal/*.conf"]
|
@@ -266,10 +266,10 @@ impl ColorSchemeDetector for TerminalColorSchemeDetector {
|
||||
}
|
||||
|
||||
fn detect(&self) -> Option<ColorScheme> {
|
||||
use terminal_colorsaurus::{theme_mode, QueryOptions, ThemeMode};
|
||||
match theme_mode(QueryOptions::default()).ok()? {
|
||||
ThemeMode::Dark => Some(ColorScheme::Dark),
|
||||
ThemeMode::Light => Some(ColorScheme::Light),
|
||||
use terminal_colorsaurus::{color_scheme, ColorScheme as ColorsaurusScheme, QueryOptions};
|
||||
match color_scheme(QueryOptions::default()).ok()? {
|
||||
ColorsaurusScheme::Dark => Some(ColorScheme::Dark),
|
||||
ColorsaurusScheme::Light => Some(ColorScheme::Light),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,10 +14,6 @@ fn all_themes_are_present() {
|
||||
themes,
|
||||
vec![
|
||||
"1337",
|
||||
"Catppuccin Frappe",
|
||||
"Catppuccin Latte",
|
||||
"Catppuccin Macchiato",
|
||||
"Catppuccin Mocha",
|
||||
"Coldark-Cold",
|
||||
"Coldark-Dark",
|
||||
"DarkNeon",
|
||||
|
@@ -353,15 +353,6 @@ fn list_themes_to_piped_output() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_languages() {
|
||||
bat()
|
||||
.arg("--list-languages")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Rust").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(
|
||||
any(not(feature = "git"), feature = "lessopen", target_os = "windows"),
|
||||
@@ -459,16 +450,6 @@ fn stdin_to_stdout_cycle() -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn bat_error_to_stderr() {
|
||||
bat()
|
||||
.arg("/tmp")
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(predicate::str::contains("[bat error]"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn no_args_doesnt_break() {
|
||||
@@ -2821,27 +2802,6 @@ fn highlighting_independant_from_map_syntax_case() {
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn map_syntax_target_syntax_case_insensitive() {
|
||||
let expected = bat()
|
||||
.arg("-f")
|
||||
.arg("--map-syntax=*.config:json")
|
||||
.arg("map-syntax_case.Config")
|
||||
.assert()
|
||||
.get_output()
|
||||
.stdout
|
||||
.clone();
|
||||
|
||||
bat()
|
||||
.arg("-f")
|
||||
.arg("--map-syntax=*.config:json")
|
||||
.arg("map-syntax_case.Config")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(expected)
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strip_ansi_always_strips_ansi() {
|
||||
bat()
|
||||
|
111
tests/syntax-tests/highlighted/Lean/test.lean
vendored
111
tests/syntax-tests/highlighted/Lean/test.lean
vendored
@@ -1,82 +1,67 @@
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m MIL.Common[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m Mathlib.Topology.Instances.Real.Defs[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m data.matrix.notation[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m data.vector2[0m
|
||||
|
||||
[38;2;249;38;114mopen[0m[38;2;248;248;242m Set Filter Topology[0m
|
||||
[38;2;117;113;94m/-![0m
|
||||
|
||||
[38;2;249;38;114mvariable[0m[38;2;248;248;242m {α : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*}[0m
|
||||
[38;2;249;38;114mvariable[0m[38;2;248;248;242m (s t : Set ℕ)[0m
|
||||
[38;2;249;38;114mvariable[0m[38;2;248;248;242m (ssubt : s ⊆ t)[0m
|
||||
[38;2;249;38;114mvariable[0m[38;2;248;248;242m {α : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*} (s : Set (Set α))[0m
|
||||
[38;2;117;113;94m-- Apostrophes are allowed in variable names[0m
|
||||
[38;2;249;38;114mvariable[0m[38;2;248;248;242m (f'_x x' : ℕ)[0m
|
||||
[38;2;249;38;114mvariable[0m[38;2;248;248;242m (bangwI' jablu'DI' QaQqu' nay' Ghay'cha' he' : ℕ)[0m
|
||||
[38;2;117;113;94mHelpers that don't currently fit elsewhere...[0m
|
||||
|
||||
[38;2;117;113;94m-- In the next example we could use `tauto` in each proof instead of knowing the lemmas[0m
|
||||
[38;2;249;38;114mexample[0m[38;2;248;248;242m {α : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*} (s : Set α) : Filter α :=[0m
|
||||
[38;2;248;248;242m { sets := { t | s ⊆ t }[0m
|
||||
[38;2;248;248;242m univ_sets := subset_univ s[0m
|
||||
[38;2;248;248;242m sets_of_superset := [0m[38;2;249;38;114mfun[0m[38;2;248;248;242m hU hUV ↦ Subset.trans hU hUV[0m
|
||||
[38;2;248;248;242m inter_sets := [0m[38;2;249;38;114mfun[0m[38;2;248;248;242m hU hV ↦ subset_inter hU hV }[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
|
||||
[38;2;249;38;114mlemma[0m[38;2;248;248;242m [0m[38;2;166;226;46msplit_eq[0m[38;2;248;248;242m [0m[38;2;248;248;242m{m n : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*} (x : m × n) (p p' : m × n) :[0m
|
||||
[38;2;248;248;242m p = x ∨ p' = x ∨ (x ≠ p ∧ x ≠ p') := [0m[38;2;249;38;114mby[0m[38;2;248;248;242m tauto[0m
|
||||
|
||||
[38;2;117;113;94m--[0m[38;2;117;113;94m For `playfield`s, the piece type and/or piece index type.[0m
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m (X : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*)[0m
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m [has_repr X][0m
|
||||
|
||||
[38;2;249;38;114mnamespace[0m[38;2;248;248;242m chess.utils[0m
|
||||
|
||||
[38;2;249;38;114msection[0m[38;2;248;248;242m repr[0m
|
||||
|
||||
[38;2;249;38;114m@[class][0m[38;2;248;248;242m [0m[38;2;249;38;114mstructure[0m[38;2;248;248;242m [0m[38;2;166;226;46mOne₂[0m[38;2;248;248;242m [0m[38;2;248;248;242m(α : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m) [0m[38;2;249;38;114mwhere[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/-- The element one -/[0m
|
||||
[38;2;248;248;242m one : α[0m
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mAn auxiliary wrapper for `option X` that allows for overriding the `has_repr` instance[0m
|
||||
[38;2;117;113;94mfor `option`, and rather, output just the value in the `some` and a custom provided[0m
|
||||
[38;2;117;113;94m`string` for `none`.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mstructure[0m[38;2;248;248;242m [0m[38;2;166;226;46moption_wrapper[0m[38;2;248;248;242m [0m[38;2;248;248;242m:=[0m
|
||||
[38;2;248;248;242m(val : option X)[0m
|
||||
[38;2;248;248;242m(none_s : string)[0m
|
||||
|
||||
[38;2;249;38;114mstructure[0m[38;2;248;248;242m [0m[38;2;166;226;46mStandardTwoSimplex[0m[38;2;248;248;242m [0m[38;2;249;38;114mwhere[0m
|
||||
[38;2;248;248;242m x : ℝ[0m
|
||||
[38;2;248;248;242m y : ℝ[0m
|
||||
[38;2;248;248;242m z : ℝ[0m
|
||||
[38;2;248;248;242m x_nonneg : [0m[38;2;190;132;255m0[0m[38;2;248;248;242m ≤ x[0m
|
||||
[38;2;248;248;242m y_nonneg : [0m[38;2;190;132;255m0[0m[38;2;248;248;242m ≤ y[0m
|
||||
[38;2;248;248;242m z_nonneg : [0m[38;2;190;132;255m0[0m[38;2;248;248;242m ≤ z[0m
|
||||
[38;2;248;248;242m sum_eq : x + y + z = [0m[38;2;190;132;255m1[0m
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m [0m[38;2;166;226;46mwrapped_option_repr[0m[38;2;248;248;242m [0m[38;2;248;248;242m: has_repr (option_wrapper X) :=[0m
|
||||
[38;2;248;248;242m⟨[0m[38;2;249;38;114mλ[0m[38;2;248;248;242m ⟨val, s⟩, (option.map has_repr.repr val).get_or_else s⟩[0m
|
||||
|
||||
[38;2;249;38;114m#check[0m[38;2;248;248;242m Pi.ringHom[0m
|
||||
[38;2;249;38;114m#check[0m[38;2;248;248;242m ker_Pi_Quotient_mk[0m
|
||||
[38;2;249;38;114m#eval[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;249;38;114mvariables[0m[38;2;248;248;242m {X}[0m
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mConstruct an `option_wrapper` term from a provided `option X` and the `string`[0m
|
||||
[38;2;117;113;94mthat will override the `has_repr.repr` for `none`.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46moption_wrap[0m[38;2;248;248;242m [0m[38;2;248;248;242m(val : option X) (none_s : string) : option_wrapper X := ⟨val, none_s⟩[0m
|
||||
|
||||
[38;2;117;113;94m/-- The homomorphism from ``R ⧸ ⨅ i, I i`` to ``Π i, R ⧸ I i`` featured in the Chinese[0m
|
||||
[38;2;117;113;94m Remainder Theorem. -/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mchineseMap[0m[38;2;248;248;242m [0m[38;2;248;248;242m(I : ι → Ideal R) : (R ⧸ ⨅ i, I i) →+* Π i, R ⧸ I i :=[0m
|
||||
[38;2;248;248;242m Ideal.Quotient.lift (⨅ i, I i) (Pi.ringHom [0m[38;2;249;38;114mfun[0m[38;2;248;248;242m i : ι ↦ Ideal.Quotient.mk (I i))[0m
|
||||
[38;2;248;248;242m ([0m[38;2;249;38;114mby[0m[38;2;248;248;242m simp [← RingHom.mem_ker, ker_Pi_Quotient_mk])[0m
|
||||
[38;2;117;113;94m--[0m[38;2;117;113;94m The size of the "vectors" for a `fin n' → X`, for `has_repr` definitions[0m
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m {m' n' : ℕ}[0m
|
||||
|
||||
[38;2;249;38;114mlemma[0m[38;2;248;248;242m [0m[38;2;166;226;46mchineseMap_mk[0m[38;2;248;248;242m [0m[38;2;248;248;242m(I : ι → Ideal R) (x : R) :[0m
|
||||
[38;2;248;248;242m chineseMap I (Quotient.mk _ x) = [0m[38;2;249;38;114mfun[0m[38;2;248;248;242m i : ι ↦ Ideal.Quotient.mk (I i) x :=[0m
|
||||
[38;2;248;248;242m rfl[0m
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mFor a "vector" `X^n'` represented by the type `Π n' : ℕ, fin n' → X`, where[0m
|
||||
[38;2;117;113;94mthe `X` has a `has_repr` instance itself, we can provide a `has_repr` for the "vector".[0m
|
||||
[38;2;117;113;94mThis definition is used for displaying rows of the playfield, when it is defined[0m
|
||||
[38;2;117;113;94mvia a `matrix`, likely through notation.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mvec_repr[0m[38;2;248;248;242m [0m[38;2;248;248;242m: Π {n' : ℕ}, (fin n' → X) → string :=[0m
|
||||
[38;2;249;38;114mλ[0m[38;2;248;248;242m _ v, string.intercalate [0m[38;2;230;219;116m"[0m[38;2;230;219;116m, [0m[38;2;230;219;116m"[0m[38;2;248;248;242m ((vector.of_fn v).to_list.map repr)[0m
|
||||
|
||||
[38;2;249;38;114mtheorem[0m[38;2;248;248;242m [0m[38;2;166;226;46misCoprime_Inf[0m[38;2;248;248;242m [0m[38;2;248;248;242m{I : Ideal R} {J : ι → Ideal R} {s : Finset ι}[0m
|
||||
[38;2;248;248;242m (hf : ∀ j ∈ s, IsCoprime I (J j)) : IsCoprime I (⨅ j ∈ s, J j) := [0m[38;2;249;38;114mby[0m
|
||||
[38;2;248;248;242m classical[0m
|
||||
[38;2;248;248;242m simp_rw [isCoprime_iff_add] at *[0m
|
||||
[38;2;248;248;242m induction s using Finset.induction [0m[38;2;249;38;114mwith[0m
|
||||
[38;2;248;248;242m | empty =>[0m
|
||||
[38;2;248;248;242m simp[0m
|
||||
[38;2;248;248;242m | @insert i s _ hs =>[0m
|
||||
[38;2;248;248;242m rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, ← one_eq_top][0m
|
||||
[38;2;248;248;242m set K := ⨅ j ∈ s, J j[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcalc[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m = I + K := (hs [0m[38;2;249;38;114mfun[0m[38;2;248;248;242m j hj ↦ hf j (Finset.mem_insert_of_mem hj)).symm[0m
|
||||
[38;2;248;248;242m _ = I + K * (I + J i) := [0m[38;2;249;38;114mby[0m[38;2;248;248;242m rw [hf i (Finset.mem_insert_self i s), mul_one][0m
|
||||
[38;2;248;248;242m _ = ([0m[38;2;190;132;255m1[0m[38;2;248;248;242m + K) * I + K * J i := [0m[38;2;249;38;114mby[0m[38;2;248;248;242m ring[0m
|
||||
[38;2;248;248;242m _ ≤ I + K ⊓ J i := [0m[38;2;249;38;114mby[0m[38;2;248;248;242m gcongr ; apply mul_le_left ; apply mul_le_inf[0m
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m [0m[38;2;166;226;46mvec_repr_instance[0m[38;2;248;248;242m [0m[38;2;248;248;242m: has_repr (fin n' → X) := ⟨vec_repr⟩[0m
|
||||
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mFor a `matrix` `X^(m' × n')` where the `X` has a `has_repr` instance itself,[0m
|
||||
[38;2;117;113;94mwe can provide a `has_repr` for the matrix, using `vec_repr` for each of the rows of the matrix.[0m
|
||||
[38;2;117;113;94mThis definition is used for displaying the playfield, when it is defined[0m
|
||||
[38;2;117;113;94mvia a `matrix`, likely through notation.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mmatrix_repr[0m[38;2;248;248;242m [0m[38;2;248;248;242m: Π {m' n'}, matrix (fin m') (fin n') X → string :=[0m
|
||||
[38;2;249;38;114mλ[0m[38;2;248;248;242m _ _ M, string.intercalate [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;248;248;242m ((vector.of_fn M).to_list.map repr)[0m
|
||||
|
||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mRing₃[0m[38;2;248;248;242m [0m[38;2;248;248;242m(R : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m) [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m AddGroup₃ R, Monoid₃ R, MulZeroClass R [0m[38;2;249;38;114mwhere[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/-- Multiplication is left distributive over addition -/[0m
|
||||
[38;2;248;248;242m left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/-- Multiplication is right distributive over addition -/[0m
|
||||
[38;2;248;248;242m right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c[0m
|
||||
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m {R : Type} [0m[38;2;248;248;242m[Ring₃ R] : AddCommGroup₃ R :=[0m
|
||||
[38;2;248;248;242m{ Ring₃.toAddGroup₃ [0m[38;2;249;38;114mwith[0m
|
||||
[38;2;248;248;242m add_comm := [0m[38;2;249;38;114mby[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;240msorry[0m[38;2;248;248;242m }[0m
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m [0m[38;2;166;226;46mmatrix_repr_instance[0m[38;2;248;248;242m [0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m has_repr (matrix (fin n') (fin m') X) := ⟨matrix_repr⟩[0m
|
||||
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m repr[0m
|
||||
|
||||
|
28
tests/syntax-tests/highlighted/Typst/test.typ
vendored
28
tests/syntax-tests/highlighted/Typst/test.typ
vendored
@@ -1,28 +0,0 @@
|
||||
[38;2;249;38;114m#[0m[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;102;217;239mtext[0m[38;2;248;248;242m([0m[38;2;190;132;255m9[0m[38;2;190;132;255m.[0m[38;2;190;132;255m5[0m[38;2;190;132;255mpt[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;253;151;31m=[0m[38;2;253;151;31m [0m[38;2;253;151;31mHeading[0m
|
||||
|
||||
[38;2;248;248;242m-[0m[38;2;248;248;242m [0m[38;2;248;248;242mBullet 1[0m
|
||||
[38;2;248;248;242m-[0m[38;2;248;248;242m [0m[38;2;248;248;242mBullet 2[0m
|
||||
[38;2;248;248;242m-[0m[38;2;248;248;242m [0m[38;2;248;248;242mBullet 3[0m
|
||||
|
||||
[38;2;248;248;242m+[0m[38;2;248;248;242m [0m[38;2;248;248;242mList 1[0m
|
||||
[38;2;248;248;242m+[0m[38;2;248;248;242m [0m[38;2;248;248;242mList 2[0m
|
||||
[38;2;248;248;242m+[0m[38;2;248;248;242m [0m[38;2;248;248;242mList 3[0m
|
||||
|
||||
[38;2;248;248;242m#[0m[38;2;248;248;242mfigure[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mtable[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31mcolumns[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mauto[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255mauto[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m table[0m[38;2;248;248;242m.[0m[38;2;102;217;239mheader[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242mName[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242mAge[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242mJohn[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;242m50[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;242mJane[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;242m48[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31mcaption[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242mPeople[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m```[0m[38;2;190;132;255mpython[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;174;129;255m [0m[38;2;166;226;46mfoo[0m[38;2;174;129;255m([0m[38;2;174;129;255m)[0m[38;2;174;129;255m:[0m
|
||||
[38;2;174;129;255m [0m[38;2;102;217;239mprint[0m[38;2;174;129;255m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mhi[0m[38;2;230;219;116m"[0m[38;2;174;129;255m)[0m
|
||||
[38;2;248;248;242m```[0m
|
74
tests/syntax-tests/highlighted/VHDL/test.vhdl
vendored
74
tests/syntax-tests/highlighted/VHDL/test.vhdl
vendored
@@ -1,74 +0,0 @@
|
||||
[38;2;117;113;94m--[0m[38;2;117;113;94m This is a single-line comment[0m
|
||||
|
||||
[38;2;249;38;114mlibrary[0m[38;2;248;248;242m [0m[38;2;248;248;242mIEEE[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mIEEE[0m[38;2;248;248;242m.[0m[38;2;248;248;242mSTD_LOGIC_1164[0m[38;2;248;248;242m.[0m[38;2;249;38;114mALL[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mIEEE[0m[38;2;248;248;242m.[0m[38;2;248;248;242mNUMERIC_STD[0m[38;2;248;248;242m.[0m[38;2;249;38;114mALL[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mentity[0m[38;2;248;248;242m [0m[38;2;166;226;46mSyntaxTest[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgeneric[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mDATA_WIDTH [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 [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[38;2;190;132;255m8[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;114mport[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mclk [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mrst [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;248;248;242mb [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic_vector[0m[38;2;248;248;242m([0m[38;2;248;248;242mDATA_WIDTH [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;114mdownto[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;248;248;242msel [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mresult [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114mout[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic_vector[0m[38;2;248;248;242m([0m[38;2;248;248;242mDATA_WIDTH [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;114mdownto[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;248;248;242mflag [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114mout[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[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;166;226;46mSyntaxTest[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114marchitecture[0m[38;2;248;248;242m [0m[38;2;166;226;46mBehavioral[0m[38;2;248;248;242m [0m[38;2;249;38;114mof[0m[38;2;248;248;242m [0m[38;2;166;226;46mSyntaxTest[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msignal[0m[38;2;248;248;242m tmp [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic_vector[0m[38;2;248;248;242m([0m[38;2;248;248;242mDATA_WIDTH [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;114mdownto[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;114msignal[0m[38;2;248;248;242m done [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'0'[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m [0m[38;2;166;226;46mstate_type[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mIDLE[0m[38;2;248;248;242m,[0m[38;2;248;248;242m LOAD[0m[38;2;248;248;242m,[0m[38;2;248;248;242m EXECUTE[0m[38;2;248;248;242m,[0m[38;2;248;248;242m DONE[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msignal[0m[38;2;248;248;242m state [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstate_type[0m[38;2;248;248;242m [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mIDLE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mbegin[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mprocess[0m[38;2;248;248;242m([0m[38;2;248;248;242mclk[0m[38;2;248;248;242m,[0m[38;2;248;248;242m rst[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mvariable[0m[38;2;248;248;242m i [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 [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;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m rst [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'1'[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;249;38;114mothers[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255m'0'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m flag [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'0'[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m IDLE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melsif[0m[38;2;248;248;242m [0m[38;2;102;217;239mrising_edge[0m[38;2;248;248;242m([0m[38;2;248;248;242mclk[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcase[0m[38;2;248;248;242m state [0m[38;2;249;38;114mis[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m IDLE [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sel [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'1'[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114mand[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m EXECUTE[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114mor[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m LOAD[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;114mif[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m LOAD [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114mxor[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m EXECUTE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m EXECUTE [0m[38;2;249;38;114m=>[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<[0m[38;2;248;248;242m DATA_WIDTH [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m tmp[0m[38;2;248;248;242m([0m[38;2;248;248;242mi[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m tmp[0m[38;2;248;248;242m([0m[38;2;248;248;242mi[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m i [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m DONE[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;114mif[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m DONE [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m flag [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'1'[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m IDLE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mothers[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m IDLE[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;114mcase[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;114mif[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;249;38;114m process[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m result [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m tmp[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mBehavioral[0m[38;2;248;248;242m;[0m
|
230
tests/syntax-tests/source/Lean/LICENSE.md
vendored
230
tests/syntax-tests/source/Lean/LICENSE.md
vendored
@@ -1,230 +0,0 @@
|
||||
The `test.lean` file has been adpated from
|
||||
|
||||
- multiple files of [Mathematics in Lean](https://leanprover-community.github.io/mathematics_in_lean/) under the Apache 2.0 license,
|
||||
- and https://github.com/Julian/lean-across-the-board under the MIT license.
|
||||
|
||||
## Mathematics in Lean (Apache 2.0)
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2020 Jeremy Avigad, Patrick Massot.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
## Julian/lean-across-the-board (MIT)
|
||||
|
||||
Copyright (c) 2020 Julian Berman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
111
tests/syntax-tests/source/Lean/test.lean
vendored
111
tests/syntax-tests/source/Lean/test.lean
vendored
@@ -1,82 +1,67 @@
|
||||
import MIL.Common
|
||||
import Mathlib.Topology.Instances.Real.Defs
|
||||
import data.matrix.notation
|
||||
import data.vector2
|
||||
|
||||
open Set Filter Topology
|
||||
/-!
|
||||
|
||||
variable {α : Type*}
|
||||
variable (s t : Set ℕ)
|
||||
variable (ssubt : s ⊆ t)
|
||||
variable {α : Type*} (s : Set (Set α))
|
||||
-- Apostrophes are allowed in variable names
|
||||
variable (f'_x x' : ℕ)
|
||||
variable (bangwI' jablu'DI' QaQqu' nay' Ghay'cha' he' : ℕ)
|
||||
Helpers that don't currently fit elsewhere...
|
||||
|
||||
-- In the next example we could use `tauto` in each proof instead of knowing the lemmas
|
||||
example {α : Type*} (s : Set α) : Filter α :=
|
||||
{ sets := { t | s ⊆ t }
|
||||
univ_sets := subset_univ s
|
||||
sets_of_superset := fun hU hUV ↦ Subset.trans hU hUV
|
||||
inter_sets := fun hU hV ↦ subset_inter hU hV }
|
||||
-/
|
||||
|
||||
lemma split_eq {m n : Type*} (x : m × n) (p p' : m × n) :
|
||||
p = x ∨ p' = x ∨ (x ≠ p ∧ x ≠ p') := by tauto
|
||||
|
||||
-- For `playfield`s, the piece type and/or piece index type.
|
||||
variables (X : Type*)
|
||||
variables [has_repr X]
|
||||
|
||||
namespace chess.utils
|
||||
|
||||
section repr
|
||||
|
||||
@[class] structure One₂ (α : Type) where
|
||||
/-- The element one -/
|
||||
one : α
|
||||
/--
|
||||
An auxiliary wrapper for `option X` that allows for overriding the `has_repr` instance
|
||||
for `option`, and rather, output just the value in the `some` and a custom provided
|
||||
`string` for `none`.
|
||||
-/
|
||||
structure option_wrapper :=
|
||||
(val : option X)
|
||||
(none_s : string)
|
||||
|
||||
structure StandardTwoSimplex where
|
||||
x : ℝ
|
||||
y : ℝ
|
||||
z : ℝ
|
||||
x_nonneg : 0 ≤ x
|
||||
y_nonneg : 0 ≤ y
|
||||
z_nonneg : 0 ≤ z
|
||||
sum_eq : x + y + z = 1
|
||||
instance wrapped_option_repr : has_repr (option_wrapper X) :=
|
||||
⟨λ ⟨val, s⟩, (option.map has_repr.repr val).get_or_else s⟩
|
||||
|
||||
#check Pi.ringHom
|
||||
#check ker_Pi_Quotient_mk
|
||||
#eval 1 + 1
|
||||
variables {X}
|
||||
/--
|
||||
Construct an `option_wrapper` term from a provided `option X` and the `string`
|
||||
that will override the `has_repr.repr` for `none`.
|
||||
-/
|
||||
def option_wrap (val : option X) (none_s : string) : option_wrapper X := ⟨val, none_s⟩
|
||||
|
||||
/-- The homomorphism from ``R ⧸ ⨅ i, I i`` to ``Π i, R ⧸ I i`` featured in the Chinese
|
||||
Remainder Theorem. -/
|
||||
def chineseMap (I : ι → Ideal R) : (R ⧸ ⨅ i, I i) →+* Π i, R ⧸ I i :=
|
||||
Ideal.Quotient.lift (⨅ i, I i) (Pi.ringHom fun i : ι ↦ Ideal.Quotient.mk (I i))
|
||||
(by simp [← RingHom.mem_ker, ker_Pi_Quotient_mk])
|
||||
-- The size of the "vectors" for a `fin n' → X`, for `has_repr` definitions
|
||||
variables {m' n' : ℕ}
|
||||
|
||||
lemma chineseMap_mk (I : ι → Ideal R) (x : R) :
|
||||
chineseMap I (Quotient.mk _ x) = fun i : ι ↦ Ideal.Quotient.mk (I i) x :=
|
||||
rfl
|
||||
/--
|
||||
For a "vector" `X^n'` represented by the type `Π n' : ℕ, fin n' → X`, where
|
||||
the `X` has a `has_repr` instance itself, we can provide a `has_repr` for the "vector".
|
||||
This definition is used for displaying rows of the playfield, when it is defined
|
||||
via a `matrix`, likely through notation.
|
||||
-/
|
||||
def vec_repr : Π {n' : ℕ}, (fin n' → X) → string :=
|
||||
λ _ v, string.intercalate ", " ((vector.of_fn v).to_list.map repr)
|
||||
|
||||
theorem isCoprime_Inf {I : Ideal R} {J : ι → Ideal R} {s : Finset ι}
|
||||
(hf : ∀ j ∈ s, IsCoprime I (J j)) : IsCoprime I (⨅ j ∈ s, J j) := by
|
||||
classical
|
||||
simp_rw [isCoprime_iff_add] at *
|
||||
induction s using Finset.induction with
|
||||
| empty =>
|
||||
simp
|
||||
| @insert i s _ hs =>
|
||||
rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, ← one_eq_top]
|
||||
set K := ⨅ j ∈ s, J j
|
||||
calc
|
||||
1 = I + K := (hs fun j hj ↦ hf j (Finset.mem_insert_of_mem hj)).symm
|
||||
_ = I + K * (I + J i) := by rw [hf i (Finset.mem_insert_self i s), mul_one]
|
||||
_ = (1 + K) * I + K * J i := by ring
|
||||
_ ≤ I + K ⊓ J i := by gcongr ; apply mul_le_left ; apply mul_le_inf
|
||||
instance vec_repr_instance : has_repr (fin n' → X) := ⟨vec_repr⟩
|
||||
|
||||
/--
|
||||
For a `matrix` `X^(m' × n')` where the `X` has a `has_repr` instance itself,
|
||||
we can provide a `has_repr` for the matrix, using `vec_repr` for each of the rows of the matrix.
|
||||
This definition is used for displaying the playfield, when it is defined
|
||||
via a `matrix`, likely through notation.
|
||||
-/
|
||||
def matrix_repr : Π {m' n'}, matrix (fin m') (fin n') X → string :=
|
||||
λ _ _ M, string.intercalate ";\n" ((vector.of_fn M).to_list.map repr)
|
||||
|
||||
class Ring₃ (R : Type) extends AddGroup₃ R, Monoid₃ R, MulZeroClass R where
|
||||
/-- Multiplication is left distributive over addition -/
|
||||
left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
|
||||
/-- Multiplication is right distributive over addition -/
|
||||
right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
|
||||
|
||||
instance {R : Type} [Ring₃ R] : AddCommGroup₃ R :=
|
||||
{ Ring₃.toAddGroup₃ with
|
||||
add_comm := by
|
||||
sorry }
|
||||
instance matrix_repr_instance :
|
||||
has_repr (matrix (fin n') (fin m') X) := ⟨matrix_repr⟩
|
||||
|
||||
end repr
|
||||
|
||||
|
28
tests/syntax-tests/source/Typst/test.typ
vendored
28
tests/syntax-tests/source/Typst/test.typ
vendored
@@ -1,28 +0,0 @@
|
||||
#set text(9.5pt)
|
||||
|
||||
= Heading
|
||||
|
||||
- Bullet 1
|
||||
- Bullet 2
|
||||
- Bullet 3
|
||||
|
||||
+ List 1
|
||||
+ List 2
|
||||
+ List 3
|
||||
|
||||
#figure(
|
||||
table(
|
||||
columns: (auto, auto),
|
||||
table.header(
|
||||
[Name], [Age],
|
||||
),
|
||||
[John], [50],
|
||||
[Jane], [48],
|
||||
),
|
||||
caption: [People],
|
||||
)
|
||||
|
||||
```python
|
||||
def foo():
|
||||
print("hi")
|
||||
```
|
74
tests/syntax-tests/source/VHDL/test.vhdl
vendored
74
tests/syntax-tests/source/VHDL/test.vhdl
vendored
@@ -1,74 +0,0 @@
|
||||
-- This is a single-line comment
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity SyntaxTest is
|
||||
generic (
|
||||
DATA_WIDTH : integer := 8
|
||||
);
|
||||
port (
|
||||
clk : in std_logic;
|
||||
rst : in std_logic;
|
||||
a, b : in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
||||
sel : in std_logic;
|
||||
result : out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
||||
flag : out std_logic
|
||||
);
|
||||
end SyntaxTest;
|
||||
|
||||
architecture Behavioral of SyntaxTest is
|
||||
|
||||
signal tmp : std_logic_vector(DATA_WIDTH - 1 downto 0);
|
||||
signal done : std_logic := '0';
|
||||
|
||||
type state_type is (IDLE, LOAD, EXECUTE, DONE);
|
||||
signal state : state_type := IDLE;
|
||||
|
||||
begin
|
||||
|
||||
process(clk, rst)
|
||||
variable i : integer := 0;
|
||||
begin
|
||||
if rst = '1' then
|
||||
tmp <= (others => '0');
|
||||
flag <= '0';
|
||||
state <= IDLE;
|
||||
|
||||
elsif rising_edge(clk) then
|
||||
case state is
|
||||
when IDLE =>
|
||||
if sel = '1' then
|
||||
tmp <= a and b;
|
||||
state <= EXECUTE;
|
||||
else
|
||||
tmp <= a or b;
|
||||
state <= LOAD;
|
||||
end if;
|
||||
|
||||
when LOAD =>
|
||||
tmp <= a xor b;
|
||||
state <= EXECUTE;
|
||||
|
||||
when EXECUTE =>
|
||||
if i < DATA_WIDTH then
|
||||
tmp(i) <= not tmp(i);
|
||||
i := i + 1;
|
||||
else
|
||||
state <= DONE;
|
||||
end if;
|
||||
|
||||
when DONE =>
|
||||
flag <= '1';
|
||||
state <= IDLE;
|
||||
|
||||
when others =>
|
||||
state <= IDLE;
|
||||
end case;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
result <= tmp;
|
||||
|
||||
end Behavioral;
|
Reference in New Issue
Block a user