Skip to content

Commit

Permalink
Merge branch 'master' into syslog
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed May 12, 2021
2 parents b3ab843 + b16cacc commit 5db3c93
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 56 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: monthly
time: "04:00"
timezone: Europe/Berlin
ignore:
- dependency-name: git2
versions:
- 0.13.17
- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: monthly
time: "04:00"
timezone: Europe/Berlin
7 changes: 7 additions & 0 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ jobs:
run: bat --list-languages
- name: List of themes
run: bat --list-themes
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --document-private-items --all-features

build:
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@
[submodule "assets/syntaxes/Puppet"]
path = assets/syntaxes/02_Extra/Puppet
url = https://github.com/russCloak/SublimePuppet
[submodule "assets/syntaxes/CSV"]
path = assets/syntaxes/02_Extra/CSV
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV
[submodule "assets/themes/onehalf"]
path = assets/themes/onehalf
url = https://github.com/sonph/onehalf
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
## Other

- `Input::ordinary_file` and `Input::with_name` now accept `Path` rather than `OsStr` see #1571 (@matklad)
- The `LESS` environment variable is now included in `bat --diagnostic`, see #1589 (@Enselic)
- Increased min. required Rust version to 1.45

## Syntaxes

- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)

## New themes

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
atty = { version = "0.2.14", optional = true }
ansi_term = "^0.12.1"
ansi_colours = "^1.0"
console = "0.14.0"
console = "0.14.1"
lazy_static = { version = "1.4", optional = true }
wild = { version = "2.0", optional = true }
content_inspector = "0.2.4"
Expand Down
2 changes: 1 addition & 1 deletion assets/patches/Monokai-Extended.tmTheme.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 9c2aa3e..180cbbf 100644
<string>JSON String</string>
<key>scope</key>
- <string>meta.structure.dictionary.json string.quoted.double.json</string>
+ <string>meta.mapping.key.json string.quoted.double.json</string>
+ <string>meta.mapping.key.json string.quoted.double.json, punctuation.separator.sequence.csv</string>
<key>settings</key>
<dict>
<key>foreground</key>
Expand Down
1 change: 0 additions & 1 deletion assets/syntaxes/02_Extra/CSV
Submodule CSV deleted from 4786d0
110 changes: 71 additions & 39 deletions assets/syntaxes/02_Extra/CSV.sublime-syntax
Original file line number Diff line number Diff line change
@@ -1,46 +1,78 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Advanced CSV
# See http://www.sublimetext.com/docs/3/syntax.html
name: Comma Separated Values
file_extensions:
- csv
- tsv
scope: text.advanced_csv
scope: text.csv
variables:
field_separator: (?:[,;\t])
record_separator: (?:$\n?)
contexts:
main:
- match: (\")
captures:
1: string.quoted.double.advanced_csv
push:
- meta_scope: meta.quoted.advanced_csv
- match: (\")
captures:
1: string.quoted.double.advanced_csv
pop: true
- include: main
- match: '(\[([+-]?\d*)(\:)?([+-]?\d*)(\,)?([+-]?\d*)(\:)?([+-]?\d*)\])?\s*([<>v^])?\s*(=)'
captures:
1: keyword.operator.advanced_csv
2: constant.numeric.formula.advanced_csv
4: constant.numeric.formula.advanced_csv
6: constant.numeric.formula.advanced_csv
8: constant.numeric.formula.advanced_csv
9: keyword.operator.advanced_csv
10: keyword.operator.advanced_csv
prototype:
- match: (?={{record_separator}})
pop: true
fields:
- match: ''
push:
- meta_scope: meta.range.advanced_csv
- match: (?=(\")|$)
pop: true
- include: scope:source.python
- match: '(?<=^|,|\s|\")([0-9.eE+-]+)(?=$|,|\s|\")'
scope: meta.number.advanced_csv
captures:
1: constant.numeric.advanced_csv
- match: '(?<=^|,|\s|\")([^, \t\"]+)(?=$|,|\s|\")'
scope: meta.nonnumber.advanced_csv
captures:
1: storage.type.advanced_csv
- match: (\,)
scope: meta.delimiter.advanced_csv
captures:
1: keyword.operator.advanced_csv
- field_or_record_separator
- field4
- field_or_record_separator
- field3
- field_or_record_separator
- field2
- field_or_record_separator
- field1
main:
- meta_include_prototype: false
- match: '^'
set: fields

field_or_record_separator:
- meta_include_prototype: false
- match: '{{record_separator}}'
scope: punctuation.terminator.record.csv
pop: true
- match: '{{field_separator}}'
scope: punctuation.separator.sequence.csv
pop: true

field_contents:
- match: '"'
scope: punctuation.definition.string.begin.csv
push: double_quoted_string

- match: (?={{field_separator}}|{{record_separator}})
pop: true

double_quoted_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.csv
- match: '""'
scope: constant.character.escape.csv
- match: '"'
scope: punctuation.definition.string.end.csv
pop: true

field1:
- match: ''
set:
- meta_content_scope: meta.field-1.csv support.type
- include: field_contents
field2:
- match: ''
set:
- meta_content_scope: meta.field-2.csv support.function
- include: field_contents
field3:
- match: ''
set:
- meta_content_scope: meta.field-3.csv constant.numeric
- include: field_contents
field4:
- match: ''
set:
- meta_content_scope: meta.field-4.csv keyword.operator
- include: field_contents

2 changes: 1 addition & 1 deletion assets/syntaxes/02_Extra/SCSS_Sass
60 changes: 60 additions & 0 deletions assets/syntaxes/02_Extra/syntax_test_csv.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SYNTAX TEST "CSV.sublime-syntax"
Forename,Surname,House No.,Street,City,Postcode
#^^^^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^^^^^^^^ meta.field-3
# ^ punctuation.separator.sequence
# ^^^^^^ meta.field-4
# ^ punctuation.separator.sequence
# ^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
John,Doe,87,Logon Road,Citiville,TU43 6GH
#^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^ meta.field-3
# ^ punctuation.separator.sequence
# ^^^^^^^^^^ meta.field-4
# ^ punctuation.separator.sequence
# ^^^^^^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
Jane,Doe,22,"""Fun"" Street","The City, County",FA90 1XA
#^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^ meta.field-3
# ^ punctuation.separator.sequence
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
# ^^ constant.character.escape
# ^^ constant.character.escape
# ^ punctuation.separator.sequence
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
Fred,Bloggs,"19","Street
#^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^^ meta.field-3 string.quoted.double
# ^ punctuation.separator.sequence
# ^ meta.field-4 punctuation.definition.string.begin
# ^^^^^^^^ meta.field-4 string.quoted.double
Spanning Multiple ""
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
# ^^ constant.character.escape
Lines",Citee,P0stc0d3
#^^^^^ meta.field-4 string.quoted.double
# ^ meta.field-4 punctuation.definition.string.end
# ^ punctuation.separator.sequence
# ^^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
60 changes: 60 additions & 0 deletions assets/syntaxes/02_Extra/syntax_test_tsv.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SYNTAX TEST "CSV.sublime-syntax"
Forename Surname House No. Street City Postcode
#^^^^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^^^^^^^^ meta.field-3
# ^ punctuation.separator.sequence
# ^^^^^^ meta.field-4
# ^ punctuation.separator.sequence
# ^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
John Doe 87 Logon Road Citiville TU43 6GH
#^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^ meta.field-3
# ^ punctuation.separator.sequence
# ^^^^^^^^^^ meta.field-4
# ^ punctuation.separator.sequence
# ^^^^^^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
Jane Doe 22 """Fun"" Street" "The City County" FA90 1XA
#^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^ meta.field-3
# ^ punctuation.separator.sequence
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
# ^^ constant.character.escape
# ^^ constant.character.escape
# ^ punctuation.separator.sequence
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
Fred Bloggs "19" "Street
#^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^ meta.field-2
# ^ punctuation.separator.sequence
# ^^^ meta.field-3 string.quoted.double
# ^ punctuation.separator.sequence
# ^ meta.field-4 punctuation.definition.string.begin
# ^^^^^^^^ meta.field-4 string.quoted.double
Spanning Multiple ""
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
# ^^ constant.character.escape
Lines" Citee P0stc0d3
#^^^^^ meta.field-4 string.quoted.double
# ^ meta.field-4 punctuation.definition.string.end
# ^ punctuation.separator.sequence
# ^^^^^ meta.field-1
# ^ punctuation.separator.sequence
# ^^^^^^^^ meta.field-2
1 change: 1 addition & 0 deletions src/bin/bat/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ fn run() -> Result<bool> {
.info(EnvironmentVariables::list(&[
"SHELL",
"PAGER",
"LESS",
"BAT_PAGER",
"BAT_CACHE_PATH",
"BAT_CONFIG_PATH",
Expand Down
14 changes: 7 additions & 7 deletions tests/syntax-tests/highlighted/CSV/comma_in_quotes.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
first,last,address,city,zip
John,Doe,120 any st.,"Anytown, WW",08123
a,b
1,"ha 
""ha"" 
ha",120 any st.,"Anytown, WW",08123
3,4,120 any st.,"Anytown, WW",08123
first,last,address,city,zip
John,Doe,120 any st.,"Anytown, WW",08123
a,b
1,"ha 
""ha"" 
ha",120 any st.,"Anytown, WW",08123
3,4,120 any st.,"Anytown, WW",08123

0 comments on commit 5db3c93

Please sign in to comment.