hcl/extras/grammar/HCLTemplate.yaml-tmLanguage

59 lines
1.4 KiB
Plaintext
Raw Normal View History

name: HCL Template
scopeName: source.hcltemplate
fileTypes: [tmpl]
uuid: ac6be18e-d44f-4a73-bd8f-b973fd26df05
patterns:
- comment: Interpolation Sequences
name: meta.interp.hcltemplate
begin: '[^\$]?(\$\{~?)'
beginCaptures:
'1': {name: entity.tag.embedded.start.hcltemplate}
end: '~?}'
endCaptures:
'0': {name: entity.tag.embedded.end.hcltemplate}
patterns:
- include: "source.hclexpr"
- comment: Control Sequences
name: meta.control.hcltemplate
begin: '[^\%]?(\%\{~?)'
beginCaptures:
'1': {name: entity.tag.embedded.start.hcltemplate}
end: '~?}'
endCaptures:
'0': {name: entity.tag.embedded.end.hcltemplate}
patterns:
- include: "#templateif"
- include: "#templatefor"
- include: "#templatesimplekw"
repository:
templateif:
name: meta.templateif.hcltemplate
begin: '(if)\s*'
beginCaptures:
'1': {name: keyword.control.hcltemplate}
end: '(?=~?\})'
patterns:
- include: "source.hclexpr"
templatefor:
name: meta.templatefor.hcltemplate
begin: '(for)\s*(\w+)\s*(,\s*(\w+)\s*)?(in)'
beginCaptures:
'1': {name: keyword.control.hcltemplate}
'2': {name: variable.other.hcl}
'4': {name: variable.other.hcl}
'5': {name: keyword.control.hcltemplate}
end: '(?=~?\})'
patterns:
- include: "source.hclexpr"
templatesimplekw:
match: (else|endif|endfor)
captures:
'0': {name: keyword.control.hcl}