Add CSV syntax, closes #254

This commit is contained in:
sharkdp 2018-09-03 21:49:08 +02:00
parent 532fb921a6
commit 3447ed4def
3 changed files with 50 additions and 0 deletions

3
.gitmodules vendored
View file

@ -61,3 +61,6 @@
[submodule "assets/syntaxes/Puppet"]
path = assets/syntaxes/Puppet
url = https://github.com/russCloak/SublimePuppet
[submodule "assets/syntaxes/CSV"]
path = assets/syntaxes/CSV
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV

1
assets/syntaxes/CSV Submodule

@ -0,0 +1 @@
Subproject commit 4786d037a761bc45e516f6b0624a839919ec6d05

View file

@ -0,0 +1,46 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Advanced CSV
file_extensions:
- csv
- tsv
scope: text.advanced_csv
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
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