1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-02-23 13:28:31 +00:00
bat/assets/syntaxes/02_Extra/CSV/CSV-comma.sublime-syntax

80 lines
1.9 KiB
Plaintext
Raw Normal View History

2018-09-03 21:49:08 +02:00
%YAML 1.2
---
2021-03-28 22:35:01 +03:00
# See http://www.sublimetext.com/docs/3/syntax.html
name: Comma Separated Values
scope: text.csv.comma
2021-03-28 22:35:01 +03:00
variables:
field_separator: (?:,)
2021-03-28 22:35:01 +03:00
record_separator: (?:$\n?)
2018-09-03 21:49:08 +02:00
contexts:
main:
- match: '^'
push: fields
2021-03-28 22:35:01 +03:00
fields:
- include: record_separator
- match: ''
2018-09-03 21:49:08 +02:00
push:
- field_or_record_separator
- field5
2021-03-28 22:35:01 +03:00
- 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:
2021-03-28 22:35:01 +03:00
- meta_include_prototype: false
- match: '{{record_separator}}'
2021-03-28 22:35:01 +03:00
scope: punctuation.terminator.record.csv
pop: true
field_or_record_separator:
- meta_include_prototype: false
- include: record_separator_pop
- match: '{{field_separator}}'
2021-03-28 22:35:01 +03:00
scope: punctuation.separator.sequence.csv
pop: true
field_contents:
- match: '"'
scope: punctuation.definition.string.begin.csv
push: scope:text.csv#double_quoted_string
2021-03-28 22:35:01 +03:00
- include: record_separator_pop
- match: (?={{field_separator}})
2021-03-28 22:35:01 +03:00
pop: true
field1:
- match: ''
2021-03-28 22:35:01 +03:00
set:
- meta_content_scope: meta.field-1.csv variable.parameter
2021-03-28 22:35:01 +03:00
- include: field_contents
field2:
- match: ''
2021-03-28 22:35:01 +03:00
set:
- meta_content_scope: meta.field-2.csv support.function
- include: field_contents
field3:
- match: ''
2021-03-28 22:35:01 +03:00
set:
- meta_content_scope: meta.field-3.csv constant.numeric
2021-03-28 22:35:01 +03:00
- include: field_contents
field4:
- match: ''
2021-03-28 22:35:01 +03:00
set:
- meta_content_scope: meta.field-4.csv keyword.operator
2021-03-28 22:35:01 +03:00
- include: field_contents
field5:
- match: ''
set:
- meta_content_scope: meta.field-5.csv string.unquoted
- include: field_contents