mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Change provider for puppet, closes #424
This commit is contained in:
@@ -137,7 +137,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, ftplugin)
|
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, ftplugin)
|
||||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
||||||
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
|
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
|
||||||
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
|
- [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, autoload, ftplugin)
|
||||||
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
||||||
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
||||||
- [python-indent](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
- [python-indent](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
||||||
|
|||||||
@@ -6,15 +6,6 @@ if !exists('g:puppet_align_hashes')
|
|||||||
let g:puppet_align_hashes = 1
|
let g:puppet_align_hashes = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:puppet_align_hashes && exists(':Tabularize')
|
if g:puppet_align_hashes
|
||||||
inoremap <buffer> <silent> > ><Esc>:call <SID>puppetalign()<CR>a
|
inoremap <buffer> <silent> => =><Esc>:call puppet#align#AlignHashrockets()<CR>$a
|
||||||
function! s:puppetalign()
|
|
||||||
let p = '^\s*\w+\s*[=+]>.*$'
|
|
||||||
let column = strlen(substitute(getline('.')[0:col('.')],'\([^=]\|=[^>]\)','','g'))
|
|
||||||
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=>\s*\zs.*'))
|
|
||||||
Tabularize /=>/l1
|
|
||||||
normal! 0
|
|
||||||
echo repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position)
|
|
||||||
call search(repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
|
||||||
endfunction
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
72
autoload/puppet/align.vim
Normal file
72
autoload/puppet/align.vim
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! puppet#align#IndentLevel(lnum)
|
||||||
|
return indent(a:lnum) / &shiftwidth
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! puppet#align#LinesInBlock(lnum)
|
||||||
|
let lines = []
|
||||||
|
let indent_level = puppet#align#IndentLevel(a:lnum)
|
||||||
|
|
||||||
|
let marker = a:lnum - 1
|
||||||
|
while marker >= 1
|
||||||
|
let line_text = getline(marker)
|
||||||
|
let line_indent = puppet#align#IndentLevel(marker)
|
||||||
|
|
||||||
|
if line_text =~? '\v\S'
|
||||||
|
if line_indent < indent_level
|
||||||
|
break
|
||||||
|
elseif line_indent == indent_level
|
||||||
|
call add(lines, marker)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let marker -= 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
let marker = a:lnum
|
||||||
|
while marker <= line('$')
|
||||||
|
let line_text = getline(marker)
|
||||||
|
let line_indent = puppet#align#IndentLevel(marker)
|
||||||
|
|
||||||
|
if line_text =~? '\v\S'
|
||||||
|
if line_indent < indent_level
|
||||||
|
break
|
||||||
|
elseif line_indent == indent_level
|
||||||
|
call add(lines, marker)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let marker += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return lines
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Format lines with hashrocket (=>)
|
||||||
|
" @param a:1 a line where function should search for first hashrocket
|
||||||
|
" expression, if param is not given, line with active cursor is used
|
||||||
|
function! puppet#align#AlignHashrockets(...) abort
|
||||||
|
let l:lnum = get(a:, 1, line('.'))
|
||||||
|
let lines_in_block = puppet#align#LinesInBlock(l:lnum)
|
||||||
|
let max_left_len = 0
|
||||||
|
let indent_str = printf('%' . indent(l:lnum) . 's', '')
|
||||||
|
|
||||||
|
for line_num in lines_in_block
|
||||||
|
let data = matchlist(getline(line_num), '^\s*\(.\{-}\S\)\s*=>\s*\(.*\)$')
|
||||||
|
if !empty(data)
|
||||||
|
let max_left_len = max([max_left_len, strlen(data[1])])
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
for line_num in lines_in_block
|
||||||
|
let data = matchlist(getline(line_num), '^\s*\(.\{-}\S\)\s*=>\s*\(.*\)$')
|
||||||
|
if !empty(data)
|
||||||
|
let new_line = printf('%s%-' . max_left_len . 's => %s', indent_str, data[1], data[2])
|
||||||
|
call setline(line_num, new_line)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
40
autoload/puppet/ctags.vim
Normal file
40
autoload/puppet/ctags.vim
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if !exists('s:ctags_type')
|
||||||
|
let s:ctags_type = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:ctags_options_dir = expand('<sfile>:p:h:h:h') . '/ctags/'
|
||||||
|
|
||||||
|
" Return full path to option file for ctags application
|
||||||
|
function! puppet#ctags#OptionFile()
|
||||||
|
|
||||||
|
if puppet#ctags#Type() == 'universal'
|
||||||
|
let l:ctags_options = 'puppet_u.ctags'
|
||||||
|
else
|
||||||
|
let l:ctags_options = 'puppet.ctags'
|
||||||
|
endif
|
||||||
|
return s:ctags_options_dir . l:ctags_options
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Return type of installed ctags application,
|
||||||
|
" can be 'universal' or 'exuberant'
|
||||||
|
function! puppet#ctags#Type()
|
||||||
|
|
||||||
|
if !s:ctags_type
|
||||||
|
let l:version = system('ctags --version')
|
||||||
|
if l:version =~ 'Universal Ctags'
|
||||||
|
let s:ctags_type = 'universal'
|
||||||
|
elseif l:version =~ 'Exuberant Ctags'
|
||||||
|
let s:ctags_type = 'exuberant'
|
||||||
|
else
|
||||||
|
echoerr 'Unknown version of Ctags'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:ctags_type
|
||||||
|
endfunction
|
||||||
|
|
||||||
61
autoload/puppet/format.vim
Normal file
61
autoload/puppet/format.vim
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
"
|
||||||
|
" Simple format using puppet's l:indents and align hashrockets function
|
||||||
|
function! puppet#format#Format() abort
|
||||||
|
let l:start_lnum = v:lnum
|
||||||
|
let l:end_lnum = v:lnum + v:count - 1
|
||||||
|
call puppet#format#Indention(l:start_lnum, l:end_lnum)
|
||||||
|
call puppet#format#Hashrocket(l:start_lnum, l:end_lnum)
|
||||||
|
call puppet#format#Fallback(l:start_lnum, l:end_lnum)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Format hashrockets expressions in every line in range start_lnum and
|
||||||
|
" end_lnum, both ends included
|
||||||
|
"
|
||||||
|
" TODO way of using AlignHashrockets function is ineffective, because it
|
||||||
|
" formats same lines again and again, find better way to do it
|
||||||
|
function! puppet#format#Hashrocket(start_lnum, end_lnum) abort
|
||||||
|
let l:lnum = a:start_lnum
|
||||||
|
while l:lnum <= a:end_lnum
|
||||||
|
call puppet#align#AlignHashrockets(l:lnum)
|
||||||
|
let l:lnum += 1
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Format indention in every line in range start_lnum and end_lnum, both ends
|
||||||
|
" included
|
||||||
|
"
|
||||||
|
function! puppet#format#Indention(start_lnum, end_lnum) abort
|
||||||
|
execute 'normal! ' . a:start_lnum . 'gg=' . a:end_lnum . 'gg'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Use internal vim default autoformat method for every line in range, only
|
||||||
|
" lines which exeed &widthline are formated
|
||||||
|
"
|
||||||
|
function! puppet#format#Fallback(start_lnum, end_lnum) abort
|
||||||
|
" I'm using it to check if autoformat expand range
|
||||||
|
let l:eof_lnum = line('$')
|
||||||
|
let l:lnum = a:start_lnum
|
||||||
|
let l:end_lnum = a:end_lnum
|
||||||
|
while l:lnum <= l:end_lnum
|
||||||
|
if strlen(getline(l:lnum)) > &textwidth
|
||||||
|
call cursor(l:lnum)
|
||||||
|
execute 'normal! gww'
|
||||||
|
" Checking if autoformat expand number of lines if yes, I will extend
|
||||||
|
" range too
|
||||||
|
if l:eof_lnum < line('$')
|
||||||
|
let l:end_lnum += line('$') - l:eof_lnum
|
||||||
|
let l:eof_lnum = line('$')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let l:lnum += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
2
build
2
build
@@ -247,7 +247,7 @@ PACKS="
|
|||||||
powershell:PProvost/vim-ps1
|
powershell:PProvost/vim-ps1
|
||||||
protobuf:uarun/vim-protobuf
|
protobuf:uarun/vim-protobuf
|
||||||
pug:digitaltoad/vim-pug
|
pug:digitaltoad/vim-pug
|
||||||
puppet:voxpupuli/vim-puppet
|
puppet:rodjek/vim-puppet
|
||||||
purescript:purescript-contrib/purescript-vim
|
purescript:purescript-contrib/purescript-vim
|
||||||
python-compiler:aliev/vim-compiler-python
|
python-compiler:aliev/vim-compiler-python
|
||||||
python-indent:Vimjas/vim-python-pep8-indent
|
python-indent:Vimjas/vim-python-pep8-indent
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ endif
|
|||||||
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" puppet, from puppet.vim in voxpupuli/vim-puppet
|
" puppet, from puppet.vim in rodjek/vim-puppet
|
||||||
au! BufRead,BufNewFile *.pp setfiletype puppet
|
au! BufRead,BufNewFile *.pp setfiletype puppet
|
||||||
au! BufRead,BufNewFile Puppetfile setfiletype ruby
|
au! BufRead,BufNewFile Puppetfile setfiletype ruby
|
||||||
augroup end
|
augroup end
|
||||||
|
|||||||
48
ftplugin/puppet_tagbar.vim
Normal file
48
ftplugin/puppet_tagbar.vim
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Puppet set up for Tagbar plugin
|
||||||
|
" (https://github.com/majutsushi/tagbar).
|
||||||
|
|
||||||
|
if !exists(':Tagbar')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:tagbar_type_puppet = {
|
||||||
|
\ 'ctagstype': 'puppet',
|
||||||
|
\ 'kinds': [
|
||||||
|
\ 'c:Classes',
|
||||||
|
\ 's:Sites',
|
||||||
|
\ 'n:Nodes',
|
||||||
|
\ 'v:Variables',
|
||||||
|
\ 'i:Includes',
|
||||||
|
\ 'd:Definitions',
|
||||||
|
\ 'r:Resources',
|
||||||
|
\ 'f:Defaults',
|
||||||
|
\ 't:Types',
|
||||||
|
\ 'u:Functions',
|
||||||
|
\],
|
||||||
|
\}
|
||||||
|
|
||||||
|
if puppet#ctags#Type() == 'universal'
|
||||||
|
" There no sense to split objects by colon
|
||||||
|
let g:tagbar_type_puppet.sro = '__'
|
||||||
|
let g:tagbar_type_puppet.kind2scope = {
|
||||||
|
\ 'd': 'definition',
|
||||||
|
\ 'c': 'class',
|
||||||
|
\ 'r': 'resource',
|
||||||
|
\ 'i': 'include',
|
||||||
|
\ 'v': 'variable',
|
||||||
|
\}
|
||||||
|
let g:tagbar_type_puppet.scope2kind = {
|
||||||
|
\ 'definition' : 'd',
|
||||||
|
\ 'class' : 'c',
|
||||||
|
\ 'resource' : 'r',
|
||||||
|
\ 'include' : 'i',
|
||||||
|
\ 'variable' : 'v',
|
||||||
|
\}
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:tagbar_type_puppet.deffile = puppet#ctags#OptionFile()
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@ let b:did_indent = 1
|
|||||||
setlocal autoindent smartindent
|
setlocal autoindent smartindent
|
||||||
setlocal indentexpr=GetPuppetIndent()
|
setlocal indentexpr=GetPuppetIndent()
|
||||||
setlocal indentkeys+=0],0)
|
setlocal indentkeys+=0],0)
|
||||||
|
setlocal formatexpr=puppet#format#Format()
|
||||||
|
|
||||||
if exists("*GetPuppetIndent")
|
if exists("*GetPuppetIndent")
|
||||||
finish
|
finish
|
||||||
@@ -33,7 +34,7 @@ function! s:PartOfInclude(lnum)
|
|||||||
if line !~ ',$'
|
if line !~ ',$'
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
if line =~ '^\s*include\s\+[^,]\+,$'
|
if line =~ '^\s*include\s\+[^,]\+,$' && line !~ '[=>]>'
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
@@ -42,24 +43,70 @@ endfunction
|
|||||||
|
|
||||||
function! s:OpenBrace(lnum)
|
function! s:OpenBrace(lnum)
|
||||||
call cursor(a:lnum, 1)
|
call cursor(a:lnum, 1)
|
||||||
return searchpair('{\|\[\|(', '', '}\|\]\|)', 'nbW')
|
return searchpair('{\|\[\|(', '', '}\|\]\|)', 'nbW',
|
||||||
|
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "comment\\|string"')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetPuppetIndent()
|
function! s:InsideMultilineString(lnum)
|
||||||
let pnum = prevnonblank(v:lnum - 1)
|
return synIDattr(synID(a:lnum, 1, 0), 'name') =~? 'string'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:PrevNonMultilineString(lnum)
|
||||||
|
let l:lnum = a:lnum
|
||||||
|
while l:lnum > 0 && s:InsideMultilineString(lnum)
|
||||||
|
let l:lnum = l:lnum - 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return l:lnum
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Get indent number for line, line can be given as params, otherwise function
|
||||||
|
" use line where cursor is
|
||||||
|
" @param a:1 (optional) line number in current buffer
|
||||||
|
" @return integer
|
||||||
|
function! GetPuppetIndent(...)
|
||||||
|
let l:lnum = get(a:, 1, v:lnum)
|
||||||
|
|
||||||
|
let pnum = prevnonblank(l:lnum - 1)
|
||||||
if pnum == 0
|
if pnum == 0
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = getline(v:lnum)
|
let line = getline(l:lnum)
|
||||||
let pline = getline(pnum)
|
let pline = getline(pnum)
|
||||||
let ind = indent(pnum)
|
let ind = indent(pnum)
|
||||||
|
|
||||||
|
" Avoid cases of closing braces or parens on the current line: returning
|
||||||
|
" the same indent here would be premature since for that particular case
|
||||||
|
" we want to instead get the indent level of the matching opening brace or
|
||||||
|
" parenthenses.
|
||||||
|
if pline =~ '^\s*#' && line !~ '^\s*\(}\(,\|;\)\?$\|]:\|],\|}]\|];\?$\|)\)'
|
||||||
|
return ind
|
||||||
|
endif
|
||||||
|
|
||||||
|
" We are inside a multi-line string: if we interfere with indentation here
|
||||||
|
" we're actually changing the contents of of the string!
|
||||||
|
if s:InsideMultilineString(l:lnum)
|
||||||
|
return indent(l:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Previous line was inside a multi-line string: we've lost the indent
|
||||||
|
" level. We need to find this value from the last line that was not inside
|
||||||
|
" of a multi-line string to restore proper alignment.
|
||||||
|
if s:InsideMultilineString(pnum)
|
||||||
|
if pnum - 1 == 0
|
||||||
|
return ind
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ind = indent(s:PrevNonMultilineString(pnum - 1))
|
||||||
|
endif
|
||||||
|
|
||||||
if pline =~ '\({\|\[\|(\|:\)\s*\(#.*\)\?$'
|
if pline =~ '\({\|\[\|(\|:\)\s*\(#.*\)\?$'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*'
|
elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*'
|
||||||
let ind -= &sw
|
let ind -= &sw
|
||||||
elseif pline =~ '^\s*include\s\+.*,$'
|
elseif pline =~ '^\s*include\s\+.*,$' && pline !~ '[=+]>'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -76,7 +123,6 @@ function! GetPuppetIndent()
|
|||||||
if line =~ '^\s*}\s*els\(e\|if\).*{\s*$'
|
if line =~ '^\s*}\s*els\(e\|if\).*{\s*$'
|
||||||
let ind -= &sw
|
let ind -= &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Don't indent resources that are one after another with a ->(ordering arrow)
|
" Don't indent resources that are one after another with a ->(ordering arrow)
|
||||||
" file {'somefile':
|
" file {'somefile':
|
||||||
" ...
|
" ...
|
||||||
|
|||||||
@@ -2,439 +2,173 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Language: Puppet
|
" puppet syntax file
|
||||||
" Maintainer: Voxpupuli
|
" Filename: puppet.vim
|
||||||
" URL: https://github.com/voxpupuli/vim-puppet
|
" Language: puppet configuration file
|
||||||
|
" Maintainer: Luke Kanies <luke@madstop.com>
|
||||||
|
" URL:
|
||||||
|
" Last Change:
|
||||||
|
" Version:
|
||||||
"
|
"
|
||||||
" Thanks to Doug Kearns who maintains the vim syntax file for Ruby. Many constructs, including interpolation
|
|
||||||
" and heredoc was copied from ruby and then modified to comply with Puppet syntax.
|
|
||||||
|
|
||||||
" Prelude {{{1
|
" Copied from the cfengine, ruby, and perl syntax files
|
||||||
if exists("b:current_syntax")
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" this file uses line continuations
|
" match class/definition/node declarations
|
||||||
let s:cpo_sav = &cpo
|
syn region puppetDefine start="^\s*\(class\|define\|node\)\s" end="{" contains=puppetDefType,puppetDefName,puppetDefArguments,puppetNodeRe,@NoSpell
|
||||||
set cpo&vim
|
syn keyword puppetDefType class define node inherits contained
|
||||||
|
syn region puppetDefArguments start="(" end=")" contained contains=puppetType,puppetArgument,puppetString,puppetComment,puppetMultilineComment
|
||||||
|
syn match puppetArgument "\w\+" contained
|
||||||
|
syn match puppetArgument "\$\w\+" contained
|
||||||
|
syn match puppetArgument "'[^']+'" contained
|
||||||
|
syn match puppetArgument '"[^"]+"' contained
|
||||||
|
syn keyword puppetType Any Array Boolean Callable Catalogentry Collection Data Default Enum Float Hash Integer Numeric Optional Pattern Regexp Scalar Sensitive String Struct Tuple Type Undef Variant
|
||||||
|
syn match puppetDefName "\w\+" contained
|
||||||
|
syn match puppetNodeRe "/.*/" contained
|
||||||
|
|
||||||
syn cluster puppetNotTop contains=@puppetExtendedStringSpecial,@puppetRegexpSpecial,@puppetDeclaration,puppetConditional,puppetExceptional,puppetMethodExceptional,puppetTodo
|
" match 'foo' in 'class foo { ...'
|
||||||
|
" match 'foo::bar' in 'class foo::bar { ...'
|
||||||
|
" match 'Foo::Bar' in 'Foo::Bar["..."]
|
||||||
|
"FIXME: "Foo-bar" doesn't get highlighted as expected, although "foo-bar" does.
|
||||||
|
syn match puppetInstance "[A-Za-z0-9_-]\+\(::[A-Za-z0-9_-]\+\)*\s*{" contains=puppetTypeName,puppetTypeDefault,@NoSpell
|
||||||
|
syn match puppetInstance "[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*[[{]" contains=puppetTypeName,puppetTypeDefault,@NoSpell
|
||||||
|
syn match puppetInstance "[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*<\?<|" contains=puppetTypeName,puppetTypeDefault,@NoSpell
|
||||||
|
syn match puppetTypeName "[a-z]\w*" contained
|
||||||
|
syn match puppetTypeDefault "[A-Z]\w*" contained
|
||||||
|
|
||||||
syn match puppetSpaceError display excludenl "\s\+$"
|
syn match puppetParam "\(\w\+\|\*\)\s*\(=\|+\)>" contains=puppetTypeRArrow,puppetParamName
|
||||||
syn match puppetSpaceError display " \+\t"me=e-1
|
syn match puppetParamRArrow "\(=\|+\)>" contained
|
||||||
|
syn match puppetParamName "\(\w\+\|\*\)" contained contains=@NoSpell
|
||||||
|
syn match puppetVariable "$\(\(\(::\)\?\w\+\)\+\|{\(\(::\)\?\w\+\)\+}\)"
|
||||||
|
syn match puppetParen "("
|
||||||
|
syn match puppetParen ")"
|
||||||
|
syn match puppetBrace "{"
|
||||||
|
syn match puppetBrace "}"
|
||||||
|
syn match puppetBrack "\["
|
||||||
|
syn match puppetBrack "\]"
|
||||||
|
syn match puppetBrack "<|"
|
||||||
|
syn match puppetBrack "|>"
|
||||||
|
|
||||||
" one character operators
|
" match 'present' in 'ensure => present'
|
||||||
syn match puppetOperator "[=><+/*%!.|@:,;?~-]"
|
" match '2755' in 'mode => 2755'
|
||||||
|
" don't match 'bar' in 'foo => bar'
|
||||||
|
syn match puppetParam "\w\+\s*[=+]>\s*[a-z0-9]\+" contains=puppetParamString,puppetParamName
|
||||||
|
syn match puppetParamString "[=+]>\s*\w\+" contains=puppetParamKeyword,puppetParamSpecial,puppetParamDigits contained
|
||||||
|
syn keyword puppetParamKeyword present absent purged latest installed running stopped mounted unmounted role configured file directory link on_failure contained
|
||||||
|
syn keyword puppetParamSpecial true false undef contained
|
||||||
|
syn match puppetParamDigits "[0-9]\+"
|
||||||
|
|
||||||
" two character operators
|
" match 'template' in 'content => template("...")'
|
||||||
syn match puppetOperator "+=\|-=\|==\|!=\|=\~\|!\~\|>=\|<=\|<-\|<\~\|=>\|+>\|->\|\~>\|<<\||>\|@@"
|
syn match puppetParam "\w\+\s*[=+]>\s*\w\+\s*(" contains=puppetFunction,puppetParamName
|
||||||
|
" statements
|
||||||
|
syn region puppetFunction start="^\s*\(alert\|crit\|debug\|emerg\|err\|fail\|include\|info\|notice\|realize\|require\|search\|tag\|warning\)\s*(" end=")" contained contains=puppetString
|
||||||
|
" rvalues
|
||||||
|
syn region puppetFunction start="^\s*\(defined\|file\|fqdn_rand\|generate\|inline_template\|regsubst\|sha1\|shellquote\|split\|sprintf\|tagged\|template\|versioncmp\)\s*(" end=")" contained contains=puppetString
|
||||||
|
|
||||||
" three character operators
|
syn match puppetVariable "$[a-zA-Z0-9_:]\+" contains=@NoSpell
|
||||||
syn match puppetOperator "<<|\||>>"
|
syn match puppetVariable "${[a-zA-Z0-9_:'\[\]]\+}" contains=@NoSpell
|
||||||
|
|
||||||
syn region puppetBracketOperator matchgroup=puppetDelimiter start="\[\s*" end="\s*]" contains=ALLBUT,@puppetNotTop
|
" match anything between simple/double quotes.
|
||||||
syn region puppetBraceOperator matchgroup=puppetDelimiter start="{\s*" end="\s*}" contains=ALLBUT,@puppetNotTop
|
" don't match variables if preceded by a backslash.
|
||||||
syn region puppetParenOperator matchgroup=puppetDelimiter start="(\s*" end="\s*)" contains=ALLBUT,@puppetNotTop
|
syn region puppetString start=+'+ skip=+\\\\\|\\'+ end=+'+
|
||||||
|
syn region puppetString start=+@(\z\([^/)]*\)\(/[\\nts$uL]*\)\?)$+ end=+|-\? *\z1 *$+
|
||||||
|
syn region puppetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=puppetVariable,puppetNotVariable
|
||||||
|
syn region puppetString start=+@("\z\([^/)]*\)"\(/[\\nts$uL]*\)\?)$+ end=+|-\? *\z1 *$+ contains=puppetVariable,puppetNotVariable
|
||||||
|
syn match puppetNotVariable "\\$\w\+" contained
|
||||||
|
syn match puppetNotVariable "\\${\w\+}" contained
|
||||||
|
|
||||||
" Expression Substitution and Backslash Notation {{{1
|
" match keywords and control words except when used as a parameter
|
||||||
syn match puppetStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
syn match puppetKeyword "\(\<import\>\|\<inherits\>\|\<include\>\|\<require\>\|\<contain\>\)\(\s*=>\)\@!"
|
||||||
syn match puppetStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
syn match puppetControl "\(\<case\>\|\<default\>\|\<unless\>\|\<if\>\|\<else\>\|\<elsif\>\)\(\s*=>\)\@!"
|
||||||
syn match puppetQuoteEscape "\\[\\']" contained display
|
syn keyword puppetSpecial true false undef
|
||||||
|
|
||||||
syn region puppetInterpolation matchgroup=puppetInterpolationDelimiter start="${" end="}" contained contains=ALLBUT,@puppetNotTop
|
syn match puppetClass "[A-Za-z0-9_-]\+\(::[A-Za-z0-9_-]\+\)\+" contains=@NoSpell
|
||||||
syn match puppetInterpolation "$\w\+" display contained contains=puppetInterpolationDelimiter,puppetVariable
|
|
||||||
syn match puppetInterpolationDelimiter "$\ze\$\w\+" display contained
|
|
||||||
syn match puppetInterpolation "$\$\%(-\w\|\W\)" display contained contains=puppetInterpolationDelimiter,puppetVariable,puppetInvalidVariable
|
|
||||||
syn match puppetInterpolationDelimiter "$\ze\$\%(-\w\|\W\)" display contained
|
|
||||||
syn region puppetNoInterpolation start="\\${" end="}" contained
|
|
||||||
syn match puppetNoInterpolation "\\${" display contained
|
|
||||||
syn match puppetNoInterpolation "\\$\w\+" display contained
|
|
||||||
|
|
||||||
syn match puppetDelimiterEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE
|
" Match the Regular Expression type
|
||||||
|
" XXX: Puppet does not currently support a few features available in the
|
||||||
syn region puppetNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=puppetString end=")" transparent contained
|
" full Ruby Regexp class, namely, interpolation, lookbehind and named
|
||||||
syn region puppetNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=puppetString end="}" transparent contained
|
" sub-expressions. Matches for these features are included in the
|
||||||
syn region puppetNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=puppetString end=">" transparent contained
|
" commented-out versions of puppetRegexParen and puppetRegexSubName,
|
||||||
syn region puppetNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=puppetString end="\]" transparent contained
|
" plus the supporting groups puppetRegexAngBrack and puppetRegexTick.
|
||||||
|
syn region puppetRegex start="\(?<!/.*\)/" skip="\\/" end="/" contains=puppetRegexParen,puppetRegexBrace,puppetRegexOrpuppetRegexBrack,puppetRegexComment
|
||||||
" Regular Expression Metacharacters {{{1
|
syn match puppetRegexParen "(\(?\([imx]\{0,4}:\|[=!]\)\)\?" contains=puppetRegexSpecChar,puppetRegexSubName contained
|
||||||
" These are mostly Oniguruma ready
|
"syn match puppetRegexParen "(\(?\([imxo]\{0,4}:\|['<][[:alnum:]]\+[>']\|<?[=!]\)\)\?" contains=puppetRegexSpecChar,puppetRegexSubName contained
|
||||||
syn region puppetRegexpComment matchgroup=puppetRegexpSpecial start="(?#" skip="\\)" end=")" contained
|
syn match puppetRegexParen ")" contained
|
||||||
syn region puppetRegexpParens matchgroup=puppetRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@puppetRegexpSpecial
|
syn match puppetRegexBrace "{" contained
|
||||||
syn region puppetRegexpBrackets matchgroup=puppetRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=puppetStringEscape,puppetRegexpEscape,puppetRegexpCharClass oneline
|
syn match puppetRegexBrace "}" contained
|
||||||
syn match puppetRegexpCharClass "\\[DdHhSsWw]" contained display
|
syn match puppetRegexBrack "\[" contained
|
||||||
syn match puppetRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained
|
syn match puppetRegexBrack "\]" contained
|
||||||
syn match puppetRegexpEscape "\\[].*?+^$|\\/(){}[]" contained
|
"syn match puppetRegexAngBrack "<" contained
|
||||||
syn match puppetRegexpQuantifier "[*?+][?+]\=" contained display
|
"syn match puppetRegexAngBrack ">" contained
|
||||||
syn match puppetRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display
|
"syn match puppetRegexTick +'+ contained
|
||||||
syn match puppetRegexpAnchor "[$^]\|\\[ABbGZz]" contained display
|
syn match puppetRegexOr "|" contained
|
||||||
syn match puppetRegexpDot "\." contained display
|
"syn match puppetRegexSubName "['<][[:alnum:]]\+[>']" contains=puppetRegexAngBrack,puppetRegexTick contained
|
||||||
syn match puppetRegexpSpecial "|" contained display
|
syn match puppetRegexSpecialChar "[?:imx]\|\(<?[=!]\)" contained
|
||||||
syn match puppetRegexpSpecial "\\[1-9]\d\=\d\@!" contained display
|
syn region puppetRegexComment start="(?#" skip="\\)" end=")" contained
|
||||||
syn match puppetRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display
|
|
||||||
syn match puppetRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display
|
|
||||||
syn match puppetRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display
|
|
||||||
syn match puppetRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display
|
|
||||||
|
|
||||||
syn cluster puppetStringSpecial contains=puppetInterpolation,puppetNoInterpolation,puppetStringEscape
|
|
||||||
syn cluster puppetExtendedStringSpecial contains=@puppetStringSpecial,puppetNestedParentheses,puppetNestedCurlyBraces,puppetNestedAngleBrackets,puppetNestedSquareBrackets
|
|
||||||
syn cluster puppetRegexpSpecial contains=puppetRegexpSpecial,puppetRegexpEscape,puppetRegexpBrackets,puppetRegexpCharClass,puppetRegexpDot,puppetRegexpQuantifier,puppetRegexpAnchor,puppetRegexpParens,puppetRegexpComment
|
|
||||||
|
|
||||||
syn match puppetInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display
|
|
||||||
syn match puppetInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display
|
|
||||||
syn match puppetInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display
|
|
||||||
syn match puppetInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*r\=i\=\>" display
|
|
||||||
syn match puppetFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display
|
|
||||||
syn match puppetFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>" display
|
|
||||||
|
|
||||||
syn match puppetVariable "$\%(::\)\=\w\+\%(::\w\+\)*" display
|
|
||||||
syn match puppetName "\%(::\)\=[a-z]\w*\%(::[a-z]\w*\)*" display
|
|
||||||
syn match puppetType "\%(::\)\=[A-Z]\w*\%(::[A-Z]\w*\)*" display
|
|
||||||
syn match puppetWord "\%(\%(::\)\=\%(_[\w-]*\w\+\)\|\%([a-z]\%(\w*-\)\+\w\+\)\)\+" display
|
|
||||||
|
|
||||||
" bad name containing combinations of segment starting with lower case and segement starting with upper case (or vice versa)
|
|
||||||
syn match puppetNameBad "\%(::\)\=\%(\w\+::\)*\%(\%([a-z]\w*::[A-Z]\w*\)\|\%([A-Z]\w*::[a-z]\w*\)\)\%(::\w\+\)*" display
|
|
||||||
syn cluster puppetNameOrType contains=puppetVariable,puppetName,puppetType,puppetWord,puppetNameBad
|
|
||||||
|
|
||||||
syn keyword puppetControl case and or in
|
|
||||||
syn keyword puppetKeyword class define inherits node undef function type attr private
|
|
||||||
syn keyword puppetKeyword application consumes produces site
|
|
||||||
syn keyword puppetKeyword present absent purged latest installed running stopped mounted unmounted role configured file directory link on_failure contained
|
|
||||||
syn keyword puppetConstant default undef
|
|
||||||
syn keyword puppetConditional if else elsif unless
|
|
||||||
syn keyword puppetBoolean true false
|
|
||||||
|
|
||||||
" Core functions
|
|
||||||
syn match puppetFunction "\<alert\>"
|
|
||||||
syn match puppetFunction "\<assert_type\>"
|
|
||||||
syn match puppetFunction "\<binary_file\>"
|
|
||||||
syn match puppetFunction "\<break\>"
|
|
||||||
syn match puppetFunction "\<contain\>"
|
|
||||||
syn match puppetFunction "\<crit\>"
|
|
||||||
syn match puppetFunction "\<create_resources\>"
|
|
||||||
syn match puppetFunction "\<debug\>"
|
|
||||||
syn match puppetFunction "\<defined\>"
|
|
||||||
syn match puppetFunction "\<dig\>"
|
|
||||||
syn match puppetFunction "\<each\>"
|
|
||||||
syn match puppetFunction "\<emerg\>"
|
|
||||||
syn match puppetFunction "\<epp\>"
|
|
||||||
syn match puppetFunction "\<err\>"
|
|
||||||
syn match puppetFunction "\<fail\>"
|
|
||||||
syn match puppetFunction "\<file\>"
|
|
||||||
syn match puppetFunction "\<filter\>"
|
|
||||||
syn match puppetFunction "\<find_file\>"
|
|
||||||
syn match puppetFunction "\<fqdn_rand\>"
|
|
||||||
syn match puppetFunction "\<hiera\>"
|
|
||||||
syn match puppetFunction "\<hiera_array\>"
|
|
||||||
syn match puppetFunction "\<hiera_hash\>"
|
|
||||||
syn match puppetFunction "\<hiera_include\>"
|
|
||||||
syn match puppetFunction "\<import\>"
|
|
||||||
syn match puppetFunction "\<include\>"
|
|
||||||
syn match puppetFunction "\<info\>"
|
|
||||||
syn match puppetFunction "\<inline_epp\>"
|
|
||||||
syn match puppetFunction "\<lest\>"
|
|
||||||
syn match puppetFunction "\<lookup\>"
|
|
||||||
syn match puppetFunction "\<map\>"
|
|
||||||
syn match puppetFunction "\<match\>"
|
|
||||||
syn match puppetFunction "\<new\>"
|
|
||||||
syn match puppetFunction "\<next\>"
|
|
||||||
syn match puppetFunction "\<notice\>"
|
|
||||||
syn match puppetFunction "\<realize\>"
|
|
||||||
syn match puppetFunction "\<reduce\>"
|
|
||||||
syn match puppetFunction "\<regsubst\>"
|
|
||||||
syn match puppetFunction "\<require\>"
|
|
||||||
syn match puppetFunction "\<return\>"
|
|
||||||
syn match puppetFunction "\<reverse_each\>"
|
|
||||||
syn match puppetFunction "\<scanf\>"
|
|
||||||
syn match puppetFunction "\<sha1\>"
|
|
||||||
syn match puppetFunction "\<shellquote\>"
|
|
||||||
syn match puppetFunction "\<slice\>"
|
|
||||||
syn match puppetFunction "\<split\>"
|
|
||||||
syn match puppetFunction "\<sprintf\>"
|
|
||||||
syn match puppetFunction "\<step\>"
|
|
||||||
syn match puppetFunction "\<strftime\>"
|
|
||||||
syn match puppetFunction "\<tag\>"
|
|
||||||
syn match puppetFunction "\<tagged\>"
|
|
||||||
syn match puppetFunction "\<template\>"
|
|
||||||
syn match puppetFunction "\<then\>"
|
|
||||||
syn match puppetFunction "\<type\>"
|
|
||||||
syn match puppetFunction "\<unwrap\>"
|
|
||||||
syn match puppetFunction "\<versioncmp\>"
|
|
||||||
syn match puppetFunction "\<warning\>"
|
|
||||||
syn match puppetFunction "\<with\>"
|
|
||||||
|
|
||||||
" Stdlib functions
|
|
||||||
syn match puppetStdLibFunction "\<abs\>"
|
|
||||||
syn match puppetStdLibFunction "\<any2array\>"
|
|
||||||
syn match puppetStdLibFunction "\<any2bool\>"
|
|
||||||
syn match puppetStdLibFunction "\<assert_private\>"
|
|
||||||
syn match puppetStdLibFunction "\<base64\>"
|
|
||||||
syn match puppetStdLibFunction "\<basename\>"
|
|
||||||
syn match puppetStdLibFunction "\<bool2num\>"
|
|
||||||
syn match puppetStdLibFunction "\<bool2str\>"
|
|
||||||
syn match puppetStdLibFunction "\<camelcase\>"
|
|
||||||
syn match puppetStdLibFunction "\<capitalize\>"
|
|
||||||
syn match puppetStdLibFunction "\<ceiling\>"
|
|
||||||
syn match puppetStdLibFunction "\<chomp\>"
|
|
||||||
syn match puppetStdLibFunction "\<chop\>"
|
|
||||||
syn match puppetStdLibFunction "\<clamp\>"
|
|
||||||
syn match puppetStdLibFunction "\<concat\>"
|
|
||||||
syn match puppetStdLibFunction "\<convert_base\>"
|
|
||||||
syn match puppetStdLibFunction "\<count\>"
|
|
||||||
syn match puppetStdLibFunction "\<deep_merge\>"
|
|
||||||
syn match puppetStdLibFunction "\<defined_with_params\>"
|
|
||||||
syn match puppetStdLibFunction "\<delete\>"
|
|
||||||
syn match puppetStdLibFunction "\<delete_at\>"
|
|
||||||
syn match puppetStdLibFunction "\<delete_regex\>"
|
|
||||||
syn match puppetStdLibFunction "\<delete_undef_values\>"
|
|
||||||
syn match puppetStdLibFunction "\<delete_values\>"
|
|
||||||
syn match puppetStdLibFunction "\<deprecation\>"
|
|
||||||
syn match puppetStdLibFunction "\<difference\>"
|
|
||||||
syn match puppetStdLibFunction "\<dig\>"
|
|
||||||
syn match puppetStdLibFunction "\<dig44\>"
|
|
||||||
syn match puppetStdLibFunction "\<dirname\>"
|
|
||||||
syn match puppetStdLibFunction "\<dos2unix\>"
|
|
||||||
syn match puppetStdLibFunction "\<downcase\>"
|
|
||||||
syn match puppetStdLibFunction "\<empty\>"
|
|
||||||
syn match puppetStdLibFunction "\<enclose_ipv6\>"
|
|
||||||
syn match puppetStdLibFunction "\<ensure_packages\>"
|
|
||||||
syn match puppetStdLibFunction "\<ensure_resource\>"
|
|
||||||
syn match puppetStdLibFunction "\<ensure_resources\>"
|
|
||||||
syn match puppetStdLibFunction "\<flatten\>"
|
|
||||||
syn match puppetStdLibFunction "\<floor\>"
|
|
||||||
syn match puppetStdLibFunction "\<fqdn_rand_string\>"
|
|
||||||
syn match puppetStdLibFunction "\<fqdn_rotate\>"
|
|
||||||
syn match puppetStdLibFunction "\<get_module_path\>"
|
|
||||||
syn match puppetStdLibFunction "\<getparam\>"
|
|
||||||
syn match puppetStdLibFunction "\<getvar\>"
|
|
||||||
syn match puppetStdLibFunction "\<grep\>"
|
|
||||||
syn match puppetStdLibFunction "\<has_interface_with\>"
|
|
||||||
syn match puppetStdLibFunction "\<has_ip_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<has_ip_network\>"
|
|
||||||
syn match puppetStdLibFunction "\<has_key\>"
|
|
||||||
syn match puppetStdLibFunction "\<hash\>"
|
|
||||||
syn match puppetStdLibFunction "\<intersection\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_absolute_path\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_array\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_bool\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_domain_name\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_email_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_float\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_function_available\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_hash\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_integer\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_ip_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_ipv4_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_ipv6_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_mac_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_numeric\>"
|
|
||||||
syn match puppetStdLibFunction "\<is_string\>"
|
|
||||||
syn match puppetStdLibFunction "\<join\>"
|
|
||||||
syn match puppetStdLibFunction "\<join_keys_to_values\>"
|
|
||||||
syn match puppetStdLibFunction "\<keys\>"
|
|
||||||
syn match puppetStdLibFunction "\<load_module_metadata\>"
|
|
||||||
syn match puppetStdLibFunction "\<loadjson\>"
|
|
||||||
syn match puppetStdLibFunction "\<loadyaml\>"
|
|
||||||
syn match puppetStdLibFunction "\<lstrip\>"
|
|
||||||
syn match puppetStdLibFunction "\<max\>"
|
|
||||||
syn match puppetStdLibFunction "\<member\>"
|
|
||||||
syn match puppetStdLibFunction "\<merge\>"
|
|
||||||
syn match puppetStdLibFunction "\<min\>"
|
|
||||||
syn match puppetStdLibFunction "\<num2bool\>"
|
|
||||||
syn match puppetStdLibFunction "\<parsejson\>"
|
|
||||||
syn match puppetStdLibFunction "\<parseyaml\>"
|
|
||||||
syn match puppetStdLibFunction "\<pick\>"
|
|
||||||
syn match puppetStdLibFunction "\<pick_default\>"
|
|
||||||
syn match puppetStdLibFunction "\<prefix\>"
|
|
||||||
syn match puppetStdLibFunction "\<private\>"
|
|
||||||
syn match puppetStdLibFunction "\<pw_hash\>"
|
|
||||||
syn match puppetStdLibFunction "\<range\>"
|
|
||||||
syn match puppetStdLibFunction "\<regexpescape\>"
|
|
||||||
syn match puppetStdLibFunction "\<reject\>"
|
|
||||||
syn match puppetStdLibFunction "\<reverse\>"
|
|
||||||
syn match puppetStdLibFunction "\<rstrip\>"
|
|
||||||
syn match puppetStdLibFunction "\<seeded_rand\>"
|
|
||||||
syn match puppetStdLibFunction "\<shell_escape\>"
|
|
||||||
syn match puppetStdLibFunction "\<shell_join\>"
|
|
||||||
syn match puppetStdLibFunction "\<shell_split\>"
|
|
||||||
syn match puppetStdLibFunction "\<shuffle\>"
|
|
||||||
syn match puppetStdLibFunction "\<size\>"
|
|
||||||
syn match puppetStdLibFunction "\<sort\>"
|
|
||||||
syn match puppetStdLibFunction "\<squeeze\>"
|
|
||||||
syn match puppetStdLibFunction "\<str2bool\>"
|
|
||||||
syn match puppetStdLibFunction "\<str2saltedsha512\>"
|
|
||||||
syn match puppetStdLibFunction "\<strftime\>"
|
|
||||||
syn match puppetStdLibFunction "\<strip\>"
|
|
||||||
syn match puppetStdLibFunction "\<suffix\>"
|
|
||||||
syn match puppetStdLibFunction "\<swapcase\>"
|
|
||||||
syn match puppetStdLibFunction "\<time\>"
|
|
||||||
syn match puppetStdLibFunction "\<to_bytes\>"
|
|
||||||
syn match puppetStdLibFunction "\<try_get_value\>"
|
|
||||||
syn match puppetStdLibFunction "\<type\>"
|
|
||||||
syn match puppetStdLibFunction "\<type3x\>"
|
|
||||||
syn match puppetStdLibFunction "\<union\>"
|
|
||||||
syn match puppetStdLibFunction "\<unique\>"
|
|
||||||
syn match puppetStdLibFunction "\<unix2dos\>"
|
|
||||||
syn match puppetStdLibFunction "\<upcase\>"
|
|
||||||
syn match puppetStdLibFunction "\<uriescape\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_absolute_path\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_array\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_augeas\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_bool\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_cmd\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_email_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_hash\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_integer\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_ip_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_ipv4_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_ipv6_address\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_numeric\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_re\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_slength\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_string\>"
|
|
||||||
syn match puppetStdLibFunction "\<validate_x509_rsa_key_pair\>"
|
|
||||||
syn match puppetStdLibFunction "\<values\>"
|
|
||||||
syn match puppetStdLibFunction "\<values_at\>"
|
|
||||||
syn match puppetStdLibFunction "\<zip\>"
|
|
||||||
|
|
||||||
syn match puppetType "\<Any\>"
|
|
||||||
syn match puppetType "\<Array\>"
|
|
||||||
syn match puppetType "\<Binary\>"
|
|
||||||
syn match puppetType "\<Boolean\>"
|
|
||||||
syn match puppetType "\<Callable\>"
|
|
||||||
syn match puppetType "\<CatalogEntry\>"
|
|
||||||
syn match puppetType "\<Class\>"
|
|
||||||
syn match puppetType "\<Collection\>"
|
|
||||||
syn match puppetType "\<Data\>"
|
|
||||||
syn match puppetType "\<Default\>"
|
|
||||||
syn match puppetType "\<Enum\>"
|
|
||||||
syn match puppetType "\<Float\>"
|
|
||||||
syn match puppetType "\<Hash\>"
|
|
||||||
syn match puppetType "\<Integer\>"
|
|
||||||
syn match puppetType "\<Iterable\>"
|
|
||||||
syn match puppetType "\<Iterator\>"
|
|
||||||
syn match puppetType "\<NotUndef\>"
|
|
||||||
syn match puppetType "\<Numeric\>"
|
|
||||||
syn match puppetType "\<Object\>"
|
|
||||||
syn match puppetType "\<Optional\>"
|
|
||||||
syn match puppetType "\<Pattern\>"
|
|
||||||
syn match puppetType "\<Regexp\>"
|
|
||||||
syn match puppetType "\<Resource\>"
|
|
||||||
syn match puppetType "\<Runtime\>"
|
|
||||||
syn match puppetType "\<Scalar\>"
|
|
||||||
syn match puppetType "\<ScalarData\>"
|
|
||||||
syn match puppetType "\<SemVer\>"
|
|
||||||
syn match puppetType "\<SemVerRange\>"
|
|
||||||
syn match puppetType "\<Sensitive\>"
|
|
||||||
syn match puppetType "\<String\>"
|
|
||||||
syn match puppetType "\<Struct\>"
|
|
||||||
syn match puppetType "\<TimeSpan\>"
|
|
||||||
syn match puppetType "\<Timestamp\>"
|
|
||||||
syn match puppetType "\<Tuple\>"
|
|
||||||
syn match puppetType "\<Type\>"
|
|
||||||
syn match puppetType "\<TypeAlias\>"
|
|
||||||
syn match puppetType "\<TypeReference\>"
|
|
||||||
syn match puppetType "\<TypeSet\>"
|
|
||||||
syn match puppetType "\<Undef\>"
|
|
||||||
syn match puppetType "\<Unit\>"
|
|
||||||
syn match puppetType "\<Variant\>"
|
|
||||||
|
|
||||||
syn match puppetType "\<augeas\>"
|
|
||||||
syn match puppetType "\<computer\>"
|
|
||||||
syn match puppetType "\<cron\>"
|
|
||||||
syn match puppetType "\<exec\>"
|
|
||||||
syn match puppetType "\<file\>"
|
|
||||||
syn match puppetType "\<filebucket\>"
|
|
||||||
syn match puppetType "\<group\>"
|
|
||||||
syn match puppetType "\<host\>"
|
|
||||||
syn match puppetType "\<interface\>"
|
|
||||||
syn match puppetType "\<k5login\>"
|
|
||||||
syn match puppetType "\<macauthorization\>"
|
|
||||||
syn match puppetType "\<mailalias\>"
|
|
||||||
syn match puppetType "\<maillist\>"
|
|
||||||
syn match puppetType "\<mcx\>"
|
|
||||||
syn match puppetType "\<mount\>"
|
|
||||||
syn match puppetType "\<nagios_command\>"
|
|
||||||
syn match puppetType "\<nagios_contact\>"
|
|
||||||
syn match puppetType "\<nagios_contactgroup\>"
|
|
||||||
syn match puppetType "\<nagios_host\>"
|
|
||||||
syn match puppetType "\<nagios_hostdependency\>"
|
|
||||||
syn match puppetType "\<nagios_hostescalation\>"
|
|
||||||
syn match puppetType "\<nagios_hostextinfo\>"
|
|
||||||
syn match puppetType "\<nagios_hostgroup\>"
|
|
||||||
syn match puppetType "\<nagios_service\>"
|
|
||||||
syn match puppetType "\<nagios_servicedependency\>"
|
|
||||||
syn match puppetType "\<nagios_serviceescalation\>"
|
|
||||||
syn match puppetType "\<nagios_serviceextinfo\>"
|
|
||||||
syn match puppetType "\<nagios_servicegroup\>"
|
|
||||||
syn match puppetType "\<nagios_timeperiod\>"
|
|
||||||
syn match puppetType "\<notify\>"
|
|
||||||
syn match puppetType "\<package\>"
|
|
||||||
syn match puppetType "\<resources\>"
|
|
||||||
syn match puppetType "\<router\>"
|
|
||||||
syn match puppetType "\<schedule\>"
|
|
||||||
syn match puppetType "\<scheduled_task\>"
|
|
||||||
syn match puppetType "\<selboolean\>"
|
|
||||||
syn match puppetType "\<selmodule\>"
|
|
||||||
syn match puppetType "\<service\>"
|
|
||||||
syn match puppetType "\<ssh_authorized_key\>"
|
|
||||||
syn match puppetType "\<sshkey\>"
|
|
||||||
syn match puppetType "\<stage\>"
|
|
||||||
syn match puppetType "\<tidy\>"
|
|
||||||
syn match puppetType "\<user\>"
|
|
||||||
syn match puppetType "\<vlan\>"
|
|
||||||
syn match puppetType "\<whit\>"
|
|
||||||
syn match puppetType "\<yumrepo\>"
|
|
||||||
syn match puppetType "\<zfs\>"
|
|
||||||
syn match puppetType "\<zone\>"
|
|
||||||
syn match puppetType "\<zpool\>"
|
|
||||||
|
|
||||||
" Normal String {{{1
|
|
||||||
syn region puppetString matchgroup=puppetStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@puppetStringSpecial
|
|
||||||
syn region puppetString matchgroup=puppetStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=puppetQuoteEscape
|
|
||||||
|
|
||||||
" Normal Regular Expression {{{1
|
|
||||||
syn region puppetRegexp matchgroup=puppetRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/" skip="\\\\\|\\/" contains=@puppetRegexpSpecial
|
|
||||||
syn region puppetRegexp matchgroup=puppetRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/" skip="\\\\\|\\/" contains=@puppetRegexpSpecial
|
|
||||||
|
|
||||||
" Here Document {{{1
|
|
||||||
syn region puppetHeredocStart matchgroup=puppetStringDelimiter start=+@(\s*\%("[^"]\+"\|\w\+\)\%(/[nrtsuL$\\]*\)\=)+ end=+$+ oneline contains=ALLBUT,@puppetNotTop
|
|
||||||
|
|
||||||
syn region puppetString start=+@(\s*"\z([^"]\+\)"\%(/[nrtsuL$\\]*\)\=+hs=s+2 matchgroup=puppetStringDelimiter end=+^\s*|\=\s*-\=\s*\zs\z1$+ contains=puppetHeredocStart,@puppetStringSpecial keepend
|
|
||||||
syn region puppetString start=+@(\s*\z(\w\+\)\%(/[nrtsuL$\\]*\)\=+hs=s+2 matchgroup=puppetStringDelimiter end=+^\s*|\=\s*-\=\s*\zs\z1$+ contains=puppetHeredocStart keepend
|
|
||||||
|
|
||||||
" comments last overriding everything else
|
" comments last overriding everything else
|
||||||
syn match puppetComment "\s*#.*$" contains=puppetTodo,@Spell
|
syn match puppetComment "\s*#.*$" contains=puppetTodo,@Spell
|
||||||
syn region puppetComment start="/\*" end="\*/" contains=puppetTodo,@Spell extend
|
syn region puppetMultilineComment start="/\*" end="\*/" contains=puppetTodo,@Spell
|
||||||
syn keyword puppetTodo TODO NOTE FIXME XXX BUG HACK contained
|
syn keyword puppetTodo TODO NOTE FIXME XXX BUG HACK contained
|
||||||
|
syn keyword puppetTodo TODO: NOTE: FIXME: XXX: BUG: HACK: contained
|
||||||
|
|
||||||
" Define the default highlighting.
|
" Define the default highlighting.
|
||||||
command -nargs=+ HiLink hi def link <args>
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||||
|
if version >= 508 || !exists("did_puppet_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_puppet_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
HiLink puppetRegexp puppetConstant
|
HiLink puppetVariable Identifier
|
||||||
HiLink puppetStdLibFunction puppetFunction
|
HiLink puppetType Type
|
||||||
HiLink puppetNoInterpolation puppetString
|
HiLink puppetKeyword Keyword
|
||||||
HiLink puppetFunction Function
|
HiLink puppetComment Comment
|
||||||
HiLink puppetOperator Operator
|
HiLink puppetMultilineComment Comment
|
||||||
HiLink puppetString String
|
HiLink puppetString String
|
||||||
HiLink puppetWord String
|
HiLink puppetRegex Constant
|
||||||
HiLink puppetFloat Float
|
HiLink puppetRegexParen Delimiter
|
||||||
HiLink puppetInteger Number
|
HiLink puppetRegexBrace Delimiter
|
||||||
HiLink puppetBoolean Boolean
|
HiLink puppetRegexBrack Delimiter
|
||||||
HiLink puppetName puppetIdentifier
|
HiLink puppetRegexAngBrack Delimiter
|
||||||
HiLink puppetNameBad Error
|
HiLink puppetRegexTick Delimiter
|
||||||
HiLink puppetVariable puppetIdentifier
|
HiLink puppetRegexOr Delimiter
|
||||||
HiLink puppetIdentifier Identifier
|
HiLink puppetRegexSubName Identifier
|
||||||
HiLink puppetType Type
|
HiLink puppetRegexSpecChar SpecialChar
|
||||||
HiLink puppetConditional Conditional
|
HiLink puppetRegexComment Comment
|
||||||
HiLink puppetConstant Constant
|
HiLink puppetParamKeyword Keyword
|
||||||
HiLink puppetControl Statement
|
HiLink puppetParamDigits String
|
||||||
HiLink puppetKeyword Keyword
|
HiLink puppetNotVariable String
|
||||||
HiLink puppetStringDelimiter Delimiter
|
HiLink puppetParamSpecial Boolean
|
||||||
HiLink puppetDelimiter Delimiter
|
HiLink puppetSpecial Special
|
||||||
HiLink puppetTodo Todo
|
HiLink puppetTodo Todo
|
||||||
HiLink puppetComment Comment
|
HiLink puppetBrack Delimiter
|
||||||
|
HiLink puppetTypeBrack Delimiter
|
||||||
|
HiLink puppetBrace Delimiter
|
||||||
|
HiLink puppetTypeBrace Delimiter
|
||||||
|
HiLink puppetParen Delimiter
|
||||||
|
HiLink puppetDelimiter Delimiter
|
||||||
|
HiLink puppetControl Statement
|
||||||
|
HiLink puppetDefType Define
|
||||||
|
HiLink puppetDefName Type
|
||||||
|
HiLink puppetNodeRe Type
|
||||||
|
HiLink puppetTypeName Statement
|
||||||
|
HiLink puppetTypeDefault Type
|
||||||
|
HiLink puppetParamName Identifier
|
||||||
|
HiLink puppetArgument Identifier
|
||||||
|
HiLink puppetFunction Function
|
||||||
|
HiLink puppetClass Include
|
||||||
|
|
||||||
delcommand HiLink
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
let b:current_syntax = "puppet"
|
let b:current_syntax = "puppet"
|
||||||
|
|||||||
Reference in New Issue
Block a user