--- 
name: BibTeX
fileTypes: 
- bib
scopeName: text.bibtex
repository: 
  nested_braces: 
    endCaptures: 
      "0": 
        name: punctuation.definition.group.end.bibtex
    begin: \{
    beginCaptures: 
      "0": 
        name: punctuation.definition.group.begin.bibtex
    end: \}
    patterns: 
    - include: "#nested_braces"
  integer: 
    name: constant.numeric.bibtex
    match: \d+
  string_content: 
    patterns: 
    - name: string.quoted.double.bibtex
      endCaptures: 
        "0": 
          name: punctuation.definition.string.end.bibtex
      begin: "\""
      beginCaptures: 
        "0": 
          name: punctuation.definition.string.begin.bibtex
      end: "\""
      patterns: 
      - include: "#nested_braces"
    - name: string.quoted.other.braces.bibtex
      endCaptures: 
        "0": 
          name: punctuation.definition.string.end.bibtex
      begin: \{
      beginCaptures: 
        "0": 
          name: punctuation.definition.string.begin.bibtex
      end: \}
      patterns: 
      - name: invalid.illegal.at-sign.bibtex
        match: "@"
      - include: "#nested_braces"
uuid: 47F30BA1-6B1D-11D9-9A60-000D93589AF6
foldingStartMarker: \@[a-zA-Z]+\s*[{(].+,
patterns: 
- name: comment.line.at-sign.bibtex
  begin: "@Comment"
  beginCaptures: 
    "0": 
      name: punctuation.definition.comment.bibtex
  end: $\n?
- name: meta.string-constant.braces.bibtex
  endCaptures: 
    "0": 
      name: punctuation.section.string-constant.end.bibtex
  begin: ((@)String)\s*(\{)\s*([a-zA-Z]*)
  beginCaptures: 
    "1": 
      name: keyword.other.string-constant.bibtex
    "2": 
      name: punctuation.definition.keyword.bibtex
    "3": 
      name: punctuation.section.string-constant.begin.bibtex
    "4": 
      name: variable.other.bibtex
  end: \}
  patterns: 
  - include: "#string_content"
- name: meta.string-constant.parenthesis.bibtex
  endCaptures: 
    "0": 
      name: punctuation.section.string-constant.end.bibtex
  begin: ((@)String)\s*(\()\s*([a-zA-Z]*)
  beginCaptures: 
    "1": 
      name: keyword.other.string-constant.bibtex
    "2": 
      name: punctuation.definition.keyword.bibtex
    "3": 
      name: punctuation.section.string-constant.begin.bibtex
    "4": 
      name: variable.other.bibtex
  end: \)
  patterns: 
  - include: "#string_content"
- name: meta.entry.braces.bibtex
  endCaptures: 
    "0": 
      name: punctuation.section.entry.end.bibtex
  begin: ((@)[a-zA-Z]+)\s*(\{)\s*([^\s,]*)
  beginCaptures: 
    "1": 
      name: keyword.other.entry-type.bibtex
    "2": 
      name: punctuation.definition.keyword.bibtex
    "3": 
      name: punctuation.section.entry.begin.bibtex
    "4": 
      name: entity.name.type.entry-key.bibtex
  end: \}
  patterns: 
  - name: meta.key-assignment.bibtex
    begin: ([a-zA-Z]+)\s*(\=)
    beginCaptures: 
      "1": 
        name: string.unquoted.key.bibtex
      "2": 
        name: punctuation.separator.key-value.bibtex
    end: (?=[,}])
    patterns: 
    - include: "#string_content"
    - include: "#integer"
- name: meta.entry.parenthesis.bibtex
  endCaptures: 
    "0": 
      name: punctuation.section.entry.end.bibtex
  begin: ((@)[a-zA-Z]+)\s*(\()\s*([^\s,]*)
  beginCaptures: 
    "1": 
      name: keyword.other.entry-type.bibtex
    "2": 
      name: punctuation.definition.keyword.bibtex
    "3": 
      name: punctuation.section.entry.begin.bibtex
    "4": 
      name: entity.name.type.entry-key.bibtex
  end: \)
  patterns: 
  - name: meta.key-assignment.bibtex
    begin: ([a-zA-Z]+)\s*(\=)
    beginCaptures: 
      "1": 
        name: string.unquoted.key.bibtex
      "2": 
        name: punctuation.separator.key-value.bibtex
    end: (?=[,)])
    patterns: 
    - include: "#string_content"
    - include: "#integer"
- name: comment.block.bibtex
  begin: "[^@\\n]"
  end: (?=@)
foldingStopMarker: ^\s*[)}]\s*$
comment: "Grammar based on description from http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#comment\n\
  \t\n\
  \tTODO: Does not support @preamble\n\
  \t"
