--- 
name: CSV
fileTypes: 
- csv
scopeName: text.tabular.csv
repository: 
  row: 
    name: meta.tabular.row.csv
    begin: ^(?!$)
    end: $
    patterns: 
    - include: "#field"
  field: 
    patterns: 
    - endCaptures: 
        "1": 
          name: punctuation.definition.field.csv
        "3": 
          name: punctuation.separator.tabular.field.csv
      begin: (^|(?<=,))(")
      contentName: meta.tabular.field.quoted.csv
      beginCaptures: 
        "2": 
          name: punctuation.definition.field.csv
      end: (")($|(,))
      patterns: 
      - name: constant.character.escape.straight-quote.csv
        match: "\"\""
      comment: "\n\
        \t\t\t\t\t\tthis field uses \"s and is thus able to enclose\n\
        \t\t\t\t\t\tnewlines or commas\n\
        \t\t\t\t\t"
    - endCaptures: 
        "1": 
          name: punctuation.separator.tabular.field.csv
      begin: (:^|(?<=,))(?!$|,)
      contentName: meta.tabular.field.csv
      end: $|(,)
    - name: punctuation.separator.tabular.field.csv
      match: ","
  header: 
    name: meta.tabular.row.header.csv
    begin: ^(?!$)
    end: $
    patterns: 
    - include: "#field"
  table: 
    name: meta.tabular.table.csv
    begin: ^
    end: ^$not possible$^
    patterns: 
    - include: "#header"
    - begin: (\n)
      beginCaptures: 
        "1": 
          name: punctuation.separator.table.row.csv
      end: ^$not possible$^
      patterns: 
      - include: "#row"
      - name: punctuation.separator.table.row.csv
        match: \n
      comment: "\n\
        \t\t\t\t\t\teverything after the first row is not a header\n\
        \t\t\t\t\t"
uuid: B0691F9F-D279-48CB-8959-2C9426579002
patterns: 
- include: "#table"
keyEquivalent: ^~C
