Repository: sharkdp/bat (language: rust)

Issue:
TSV highlighting doesn't work
<!-- Hey there, thank you for creating an issue! -->

**Describe the bug you encountered:**
I'm reading tab-separated files with two columns at it seems that it is still using the comma as delimiter.

`cat file | bat -l tsv` gives:

![imatge](https://user-images.githubusercontent.com/11339330/154508140-781e3dc5-bcec-455c-8ac6-39132d188998.png)


**What did you expect to happen instead?**
Highlight each column in a different color.


**How did you install `bat`?**

`cargo install --locked bat`

Cargo version: ` 1.53.0`
OS: Ubuntu `20.04`
`bat` version: `0.19`
<!-- apt-get, homebrew, GitHub release, etc. -->

---

**bat version and environment**

<!--
In order to reproduce your issue, please add some information about the environment
in which you're running bat. To do this, run the full `bat` command that demonstrates
the bug, and attach the `--diagnostic` option:

    bat [other options and arguments…] --diagnostic

Finally, paste the Markdown output here. Please make sure that it does not reveal any
personal information.


If you are running bat 0.17.1 or older (where --diagnostic is not available), please
run the script at

    https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh

(click "Raw" to get the actual source code) and paste the Markdown output here. If you
are on Windows, please let us know your bat version and your Windows version.
-->



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6110365120..d1d4b99ab3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@
 - Add syntax mapping for `paru` configuration files #3182 (@cyqsimon)
 - Add support for [Idris 2 programming language](https://www.idris-lang.org/) #3150 (@buzden)
 - Add syntax mapping for `nix`'s '`flake.lock` lockfiles #3196 (@odilf)
+- Improvements to CSV/TSV highlighting, with autodetection of delimiter and support for TSV files, see #3186 (@keith-hall)
 
 ## Themes
 
diff --git a/assets/syntaxes/02_Extra/CSV.sublime-syntax b/assets/syntaxes/02_Extra/CSV/CSV-comma.sublime-syntax
similarity index 62%
rename from assets/syntaxes/02_Extra/CSV.sublime-syntax
rename to assets/syntaxes/02_Extra/CSV/CSV-comma.sublime-syntax
index 0ad17834f5..f23751acf2 100644
--- a/assets/syntaxes/02_Extra/CSV.sublime-syntax
+++ b/assets/syntaxes/02_Extra/CSV/CSV-comma.sublime-syntax
@@ -2,20 +2,21 @@
 ---
 # See http://www.sublimetext.com/docs/3/syntax.html
 name: Comma Separated Values
-file_extensions:
-  - csv
-  - tsv
-scope: text.csv
+scope: text.csv.comma
 variables:
-  field_separator: (?:[,;|\t])
+  field_separator: (?:,)
   record_separator: (?:$\n?)
 contexts:
-  prototype:
-    - match: (?={{record_separator}})
-      pop: true
+  main:
+    - match: '^'
+      push: fields
+
   fields:
-    - match: ""
+    - include: record_separator
+    - match: ''
       push:
+        - field_or_record_separator
+        - field5
         - field_or_record_separator
         - field4
         - field_or_record_separator
@@ -24,54 +25,55 @@ contexts:
         - field2
         - field_or_record_separator
         - field1
-  main:
-    - meta_include_prototype: false
-    - match: "^"
-      set: fields
 
-  field_or_record_separator:
+  record_separator_pop:
+    - match: (?={{record_separator}})
+      pop: true
+
+  record_separator:
     - meta_include_prototype: false
-    - match: "{{record_separator}}"
+    - match: '{{record_separator}}'
       scope: punctuation.terminator.record.csv
       pop: true
-    - match: "{{field_separator}}"
+
+  field_or_record_separator:
+    - meta_include_prototype: false
+    - include: record_separator_pop
+    - 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
+      push: scope:text.csv#double_quoted_string
 
-  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
+    - include: record_separator_pop
+    - match: (?={{field_separator}})
       pop: true
 
   field1:
-    - match: ""
+    - match: ''
       set:
-        - meta_content_scope: meta.field-1.csv support.type
+        - meta_content_scope: meta.field-1.csv variable.parameter
         - include: field_contents
   field2:
-    - match: ""
+    - match: ''
       set:
         - meta_content_scope: meta.field-2.csv support.function
         - include: field_contents
   field3:
-    - match: ""
+    - match: ''
       set:
         - meta_content_scope: meta.field-3.csv constant.numeric
         - include: field_contents
   field4:
-    - match: ""
+    - match: ''
       set:
         - meta_content_scope: meta.field-4.csv keyword.operator
         - include: field_contents
+  field5:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-5.csv string.unquoted
+        - include: field_contents
diff --git a/assets/syntaxes/02_Extra/CSV/CSV-pipe.sublime-syntax b/assets/syntaxes/02_Extra/CSV/CSV-pipe.sublime-syntax
new file mode 100644
index 0000000000..52103fdee4
--- /dev/null
+++ b/assets/syntaxes/02_Extra/CSV/CSV-pipe.sublime-syntax
@@ -0,0 +1,80 @@
+%YAML 1.2
+---
+# See http://www.sublimetext.com/docs/3/syntax.html
+name: Pipe Separated Values
+scope: text.csv.pipe
+variables:
+  field_separator: (?:\|)
+  record_separator: (?:$\n?)
+
+contexts:
+  main:
+    - match: '^'
+      push: fields
+
+  fields:
+    - include: record_separator
+    - match: ''
+      push:
+        - field_or_record_separator
+        - field5
+        - field_or_record_separator
+        - field4
+        - field_or_record_separator
+        - field3
+        - field_or_record_separator
+        - field2
+        - field_or_record_separator
+        - field1
+
+  record_separator_pop:
+    - match: (?={{record_separator}})
+      pop: true
+
+  record_separator:
+    - meta_include_prototype: false
+    - match: '{{record_separator}}'
+      scope: punctuation.terminator.record.csv
+      pop: true
+
+  field_or_record_separator:
+    - meta_include_prototype: false
+    - include: record_separator_pop
+    - match: '{{field_separator}}'
+      scope: punctuation.separator.sequence.csv
+      pop: true
+
+  field_contents:
+    - match: '"'
+      scope: punctuation.definition.string.begin.csv
+      push: scope:text.csv#double_quoted_string
+
+    - include: record_separator_pop
+    - match: (?={{field_separator}})
+      pop: true
+
+  field1:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-1.csv variable.parameter
+        - 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
+  field5:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-5.csv string.unquoted
+        - include: field_contents
diff --git a/assets/syntaxes/02_Extra/CSV/CSV-semi-colon.sublime-syntax b/assets/syntaxes/02_Extra/CSV/CSV-semi-colon.sublime-syntax
new file mode 100644
index 0000000000..e0547ce009
--- /dev/null
+++ b/assets/syntaxes/02_Extra/CSV/CSV-semi-colon.sublime-syntax
@@ -0,0 +1,79 @@
+%YAML 1.2
+---
+# See http://www.sublimetext.com/docs/3/syntax.html
+name: Semi-Colon Separated Values
+scope: text.csv.semi-colon
+variables:
+  field_separator: (?:;)
+  record_separator: (?:$\n?)
+contexts:
+  main:
+    - match: '^'
+      push: fields
+
+  fields:
+    - include: record_separator
+    - match: ''
+      push:
+        - field_or_record_separator
+        - field5
+        - field_or_record_separator
+        - field4
+        - field_or_record_separator
+        - field3
+        - field_or_record_separator
+        - field2
+        - field_or_record_separator
+        - field1
+
+  record_separator_pop:
+    - match: (?={{record_separator}})
+      pop: true
+
+  record_separator:
+    - meta_include_prototype: false
+    - match: '{{record_separator}}'
+      scope: punctuation.terminator.record.csv
+      pop: true
+
+  field_or_record_separator:
+    - meta_include_prototype: false
+    - include: record_separator_pop
+    - match: '{{field_separator}}'
+      scope: punctuation.separator.sequence.csv
+      pop: true
+
+  field_contents:
+    - match: '"'
+      scope: punctuation.definition.string.begin.csv
+      push: scope:text.csv#double_quoted_string
+
+    - include: record_separator_pop
+    - match: (?={{field_separator}})
+      pop: true
+
+  field1:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-1.csv variable.parameter
+        - 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
+  field5:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-5.csv string.unquoted
+        - include: field_contents
diff --git a/assets/syntaxes/02_Extra/CSV/CSV.sublime-syntax b/assets/syntaxes/02_Extra/CSV/CSV.sublime-syntax
new file mode 100644
index 0000000000..8ce83acb43
--- /dev/null
+++ b/assets/syntaxes/02_Extra/CSV/CSV.sublime-syntax
@@ -0,0 +1,113 @@
+%YAML 1.2
+---
+# See http://www.sublimetext.com/docs/3/syntax.html
+name: Separated Values
+file_extensions:
+  - csv
+scope: text.csv
+variables:
+  field_separator_chars: ',;\t|'
+  field_separator: (?:[{{field_separator_chars}}])
+  record_separator: (?:$\n?)
+contexts:
+  main:
+    - meta_include_prototype: false
+    - include: three_field_separators
+    - include: single_separator_type_on_line
+    - match: '^'
+      push: unknown-separated-main
+
+  three_field_separators:
+    - match: ^(?=(?:[^,]*,){3})
+      set: scope:text.csv.comma
+    - match: ^(?=(?:[^;]*;){3})
+      set: scope:text.csv.semi-colon
+    - match: ^(?=(?:[^\t]*\t){3})
+      set: scope:text.csv.tab
+    - match: ^(?=(?:[^|]*\|){3})
+      set: scope:text.csv.pipe
+
+  single_separator_type_on_line:
+    - match: ^(?=[^{{field_separator_chars}}]*,[^;\t|]*$)
+      set: scope:text.csv.comma
+    - match: ^(?=[^{{field_separator_chars}}]*;[^,\t|]*$)
+      set: scope:text.csv.semi-colon
+    - match: ^(?=[^{{field_separator_chars}}]*\t[^,;|]*$)
+      set: scope:text.csv.tab
+    - match: ^(?=[^{{field_separator_chars}}]*\|[^,;\t]*$)
+      set: scope:text.csv.pipe
+
+  unknown-separated-main:
+    - include: record_separator
+    - match: ''
+      push:
+        - field_or_record_separator
+        - field5
+        - field_or_record_separator
+        - field4
+        - field_or_record_separator
+        - field3
+        - field_or_record_separator
+        - field2
+        - field_or_record_separator
+        - field1
+
+  record_separator_pop:
+    - match: (?={{record_separator}})
+      pop: true
+
+  record_separator:
+    - meta_include_prototype: false
+    - match: '{{record_separator}}'
+      scope: punctuation.terminator.record.csv
+
+  field_or_record_separator:
+    - meta_include_prototype: false
+    - include: record_separator_pop
+    - match: '{{field_separator}}'
+      scope: punctuation.separator.sequence.csv
+      pop: true
+
+  field_contents:
+    - match: '"'
+      scope: punctuation.definition.string.begin.csv
+      push: double_quoted_string
+
+    - include: record_separator_pop
+    - match: (?={{field_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 variable.parameter
+        - 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
+  field5:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-5.csv string.unquoted
+        - include: field_contents
diff --git a/assets/syntaxes/02_Extra/CSV/TSV.sublime-syntax b/assets/syntaxes/02_Extra/CSV/TSV.sublime-syntax
new file mode 100644
index 0000000000..fdca0c3124
--- /dev/null
+++ b/assets/syntaxes/02_Extra/CSV/TSV.sublime-syntax
@@ -0,0 +1,83 @@
+%YAML 1.2
+---
+# See http://www.sublimetext.com/docs/3/syntax.html
+name: Tab Separated Values
+scope: text.csv.tab
+file_extensions:
+  - tsv
+
+variables:
+  field_separator: (?:\t)
+  record_separator: (?:$\n?)
+
+contexts:
+  main:
+    - match: '^'
+      push: fields
+
+  fields:
+    - include: record_separator
+    - match: ''
+      push:
+        - field_or_record_separator
+        - field5
+        - field_or_record_separator
+        - field4
+        - field_or_record_separator
+        - field3
+        - field_or_record_separator
+        - field2
+        - field_or_record_separator
+        - field1
+
+  record_separator_pop:
+    - match: (?={{record_separator}})
+      pop: true
+
+  record_separator:
+    - meta_include_prototype: false
+    - match: '{{record_separator}}'
+      scope: punctuation.terminator.record.csv
+      pop: true
+
+  field_or_record_separator:
+    - meta_include_prototype: false
+    - include: record_separator_pop
+    - match: '{{field_separator}}'
+      scope: punctuation.separator.sequence.csv
+      pop: true
+
+  field_contents:
+    - match: '"'
+      scope: punctuation.definition.string.begin.csv
+      push: scope:text.csv#double_quoted_string
+
+    - include: record_separator_pop
+    - match: (?={{field_separator}})
+      pop: true
+
+  field1:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-1.csv variable.parameter
+        - 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
+  field5:
+    - match: ''
+      set:
+        - meta_content_scope: meta.field-5.csv string.unquoted
+        - include: field_contents


Test patch:
diff --git a/tests/syntax-tests/highlighted/CSV/comma-delimited.csv b/tests/syntax-tests/highlighted/CSV/comma-delimited.csv
new file mode 100644
index 0000000000..05285a7c82
--- /dev/null
+++ b/tests/syntax-tests/highlighted/CSV/comma-delimited.csv
@@ -0,0 +1,3 @@
+[3;38;2;253;151;31mfoo[0m[38;2;253;151;31m,[0m[38;2;102;217;239mbar[0m[38;2;253;151;31m,[0m[38;2;190;132;255mbaz[0m[38;2;253;151;31m,[0m[38;2;249;38;114mthis|that[0m[38;2;253;151;31m,[0m[38;2;230;219;116mtest[0m[38;2;253;151;31m,[0m[3;38;2;253;151;31mcolors[0m[38;2;253;151;31m,[0m[38;2;102;217;239mcycle[0m
+[3;38;2;253;151;31m1.2[0m[38;2;253;151;31m,[0m[38;2;102;217;239m1.7[0m[38;2;253;151;31m,[0m[38;2;190;132;255m2.5[0m[38;2;253;151;31m,[0m[38;2;249;38;114mblah;cool[0m[38;2;253;151;31m,[0m[38;2;230;219;116mtest[0m[38;2;253;151;31m,[0m[3;38;2;253;151;31mcolors[0m[38;2;253;151;31m,[0m[38;2;102;217;239mcycle[0m
+
diff --git a/tests/syntax-tests/highlighted/CSV/comma_in_quotes.csv b/tests/syntax-tests/highlighted/CSV/comma_in_quotes.csv
index 9bd0da1a6c..8f4004a020 100644
--- a/tests/syntax-tests/highlighted/CSV/comma_in_quotes.csv
+++ b/tests/syntax-tests/highlighted/CSV/comma_in_quotes.csv
@@ -1,7 +1,7 @@
-[3;38;2;166;226;46mfirst[0m[38;2;253;151;31m,[0m[38;2;102;217;239mlast[0m[38;2;253;151;31m,[0m[38;2;190;132;255maddress[0m[38;2;253;151;31m,[0m[38;2;249;38;114mcity[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46mzip[0m
-[3;38;2;166;226;46mJohn[0m[38;2;253;151;31m,[0m[38;2;102;217;239mDoe[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
-[3;38;2;166;226;46ma[0m[38;2;253;151;31m,[0m[38;2;102;217;239mb[0m
-[3;38;2;166;226;46m1[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mha [0m
+[3;38;2;253;151;31mfirst[0m[38;2;253;151;31m,[0m[38;2;102;217;239mlast[0m[38;2;253;151;31m,[0m[38;2;190;132;255maddress[0m[38;2;253;151;31m,[0m[38;2;249;38;114mcity[0m[38;2;253;151;31m,[0m[38;2;230;219;116mzip[0m
+[3;38;2;253;151;31mJohn[0m[38;2;253;151;31m,[0m[38;2;102;217;239mDoe[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;230;219;116m08123[0m
+[3;38;2;253;151;31ma[0m[38;2;253;151;31m,[0m[38;2;102;217;239mb[0m
+[3;38;2;253;151;31m1[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mha [0m
 [38;2;190;132;255m""[0m[38;2;230;219;116mha[0m[38;2;190;132;255m""[0m[38;2;230;219;116m [0m
-[38;2;230;219;116mha[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
-[3;38;2;166;226;46m3[0m[38;2;253;151;31m,[0m[38;2;102;217;239m4[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
+[38;2;230;219;116mha[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;230;219;116m08123[0m
+[3;38;2;253;151;31m3[0m[38;2;253;151;31m,[0m[38;2;102;217;239m4[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;230;219;116m08123[0m
diff --git a/tests/syntax-tests/highlighted/CSV/decimals_comma_decimal_point_pipe_delimited.csv b/tests/syntax-tests/highlighted/CSV/decimals_comma_decimal_point_pipe_delimited.csv
new file mode 100644
index 0000000000..843264e679
--- /dev/null
+++ b/tests/syntax-tests/highlighted/CSV/decimals_comma_decimal_point_pipe_delimited.csv
@@ -0,0 +1,3 @@
+[3;38;2;253;151;31mfoo[0m[38;2;253;151;31m|[0m[38;2;102;217;239mbar[0m[38;2;253;151;31m|[0m[38;2;190;132;255mbaz[0m
+[3;38;2;253;151;31m1,2[0m[38;2;253;151;31m|[0m[38;2;102;217;239m1,7[0m[38;2;253;151;31m|[0m[38;2;190;132;255m2,7[0m
+[3;38;2;253;151;31m1,5[0m[38;2;253;151;31m|[0m[38;2;102;217;239m8,5[0m[38;2;253;151;31m|[0m[38;2;190;132;255m-5,5[0m
diff --git a/tests/syntax-tests/highlighted/CSV/decimals_comma_decimal_point_semicolon_delimited.csv b/tests/syntax-tests/highlighted/CSV/decimals_comma_decimal_point_semicolon_delimited.csv
new file mode 100644
index 0000000000..da1b070446
--- /dev/null
+++ b/tests/syntax-tests/highlighted/CSV/decimals_comma_decimal_point_semicolon_delimited.csv
@@ -0,0 +1,3 @@
+[3;38;2;253;151;31mfoo[0m[38;2;253;151;31m;[0m[38;2;102;217;239mbar[0m[38;2;253;151;31m;[0m[38;2;190;132;255mbaz[0m
+[3;38;2;253;151;31m1,2[0m[38;2;253;151;31m;[0m[38;2;102;217;239m1,7[0m[38;2;253;151;31m;[0m[38;2;190;132;255m2,7[0m
+[3;38;2;253;151;31m1,5[0m[38;2;253;151;31m;[0m[38;2;102;217;239m8,5[0m[38;2;253;151;31m;[0m[38;2;190;132;255m-5,5[0m
diff --git a/tests/syntax-tests/highlighted/CSV/simple.tsv b/tests/syntax-tests/highlighted/CSV/simple.tsv
new file mode 100644
index 0000000000..7dd1a9de96
--- /dev/null
+++ b/tests/syntax-tests/highlighted/CSV/simple.tsv
@@ -0,0 +1,3 @@
+[3;38;2;253;151;31mfoo[0m[38;2;253;151;31m	[0m[38;2;102;217;239mbar[0m[38;2;253;151;31m	[0m[38;2;190;132;255mbaz|;,[0m[38;2;253;151;31m	[0m[38;2;249;38;114mtest[0m[38;2;253;151;31m	[0m[38;2;230;219;116mhello world[0m[38;2;253;151;31m	[0m[3;38;2;253;151;31mtsv[0m
+[3;38;2;253;151;31m1,2[0m[38;2;253;151;31m	[0m[38;2;102;217;239m1,7[0m[38;2;253;151;31m	[0m[38;2;190;132;255m2,7[0m[38;2;253;151;31m	[0m[38;2;249;38;114ma b c[0m[38;2;253;151;31m	[0m[38;2;230;219;116m"[0m[38;2;230;219;116mhello	again[0m[38;2;230;219;116m"[0m[38;2;253;151;31m	[0m[3;38;2;253;151;31mtsv[0m
+[3;38;2;230;219;116m"[0m[3;38;2;230;219;116m;|,[0m[3;38;2;230;219;116m"[0m[38;2;253;151;31m	[0m[38;2;102;217;239m;|,[0m[38;2;253;151;31m	[0m[38;2;190;132;255mbaz[0m[38;2;253;151;31m	[0m[38;2;249;38;114mtest[0m[38;2;253;151;31m	[0m[38;2;230;219;116m"[0m[38;2;230;219;116mhello world[0m[38;2;230;219;116m"[0m[38;2;253;151;31m	[0m[3;38;2;253;151;31mtsv[0m
diff --git a/tests/syntax-tests/source/CSV/comma-delimited.csv b/tests/syntax-tests/source/CSV/comma-delimited.csv
new file mode 100644
index 0000000000..4d7b2ec28c
--- /dev/null
+++ b/tests/syntax-tests/source/CSV/comma-delimited.csv
@@ -0,0 +1,3 @@
+foo,bar,baz,this|that,test,colors,cycle
+1.2,1.7,2.5,blah;cool,test,colors,cycle
+
diff --git a/tests/syntax-tests/source/CSV/decimals_comma_decimal_point_pipe_delimited.csv b/tests/syntax-tests/source/CSV/decimals_comma_decimal_point_pipe_delimited.csv
new file mode 100644
index 0000000000..c8a4678640
--- /dev/null
+++ b/tests/syntax-tests/source/CSV/decimals_comma_decimal_point_pipe_delimited.csv
@@ -0,0 +1,3 @@
+foo|bar|baz
+1,2|1,7|2,7
+1,5|8,5|-5,5
diff --git a/tests/syntax-tests/source/CSV/decimals_comma_decimal_point_semicolon_delimited.csv b/tests/syntax-tests/source/CSV/decimals_comma_decimal_point_semicolon_delimited.csv
new file mode 100644
index 0000000000..6330175005
--- /dev/null
+++ b/tests/syntax-tests/source/CSV/decimals_comma_decimal_point_semicolon_delimited.csv
@@ -0,0 +1,3 @@
+foo;bar;baz
+1,2;1,7;2,7
+1,5;8,5;-5,5
diff --git a/tests/syntax-tests/source/CSV/simple.tsv b/tests/syntax-tests/source/CSV/simple.tsv
new file mode 100644
index 0000000000..2cf870a511
--- /dev/null
+++ b/tests/syntax-tests/source/CSV/simple.tsv
@@ -0,0 +1,3 @@
+foo	bar	baz|;,	test	hello world	tsv
+1,2	1,7	2,7	a b c	"hello	again"	tsv
+";|,"	;|,	baz	test	"hello world"	tsv