name: HCL
scopeName: source.hcl
fileTypes: [hcl, hcldec]
uuid: 55e8075d-e2e3-4e44-8446-744a9860e476

patterns:

- comment: Comments
  name: comment.line.hcl
  begin: '#|//'
  end: $\n?
  captures:
    '0': {name: punctuation.definition.comment.hcl}

- comment: Block comments
  name: comment.block.hcl
  begin: /\*
  end: \*/
  captures:
    '0': {name: punctuation.definition.comment.hcl}

- comment: Nested Blocks
  name: meta.block.hcl
  begin: "{"
  beginCaptures:
    '0': {name: punctuation.definition.block.hcl}
  end: "}"
  endCaptures:
    '0': {name: punctuation.definition.block.hcl}
  patterns:
    - include: "$self"

- comment: Quoted Block Labels
  match: '(")([^"]+)(")'
  captures:
    '1': {name: string.hcl punctuation.definition.string.begin.hcl}
    '2': {name: string.value.hcl}
    '3': {name: string.hcl punctuation.definition.string.end.hcl}

- comment: Attribute Definitions
  name: meta.attr.hcl
  begin: '(\w+)\s*(=)\s*'
  beginCaptures:
    '1': {name: variable.other.assignment.hcl}
    '2': {name: keyword.operator.hcl}  
  end: '$'
  patterns:
    - include: "source.hclexpr"

- comment: Keywords
  match: '[-\w]+'
  captures:
    '0': {name: keyword.other.hcl}