codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: HCL3" Maintainer: Gregory Anders4" Upstream: https://github.com/hashivim/vim-terraform5" Last Change: 2024-09-036" License: ISC7"8" Copyright (c) 2014-2016 Mark Cornick <mark@markcornick.com>9"10" Permission to use, copy, modify, and/or distribute this software for any purpose11" with or without fee is hereby granted, provided that the above copyright notice12" and this permission notice appear in all copies.13"14" THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH15" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND16" FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,17" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS18" OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER19" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF20" THIS SOFTWARE.21 22if exists('b:current_syntax')23 finish24endif25 26syn iskeyword a-z,A-Z,48-57,_,-27 28syn case match29 30" A block is introduced by a type, some number of labels - which are either31" strings or identifiers - and an opening curly brace. Match the type.32syn match hclBlockType /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/33 34" An attribute name is an identifier followed by an equals sign.35syn match hclAttributeAssignment /\(\K\k*\.\)*\K\k*\s\+=\s/ contains=hclAttributeName36syn match hclAttributeName /\<\K\k*\>/ contained37 38syn keyword hclValueBool true false39 40syn keyword hclTodo contained TODO FIXME XXX BUG41syn region hclComment start="/\*" end="\*/" contains=hclTodo,@Spell42syn region hclComment start="#" end="$" contains=hclTodo,@Spell43syn region hclComment start="//" end="$" contains=hclTodo,@Spell44 45""" misc.46syn match hclValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>"47syn match hclValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>"48syn match hclBraces "[\[\]]"49 50""" skip \" and \\ in strings.51syn region hclValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=hclStringInterp52syn region hclStringInterp matchgroup=hclBraces start=/\(^\|[^$]\)\$\zs{/ end=/}/ contained contains=ALLBUT,hclAttributeName53syn region hclHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=hclStringInterp54 55"" Functions.56syn match hclFunction "[a-z0-9]\+(\@="57 58""" HCL259syn keyword hclRepeat for in60syn keyword hclConditional if61syn keyword hclValueNull null62 63" enable block folding64syn region hclBlockBody matchgroup=hclBraces start="{" end="}" fold transparent65 66hi def link hclComment Comment67hi def link hclTodo Todo68hi def link hclBraces Delimiter69hi def link hclAttributeName Identifier70hi def link hclBlockType Type71hi def link hclValueBool Boolean72hi def link hclValueDec Number73hi def link hclValueHexaDec Number74hi def link hclValueString String75hi def link hclHereDocText String76hi def link hclFunction Function77hi def link hclRepeat Repeat78hi def link hclConditional Conditional79hi def link hclValueNull Constant80 81let b:current_syntax = 'hcl'82 