bat/assets/syntaxes/02_Extra/CSV.sublime-syntax

85 lines
2 KiB
Text
Raw Normal View History

2018-09-03 19:49:08 +00:00
%YAML 1.2
---
2021-03-28 19:35:01 +00:00
# See http://www.sublimetext.com/docs/3/syntax.html
name: Comma Separated Values
2018-09-03 19:49:08 +00:00
file_extensions:
- csv
- tsv
2021-03-28 19:35:01 +00:00
scope: text.csv
variables:
field_separator: (?:[,;\t])
record_separator: (?:$\n?)
2018-09-03 19:49:08 +00:00
contexts:
2021-03-28 19:35:01 +00:00
prototype:
- match: (?={{record_separator}})
pop: true
fields:
- match: ''
2018-09-03 19:49:08 +00:00
push:
2021-03-28 19:35:01 +00:00
- 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
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 variable.other
- include: field_contents
field4:
- match: ''
set:
- meta_content_scope: meta.field-4.csv constant.numeric
- include: field_contents
field5:
- match: ''
set:
- meta_content_scope: meta.field-5.csv keyword.operator
- include: field_contents