Fix tests

This commit is contained in:
Adam Stankiewicz
2020-10-17 14:17:55 +02:00
parent 6b663ec330
commit af3ebda710
18 changed files with 1298 additions and 14 deletions

145
syntax/context.vim Normal file
View File

@@ -0,0 +1,145 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1
" Vim syntax file
" Language: ConTeXt typesetting engine
" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
" Former Maintainers: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2016 Oct 16
if exists("b:current_syntax")
finish
endif
runtime! syntax/plaintex.vim
unlet b:current_syntax
let s:cpo_save = &cpo
set cpo&vim
" Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP.
let s:context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'}))
" For backward compatibility (g:context_include used to be a List)
if type(s:context_include) ==# type([])
let g:context_metapost = (index(s:context_include, 'mp') != -1)
let s:context_include = filter(
\ {'c': 'C', 'javascript': 'JS', 'ruby': 'Ruby', 'xml': 'XML'},
\ { k,_ -> index(s:context_include, k) != -1 }
\ )
endif
syn iskeyword @,48-57,a-z,A-Z,192-255
syn spell toplevel
" ConTeXt options, i.e., [...] blocks
syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell
" Highlight braces
syn match contextDelimiter '[{}]'
" Comments
syn match contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo
syn match contextComment '^\s*%[CDM].*$' display contains=initexTodo
syn match contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell
syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1'
syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}'
syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>'
syn region contextEscaped matchgroup=contextPreProc
\ start='\\start\z(\a*\%(typing\|typen\)\)'
\ end='\\stop\z1' contains=plaintexComment keepend
syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}'
syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}'
syn match contextBuiltin display contains=@NoSpell
\ '\\\%(unprotect\|protect\|unexpanded\)\>'
syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>'
\ contains=@NoSpell
if get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
let b:mp_metafun_macros = 1 " Highlight MetaFun keywords
syn include @mpTop syntax/mp.vim
unlet b:current_syntax
syn region contextMPGraphic matchgroup=contextBlockDelim
\ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$'
\ end='\\stop\z1'
\ contains=@mpTop,@NoSpell
syn region contextMPGraphic matchgroup=contextBlockDelim
\ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$'
\ end='\\stop\z1'
\ contains=@mpTop,@NoSpell
endif
if get(b:, 'context_lua', get(g:, 'context_lua', 1))
syn include @luaTop syntax/lua.vim
unlet b:current_syntax
syn region contextLuaCode matchgroup=contextBlockDelim
\ start='\\startluacode\>'
\ end='\\stopluacode\>' keepend
\ contains=@luaTop,@NoSpell
syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\="
\ nextgroup=contextBeginEndLua skipwhite skipempty
\ contains=initexComment
syn region contextBeginEndLua matchgroup=contextSpecial
\ start="{" end="}" skip="\\[{}]"
\ contained contains=@luaTop,@NoSpell
endif
for synname in keys(s:context_include)
execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim'
unlet b:current_syntax
execute 'syn region context' . s:context_include[synname] . 'Code'
\ 'matchgroup=contextBlockDelim'
\ 'start=+\\start' . s:context_include[synname] . '+'
\ 'end=+\\stop' . s:context_include[synname] . '+'
\ 'contains=@' . synname . 'Top,@NoSpell'
endfor
syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>'
\ contains=@NoSpell
syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|'
\ contains=@NoSpell
syn match contextSpecial /\\[`'"]/
syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+
\ contains=@NoSpell
syn match contextSpecial '\^\^.'
syn match contextSpecial '`\%(\\.\|\^\^.\|.\)'
syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>'
\ contains=@NoSpell
hi def link contextOptions Typedef
hi def link contextComment Comment
hi def link contextBlockDelim Keyword
hi def link contextBuiltin Keyword
hi def link contextDelimiter Delimiter
hi def link contextEscaped String
hi def link contextPreProc PreProc
hi def link contextSectioning PreProc
hi def link contextSpecial Special
hi def link contextType Type
hi def link contextStyle contextType
hi def link contextFont contextType
hi def link contextDirectLua Keyword
let b:current_syntax = "context"
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -1,4 +1,4 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'docker-compose') == -1
" Vim syntax file
" Language: Dockerfile

49
syntax/dockerfile.vim Normal file
View File

@@ -0,0 +1,49 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
" dockerfile.vim - Syntax highlighting for Dockerfiles
" Maintainer: Honza Pokorny <https://honza.ca>
" Last Change: 2020 Feb 11
" License: BSD
" https://docs.docker.com/engine/reference/builder/
if exists("b:current_syntax")
finish
endif
syntax include @JSON syntax/json.vim
unlet b:current_syntax
syntax include @Shell syntax/sh.vim
unlet b:current_syntax
syntax case ignore
syntax match dockerfileLinePrefix /\v^\s*(ONBUILD\s+)?\ze\S/ contains=dockerfileKeyword nextgroup=dockerfileInstruction skipwhite
syntax region dockerfileFrom matchgroup=dockerfileKeyword start=/\v^\s*(FROM)\ze(\s|$)/ skip=/\v\\\_./ end=/\v((^|\s)AS(\s|$)|$)/ contains=dockerfileOption
syntax keyword dockerfileKeyword contained ADD ARG CMD COPY ENTRYPOINT ENV EXPOSE HEALTHCHECK LABEL MAINTAINER ONBUILD RUN SHELL STOPSIGNAL USER VOLUME WORKDIR
syntax match dockerfileOption contained /\v(^|\s)\zs--\S+/
syntax match dockerfileInstruction contained /\v<(\S+)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileValue
syntax match dockerfileInstruction contained /\v<(ADD|COPY)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileJSON
syntax match dockerfileInstruction contained /\v<(HEALTHCHECK)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileInstruction
syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileShell
syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>\ze\s+\[/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON
syntax match dockerfileInstruction contained /\v<(SHELL|VOLUME)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON
syntax region dockerfileString contained start=/\v"/ skip=/\v\\./ end=/\v"/
syntax region dockerfileJSON contained keepend start=/\v\[/ skip=/\v\\\_./ end=/\v$/ contains=@JSON
syntax region dockerfileShell contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=@Shell
syntax region dockerfileValue contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=dockerfileString
syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/
set commentstring=#\ %s
hi def link dockerfileString String
hi def link dockerfileKeyword Keyword
hi def link dockerfileComment Comment
hi def link dockerfileOption Special
let b:current_syntax = "dockerfile"
endif

60
syntax/man.vim Normal file
View File

@@ -0,0 +1,60 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'man') == -1
" Vim syntax file
" Language: Man page
" Maintainer: Jason Franklin <vim@justemail.net>
" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com>
" Version Info:
" Last Change: 2020 Sep 19
" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>:
" * manSubHeading
" * manSynopsis (only for sections 2 and 3)
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Get the CTRL-H syntax to handle backspaced text
runtime! syntax/ctrlh.vim
syn case ignore
syn match manReference "\f\+([1-9][a-z]\=)"
syn match manSectionHeading "^\a.*$"
syn match manSubHeading "^\s\{3\}\a.*$"
syn match manOptionDesc "^\s*[+-][a-z0-9]\S*"
syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*"
" syn match manHistory "^[a-z].*last change.*$"
syn match manHeader '\%1l.*'
exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
if getline(1) =~ '^[a-zA-Z_]\+([23])'
syntax include @cCode <sfile>:p:h/c.vim
syn match manCFuncDefinition display "\<\h\w*\>\s*("me=e-1 contained
syn region manSynopsis start="^SYNOPSIS"hs=s+8 end="^\u\+\s*$"me=e-12 keepend contains=manSectionHeading,@cCode,manCFuncDefinition
endif
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link manHeader Title
hi def link manFooter PreProc
hi def link manSectionHeading Statement
hi def link manOptionDesc Constant
hi def link manLongOptionDesc Constant
hi def link manReference PreProc
hi def link manSubHeading Function
hi def link manCFuncDefinition Function
let b:current_syntax = "man"
" vim:ts=8 sts=2 sw=2:
endif

142
syntax/xpm.vim Normal file
View File

@@ -0,0 +1,142 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xpm') == -1
" Vim syntax file
" Language: X Pixmap
" Maintainer: Ronald Schild <rs@scutum.de>
" Last Change: 2017 Feb 01
" Version: 5.4n.1
" Jemma Nelson added termguicolors support
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syn keyword xpmType char
syn keyword xpmStorageClass static
syn keyword xpmTodo TODO FIXME XXX contained
syn region xpmComment start="/\*" end="\*/" contains=xpmTodo
syn region xpmPixelString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@xpmColors
if has("gui_running") || has("termguicolors") && &termguicolors
let color = ""
let chars = ""
let colors = 0
let cpp = 0
let n = 0
let i = 1
while i <= line("$") " scanning all lines
let s = matchstr(getline(i), '".\{-1,}"')
if s != "" " does line contain a string?
if n == 0 " first string is the Values string
" get the 3rd value: colors = number of colors
let colors = substitute(s, '"\s*\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '')
" get the 4th value: cpp = number of character per pixel
let cpp = substitute(s, '"\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '')
if cpp =~ '[^0-9]'
break " if cpp is not made of digits there must be something wrong
endif
" Highlight the Values string as normal string (no pixel string).
" Only when there is no slash, it would terminate the pattern.
if s !~ '/'
exe 'syn match xpmValues /' . s . '/'
endif
hi link xpmValues String
let n = 1 " n = color index
elseif n <= colors " string is a color specification
" get chars = <cpp> length string representing the pixels
" (first incl. the following whitespace)
let chars = substitute(s, '"\(.\{'.cpp.'}\s\).*"', '\1', '')
" now get color, first try 'c' key if any (color visual)
let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '')
if color == s
" no 'c' key, try 'g' key (grayscale with more than 4 levels)
let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '')
if color == s
" next try: 'g4' key (4-level grayscale)
let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '')
if color == s
" finally try 'm' key (mono visual)
let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '')
if color == s
let color = ""
endif
endif
endif
endif
" Vim cannot handle RGB codes with more than 6 hex digits
if color =~ '#\x\{10,}$'
let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g')
elseif color =~ '#\x\{7,}$'
let color = substitute(color, '\(\x\x\)\x', '\1', 'g')
" nor with 3 digits
elseif color =~ '#\x\{3}$'
let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '')
endif
" escape meta characters in patterns
let s = escape(s, '/\*^$.~[]')
let chars = escape(chars, '/\*^$.~[]')
" now create syntax items
" highlight the color string as normal string (no pixel string)
exe 'syn match xpmCol'.n.'Def /'.s.'/ contains=xpmCol'.n.'inDef'
exe 'hi link xpmCol'.n.'Def String'
" but highlight the first whitespace after chars in its color
exe 'syn match xpmCol'.n.'inDef /"'.chars.'/hs=s+'.(cpp+1).' contained'
exe 'hi link xpmCol'.n.'inDef xpmColor'.n
" remove the following whitespace from chars
let chars = substitute(chars, '.$', '', '')
" and create the syntax item contained in the pixel strings
exe 'syn match xpmColor'.n.' /'.chars.'/ contained'
exe 'syn cluster xpmColors add=xpmColor'.n
" if no color or color = "None" show background
if color == "" || substitute(color, '.*', '\L&', '') == 'none'
exe 'hi xpmColor'.n.' guifg=bg'
exe 'hi xpmColor'.n.' guibg=NONE'
elseif color !~ "'"
exe 'hi xpmColor'.n." guifg='".color."'"
exe 'hi xpmColor'.n." guibg='".color."'"
endif
let n = n + 1
else
break " no more color string
endif
endif
let i = i + 1
endwhile
unlet color chars colors cpp n i s
endif " has("gui_running") || has("termguicolors") && &termguicolors
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link xpmType Type
hi def link xpmStorageClass StorageClass
hi def link xpmTodo Todo
hi def link xpmComment Comment
hi def link xpmPixelString String
let b:current_syntax = "xpm"
" vim: ts=8:sw=3:noet:
endif

157
syntax/xpm2.vim Normal file
View File

@@ -0,0 +1,157 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xpm2') == -1
" Vim syntax file
" Language: X Pixmap v2
" Maintainer: Steve Wall (hitched97@velnet.com)
" Last Change: 2017 Feb 01
" (Dominique Pelle added @Spell)
" Version: 5.8
" Jemma Nelson added termguicolors support
"
" Made from xpm.vim by Ronald Schild <rs@scutum.de>
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
syn region xpm2PixelString start="^" end="$" contains=@xpm2Colors
syn keyword xpm2Todo TODO FIXME XXX contained
syn match xpm2Comment "\!.*$" contains=@Spell,xpm2Todo
command -nargs=+ Hi hi def <args>
if has("gui_running") || has("termguicolors") && &termguicolors
let color = ""
let chars = ""
let colors = 0
let cpp = 0
let n = 0
let i = 1
while i <= line("$") " scanning all lines
let s = getline(i)
if match(s,"\!.*$") != -1
let s = matchstr(s, "^[^\!]*")
endif
if s != "" " does line contain a string?
if n == 0 " first string is the Values string
" get the 3rd value: colors = number of colors
let colors = substitute(s, '\s*\d\+\s\+\d\+\s\+\(\d\+\).*', '\1', '')
" get the 4th value: cpp = number of character per pixel
let cpp = substitute(s, '\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*', '\1', '')
if cpp =~ '[^0-9]'
break " if cpp is not made of digits there must be something wrong
endif
" Highlight the Values string as normal string (no pixel string).
" Only when there is no slash, it would terminate the pattern.
if s !~ '/'
exe 'syn match xpm2Values /' . s . '/'
endif
hi def link xpm2Values Statement
let n = 1 " n = color index
elseif n <= colors " string is a color specification
" get chars = <cpp> length string representing the pixels
" (first incl. the following whitespace)
let chars = substitute(s, '\(.\{'.cpp.'}\s\+\).*', '\1', '')
" now get color, first try 'c' key if any (color visual)
let color = substitute(s, '.*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*', '\1', '')
if color == s
" no 'c' key, try 'g' key (grayscale with more than 4 levels)
let color = substitute(s, '.*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*', '\1', '')
if color == s
" next try: 'g4' key (4-level grayscale)
let color = substitute(s, '.*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*', '\1', '')
if color == s
" finally try 'm' key (mono visual)
let color = substitute(s, '.*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*', '\1', '')
if color == s
let color = ""
endif
endif
endif
endif
" Vim cannot handle RGB codes with more than 6 hex digits
if color =~ '#\x\{10,}$'
let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g')
elseif color =~ '#\x\{7,}$'
let color = substitute(color, '\(\x\x\)\x', '\1', 'g')
" nor with 3 digits
elseif color =~ '#\x\{3}$'
let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '')
endif
" escape meta characters in patterns
let s = escape(s, '/\*^$.~[]')
let chars = escape(chars, '/\*^$.~[]')
" change whitespace to "\s\+"
let s = substitute(s, "[ \t][ \t]*", "\\\\s\\\\+", "g")
let chars = substitute(chars, "[ \t][ \t]*", "\\\\s\\\\+", "g")
" now create syntax items
" highlight the color string as normal string (no pixel string)
exe 'syn match xpm2Col'.n.'Def /'.s.'/ contains=xpm2Col'.n.'inDef'
exe 'hi def link xpm2Col'.n.'Def Constant'
" but highlight the first whitespace after chars in its color
exe 'syn match xpm2Col'.n.'inDef /^'.chars.'/hs=s+'.(cpp).' contained'
exe 'hi def link xpm2Col'.n.'inDef xpm2Color'.n
" remove the following whitespace from chars
let chars = substitute(chars, '\\s\\+$', '', '')
" and create the syntax item contained in the pixel strings
exe 'syn match xpm2Color'.n.' /'.chars.'/ contained'
exe 'syn cluster xpm2Colors add=xpm2Color'.n
" if no color or color = "None" show background
if color == "" || substitute(color, '.*', '\L&', '') == 'none'
exe 'Hi xpm2Color'.n.' guifg=bg guibg=NONE'
elseif color !~ "'"
exe 'Hi xpm2Color'.n." guifg='".color."' guibg='".color."'"
endif
let n = n + 1
else
break " no more color string
endif
endif
let i = i + 1
endwhile
unlet color chars colors cpp n i s
endif " has("gui_running") || has("termguicolors") && &termguicolors
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
" The default highlighting.
hi def link xpm2Type Type
hi def link xpm2StorageClass StorageClass
hi def link xpm2Todo Todo
hi def link xpm2Comment Comment
hi def link xpm2PixelString String
delcommand Hi
let b:current_syntax = "xpm2"
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8:sw=2:noet:
endif