diff options
36 files changed, 881 insertions, 2530 deletions
| @@ -84,12 +84,12 @@ If you need full functionality of any plugin, please use it directly with your p  - [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect)  - [pgsql](https://github.com/exu/pgsql.vim) (syntax, ftdetect)  - [php](https://github.com/StanAngeloff/php.vim) (syntax) -- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect) +- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin, ftdetect)  - [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect)  - [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent, ftdetect)  - [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect)  - [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin, ftdetect) -- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftdetect) +- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftplugin, ftdetect)  - [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)  - [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)  - [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin) diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim index e5324c1b..e9214981 100644 --- a/after/ftplugin/javascript.vim +++ b/after/ftplugin/javascript.vim @@ -7,6 +7,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==  setlocal iskeyword+=$ suffixesadd+=.js -let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<' +if exists('b:undo_ftplugin') +  let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<' +else +  let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<' +endif  endif diff --git a/after/syntax/haml.vim b/after/syntax/haml.vim index 5333de69..5128f7e5 100644 --- a/after/syntax/haml.vim +++ b/after/syntax/haml.vim @@ -5,6 +5,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')  " URL:         http://github.com/kchmck/vim-coffee-script  " License:     WTFPL + +if exists('b:current_syntax') +  let s:current_syntax_save = b:current_syntax +endif +  " Inherit coffee from html so coffeeComment isn't redefined and given higher  " priority than hamlInterpolation.  syn cluster hamlCoffeescript contains=@htmlCoffeeScript @@ -14,4 +19,9 @@ syn region  hamlCoffeescriptFilter matchgroup=hamlFilter  \                                  contains=@hamlCoffeeScript,hamlInterpolation  \                                  keepend +if exists('s:current_syntax_save') +  let b:current_syntax = s:current_syntax_save +  unlet s:current_syntax_save +endif +  endif diff --git a/after/syntax/html.vim b/after/syntax/html.vim index 5881b3e8..5979f111 100644 --- a/after/syntax/html.vim +++ b/after/syntax/html.vim @@ -5,6 +5,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')  " URL:         http://github.com/kchmck/vim-coffee-script  " License:     WTFPL +if exists('b:current_syntax') +  let s:current_syntax_save = b:current_syntax +endif +  " Syntax highlighting for text/coffeescript script tags  syn include @htmlCoffeeScript syntax/coffee.vim  syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*># @@ -12,6 +16,11 @@ syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#  \                       contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc  \                       containedin=htmlHead +if exists('s:current_syntax_save') +  let b:current_syntax = s:current_syntax_save +  unlet s:current_syntax_save +endif +  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1 diff --git a/compiler/typescript.vim b/compiler/typescript.vim index 57e1437a..b4137943 100644 --- a/compiler/typescript.vim +++ b/compiler/typescript.vim @@ -13,6 +13,10 @@ if !exists("g:typescript_compiler_options")    let g:typescript_compiler_options = ""  endif +if exists(":CompilerSet") != 2 +  command! -nargs=* CompilerSet setlocal <args> +endif +  let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $*  %'  CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m diff --git a/extras/flow.vim b/extras/flow.vim index 87698e1a..6e7420f8 100644 --- a/extras/flow.vim +++ b/extras/flow.vim @@ -319,3 +319,94 @@ if version >= 508 || !exists("did_javascript_syn_inits")  endif  endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 +   +syntax region  jsFlowDefinition     contained                        start=/:/    end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen +syntax region  jsFlowArgumentDef    contained                        start=/:/    end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster +syntax region  jsFlowArray          contained matchgroup=jsFlowNoise start=/\[/   end=/\]/        contains=@jsFlowCluster +syntax region  jsFlowObject         contained matchgroup=jsFlowNoise start=/{/    end=/}/         contains=@jsFlowCluster +syntax region  jsFlowParens         contained matchgroup=jsFlowNoise start=/(/  end=/)/ contains=@jsFlowCluster +syntax match   jsFlowNoise          contained /[:;,<>]/ +syntax keyword jsFlowType           contained boolean number string null void any mixed JSON array function object array bool class +syntax keyword jsFlowTypeof         contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType +syntax match   jsFlowTypeCustom     contained /\k*/ skipwhite skipempty nextgroup=jsFlowGroup +syntax region  jsFlowGroup          contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster +syntax region  jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/  end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster +syntax match   jsFlowArrow          contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens +syntax match   jsFlowMaybe          contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments +syntax match   jsFlowObjectKey      contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject +syntax match   jsFlowOrOperator     contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster + +syntax match   jsFlowReturn         contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster +syntax region  jsFlowReturnObject   contained matchgroup=jsFlowNoise start=/{/    end=/}/  contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp +syntax region  jsFlowReturnArray    contained matchgroup=jsFlowNoise start=/\[/   end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp +syntax region  jsFlowReturnParens   contained matchgroup=jsFlowNoise start=/(/    end=/)/  contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp +syntax match   jsFlowReturnKeyword  contained /\k\+/ contains=jsFlowType,jsFlowTypeCustom skipwhite skipempty nextgroup=jsFlowReturnGroup,jsFuncBlock,jsFlowReturnOrOp +syntax match   jsFlowReturnMaybe    contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword +syntax region  jsFlowReturnGroup    contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp +syntax match   jsFlowReturnOrOp     contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster + +syntax region  jsFlowFunctionGroup  contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs +syntax region  jsFlowClassGroup     contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock + +syntax region  jsFlowTypeStatement                                   start=/type/    end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend +syntax region  jsFlowTypeValue      contained                        start=/=/       end=/[;\n]/ contains=@jsExpression,jsFlowGroup,jsFlowMaybe +syntax match   jsFlowTypeOperator   contained /=/ +syntax keyword jsFlowTypeKeyword    contained type + +syntax keyword jsFlowDeclare                  declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface +syntax match   jsFlowClassProperty  contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlowClassDef containedin=jsClassBlock +syntax region  jsFlowClassDef       contained start=/:/    end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassValue + +syntax region  jsFlowModule         contained start=/module/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowDeclareBlock contains=jsString +syntax region  jsFlowInterface      contained start=/interface/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster +syntax region  jsFlowDeclareBlock   contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise + +syntax region jsFlowInterfaceBlock  contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise keepend + +syntax cluster jsFlowReturnCluster            contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp +syntax cluster jsFlowCluster                  contains=jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGroup,jsFlowArrowArguments,jsFlowMaybe,jsFlowParens,jsFlowOrOperator + +if version >= 508 || !exists("did_javascript_syn_inits") +  if version < 508 +    let did_javascript_syn_inits = 1 +    command -nargs=+ HiLink hi link <args> +  else +    command -nargs=+ HiLink hi def link <args> +  endif +  HiLink jsFlowDefinition         PreProc +  HiLink jsFlowClassDef           jsFlowDefinition +  HiLink jsFlowArgumentDef        jsFlowDefinition +  HiLink jsFlowType               Type +  HiLink jsFlowTypeCustom         PreProc +  HiLink jsFlowTypeof             PreProc +  HiLink jsFlowArray              PreProc +  HiLink jsFlowObject             PreProc +  HiLink jsFlowParens             PreProc +  HiLink jsFlowGroup              PreProc +  HiLink jsFlowReturn             PreProc +  HiLink jsFlowReturnObject       jsFlowReturn +  HiLink jsFlowReturnArray        jsFlowArray +  HiLink jsFlowReturnParens       jsFlowParens +  HiLink jsFlowReturnGroup        jsFlowGroup +  HiLink jsFlowFunctionGroup      PreProc +  HiLink jsFlowClassGroup         PreProc +  HiLink jsFlowArrowArguments     PreProc +  HiLink jsFlowArrow              PreProc +  HiLink jsFlowTypeStatement      PreProc +  HiLink jsFlowTypeKeyword        PreProc +  HiLink jsFlowTypeOperator       PreProc +  HiLink jsFlowMaybe              PreProc +  HiLink jsFlowReturnMaybe        PreProc +  HiLink jsFlowClassProperty      jsClassProperty +  HiLink jsFlowDeclare            PreProc +  HiLink jsFlowModule             PreProc +  HiLink jsFlowInterface          PreProc +  HiLink jsFlowNoise              Noise +  HiLink jsFlowObjectKey          jsObjectKey +  HiLink jsFlowOrOperator         PreProc +  HiLink jsFlowReturnOrOp         jsFlowOrOperator +  delcommand HiLink +endif + +endif diff --git a/extras/jsdoc.vim b/extras/jsdoc.vim index b227c59d..5317cb4b 100644 --- a/extras/jsdoc.vim +++ b/extras/jsdoc.vim @@ -256,3 +256,46 @@ if version >= 508 || !exists("did_javascript_syn_inits")  endif  endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 +   +"" syntax coloring for javadoc comments (HTML) +syntax region jsComment    matchgroup=jsComment start="/\*\s*"  end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold + +" tags containing a param +syntax match  jsDocTags         contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam +" tags containing type and param +syntax match  jsDocTags         contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType +" tags containing type but no param +syntax match  jsDocTags         contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam +" tags containing references +syntax match  jsDocTags         contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag +" other tags (no extra syntax) +syntax match  jsDocTags         contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>" + +syntax region jsDocType         contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam +syntax match  jsDocType         contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam +syntax region jsDocTypeRecord   contained start=/{/ end=/}/ contains=jsDocTypeRecord extend +syntax region jsDocTypeRecord   contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend +syntax region jsDocTypeNoParam  contained start="{" end="}" oneline +syntax match  jsDocTypeNoParam  contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" +syntax match  jsDocParam        contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+" +syntax region jsDocSeeTag       contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags + +if version >= 508 || !exists("did_javascript_syn_inits") +  if version < 508 +    let did_javascript_syn_inits = 1 +    command -nargs=+ HiLink hi link <args> +  else +    command -nargs=+ HiLink hi def link <args> +  endif +  HiLink jsDocTags              Special +  HiLink jsDocSeeTag            Function +  HiLink jsDocType              Type +  HiLink jsDocTypeBrackets      jsDocType +  HiLink jsDocTypeRecord        jsDocType +  HiLink jsDocTypeNoParam       Type +  HiLink jsDocParam             Label +  delcommand HiLink +endif + +endif diff --git a/extras/ngdoc.vim b/extras/ngdoc.vim index 71cfb8ef..88a6e94e 100644 --- a/extras/ngdoc.vim +++ b/extras/ngdoc.vim @@ -40,3 +40,10 @@ syntax match  jsDocType         contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" n  syntax match  jsDocParam        contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"  endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 +   +syntax match  jsDocTags         contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite +syntax match  jsDocType         contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite +syntax match  jsDocParam        contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+" + +endif diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index caa6ad5e..6e25fd4e 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -615,7 +615,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -  " Version:      0.1  if did_filetype() -	  finish +  finish  endif  autocmd BufRead,BufNewFile * :if getline(1) =~ '^.*startuml.*$'| setfiletype plantuml | set filetype=plantuml | endif @@ -736,7 +736,6 @@ au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby		call s:setf('ruby')  au BufNewFile,BufRead [rR]akefile,*.rake			call s:setf('ruby')  au BufNewFile,BufRead [rR]akefile*				call s:StarSetf('ruby') -" TODO: does anyone still use Rantfiles? Remove for Vim 8?  " Rantfile  au BufNewFile,BufRead [rR]antfile,*.rant			call s:setf('ruby') diff --git a/ftplugin/perl6.vim b/ftplugin/perl6.vim deleted file mode 100644 index 969eca96..00000000 --- a/ftplugin/perl6.vim +++ /dev/null @@ -1,92 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 -   -" Vim filetype plugin file -" Language:      Perl 6 -" Maintainer:    vim-perl <vim-perl@googlegroups.com> -" Homepage:      http://github.com/vim-perl/vim-perl -" Bugs/requests: http://github.com/vim-perl/vim-perl/issues -" Last Change:   {{LAST_CHANGE}} -" Contributors:  Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> -" -" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com> - -if exists("b:did_ftplugin") | finish | endif -let b:did_ftplugin = 1 - -" Make sure the continuation lines below do not cause problems in -" compatibility mode. -let s:save_cpo = &cpo -set cpo-=C - -setlocal formatoptions-=t -setlocal formatoptions+=crqol -setlocal keywordprg=p6doc - -setlocal comments=:#\|,:#=,:# -setlocal commentstring=#%s - -" Change the browse dialog on Win32 to show mainly Perl-related files -if has("gui_win32") -    let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" . -               \ "Perl Modules (*.pm)\t*.pm\n" . -               \ "Perl Documentation Files (*.pod)\t*.pod\n" . -               \ "All Files (*.*)\t*.*\n" -endif - -" Provided by Ned Konz <ned at bike-nomad dot com> -"--------------------------------------------- -setlocal include=\\<\\(use\\\|require\\)\\> -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','') -setlocal define=[^A-Za-z_] - -" The following line changes a global variable but is necessary to make -" gf and similar commands work. Thanks to Andrew Pimlott for pointing out -" the problem. If this causes a " problem for you, add an -" after/ftplugin/perl6.vim file that contains -"       set isfname-=: -set isfname+=: -setlocal iskeyword=@,48-57,_,192-255,- - -" Set this once, globally. -if !exists("perlpath") -    if executable("perl6") -        try -            if &shellxquote != '"' -                let perlpath = system('perl6 -e  "@*INC.join(q/,/).say"') -            else -                let perlpath = system("perl6 -e  '@*INC.join(q/,/).say'") -            endif -            let perlpath = substitute(perlpath,',.$',',,','') -        catch /E145:/ -            let perlpath = ".,," -        endtry -    else -        " If we can't call perl to get its path, just default to using the -        " current directory and the directory of the current file. -        let perlpath = ".,," -    endif -endif - -" Append perlpath to the existing path value, if it is set.  Since we don't -" use += to do it because of the commas in perlpath, we have to handle the -" global / local settings, too. -if &l:path == "" -    if &g:path == "" -        let &l:path=perlpath -    else -        let &l:path=&g:path.",".perlpath -    endif -else -    let &l:path=&l:path.",".perlpath -endif -"--------------------------------------------- - -" Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" . -        \         " | unlet! b:browsefilter" - -" Restore the saved compatibility options. -let &cpo = s:save_cpo -unlet s:save_cpo - -endif diff --git a/ftplugin/plantuml.vim b/ftplugin/plantuml.vim index c4deb886..1d15b06f 100644 --- a/ftplugin/plantuml.vim +++ b/ftplugin/plantuml.vim @@ -6,17 +6,33 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -  " Last Change:  19-Jun-2012  " Version:      0.1 -if exists("g:loaded_plantuml_plugin") -    finish +if exists("b:loaded_plantuml_plugin") +  finish  endif -let g:loaded_plantuml_plugin = 1 +let b:loaded_plantuml_plugin = 1  if !exists("g:plantuml_executable_script") -	let g:plantuml_executable_script="plantuml" +  let g:plantuml_executable_script="plantuml"  endif -autocmd Filetype plantuml let &l:makeprg=g:plantuml_executable_script . " " .  fnameescape(expand("%")) +if exists("loaded_matchit") +  let b:match_ignorecase = 0 +  let b:match_words = +        \ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' . +        \ ',\<if\>:\<elseif\>:\<else\>:\<endif\>' . +        \ ',\<rnote\>:\<endrnote\>' . +        \ ',\<hnote\>:\<endhnote\>' . +        \ ',\<title\>:\<endtitle\>' . +        \ ',\<\while\>:\<endwhile\>' +endif + +let &l:makeprg=g:plantuml_executable_script . " " .  fnameescape(expand("%"))  setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql +let b:endwise_addition = '\=index(["note","legend"], submatch(0))!=-1 ? "end " . submatch(0) : "end"' +let b:endwise_words = 'loop,group,alt,note,legend' +let b:endwise_pattern = '^\s*\zs\<\(loop\|group\|alt\|note\ze[^:]*$\|legend\)\>.*$' +let b:endwise_syngroups = 'plantumlKeyword' +  endif diff --git a/ftplugin/purescript.vim b/ftplugin/purescript.vim new file mode 100644 index 00000000..4e40143f --- /dev/null +++ b/ftplugin/purescript.vim @@ -0,0 +1,5 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1 +   +setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:-- + +endif diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 1969658d..806b21cb 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -77,9 +77,9 @@ function! s:query_path(root) abort      let prefix = ''    endif    if &shellxquote == "'" -    let path_check = prefix.'ruby -e --disable-gems"' . code . '"' +    let path_check = prefix.'ruby --disable-gems -e "' . code . '"'    else -    let path_check = prefix."ruby -e --disable-gems'" . code . "'" +    let path_check = prefix."ruby --disable-gems -e '" . code . "'"    endif    let cd = haslocaldir() ? 'lcd' : 'cd' diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index 9943e657..3faa9dfb 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -48,7 +48,6 @@ endif  " This includeexpr isn't perfect, but it's a good start  setlocal includeexpr=substitute(v:fname,'::','/','g') -" NOT adding .rc as it's being phased out (0.7)  setlocal suffixesadd=.rs  if exists("g:ftplugin_rust_source_path") diff --git a/ftplugin/scala.vim b/ftplugin/scala.vim index 24b24136..026e20cd 100644 --- a/ftplugin/scala.vim +++ b/ftplugin/scala.vim @@ -18,7 +18,11 @@ silent! setlocal formatoptions+=j  " Just like c.vim, but additionally doesn't wrap text onto /** line when  " formatting. Doesn't bungle bulleted lists when formatting. -setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,:// +if get(g:, 'scala_scaladoc_indent', 0) +  setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s2:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,:// +else +  setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,:// +endif  setlocal commentstring=//\ %s  setlocal shiftwidth=2 softtabstop=2 expandtab diff --git a/indent/eelixir.vim b/indent/eelixir.vim index d9538425..b80edc98 100644 --- a/indent/eelixir.vim +++ b/indent/eelixir.vim @@ -8,6 +8,9 @@ runtime! indent/elixir.vim  unlet! b:did_indent  setlocal indentexpr= +let s:cpo_save = &cpo +set cpo&vim +  if exists("b:eelixir_subtype")    exe "runtime! indent/".b:eelixir_subtype.".vim"  else @@ -53,19 +56,21 @@ function! GetEelixirIndent(...)    let line = getline(lnum)    let cline = getline(v:lnum)    if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>' -    let ind = ind - &sw +    let ind -= &sw    elseif line =~# '\S\s*<%\s*end\s*%>' -    let ind = ind - &sw +    let ind -= &sw    endif -  if line =~# '<%[=%]\=\s*.*\<do\s*%>' -    let ind = ind + &sw -  elseif line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>' -    let ind = ind + &sw +  if line =~# '<%[=%]\=\s*.*\(\<do\|->\)\s*%>' || +        \ line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>' +    let ind += &sw    endif    if cline =~# '^\s*%>\s*$' -    let ind = ind - &sw +    let ind -= &sw    endif    return ind  endfunction +let &cpo = s:cpo_save +unlet s:cpo_save +  endif diff --git a/indent/elixir.vim b/indent/elixir.vim index 7ccaea12..3e7b6de0 100644 --- a/indent/elixir.vim +++ b/indent/elixir.vim @@ -2,141 +2,198 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1  if exists("b:did_indent")    finish -endif +end  let b:did_indent = 1  setlocal nosmartindent  setlocal indentexpr=GetElixirIndent() -setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue +setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue,0=\|>  if exists("*GetElixirIndent")    finish -endif +end  let s:cpo_save = &cpo  set cpo&vim -let s:no_colon_before        = ':\@<!' -let s:no_colon_after         = ':\@!' -let s:symbols_end            = '\]\|}\|)' -let s:symbols_start          = '\[\|{\|(' -let s:arrow                  = '^.*->$' -let s:skip_syntax            = '\%(Comment\|String\)$' -let s:block_skip             = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'" -let s:block_start            = '\<\%(do\|fn\)\>' -let s:block_middle           = 'else\|match\|elsif\|catch\|after\|rescue' -let s:block_end              = 'end' -let s:starts_with_pipeline   = '^\s*|>.*$' +let s:no_colon_before = ':\@<!' +let s:no_colon_after = ':\@!' +let s:symbols_end = '\]\|}\|)' +let s:symbols_start = '\[\|{\|(' +let s:arrow = '^.*->$' +let s:skip_syntax = '\%(Comment\|String\)$' +let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'" +let s:block_start = '\<\%(do\|fn\)\>' +let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue' +let s:block_end = 'end' +let s:starts_with_pipeline = '^\s*|>.*$'  let s:ending_with_assignment = '=\s*$' -let s:indent_keywords   = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow +let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow  let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow -let s:pair_start  = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after -let s:pair_middle = '\<\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs' -let s:pair_end    = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs' - -let s:inside_block = 0 - -function! GetElixirIndent() -  let lnum = prevnonblank(v:lnum - 1) - -  " At the start of the file use zero indent. -  if lnum == 0 -    return 0 -  endif - -  let opened_symbol = 0 -  let current_line  = getline(v:lnum) -  let last_line     = getline(lnum) -  let ind           = indent(lnum) +let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after +let s:pair_middle = '^\s*\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs' +let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs' +function! s:is_indentable_syntax()    " TODO: Remove these 2 lines    " I don't know why, but for the test on spec/indent/lists_spec.rb:24.    " Vim is making some mess on parsing the syntax of 'end', it is being    " recognized as 'elixirString' when should be recognized as 'elixirBlock'. +  call synID(s:current_line_ref, 1, 1)    " This forces vim to sync the syntax. -  call synID(v:lnum, 1, 1)    syntax sync fromstart -  if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax - -    if last_line !~ s:arrow -      let split_line = split(last_line, '\zs') -      let opened_symbol += count(split_line, '(') - count(split_line, ')') -      let opened_symbol += count(split_line, '[') - count(split_line, ']') -      let opened_symbol += count(split_line, '{') - count(split_line, '}') -    end +  return synIDattr(synID(s:current_line_ref, 1, 1), "name") +        \ !~ s:skip_syntax +endfunction -    " if start symbol is followed by a character, indent based on the -    " whitespace after the symbol, otherwise use the default shiftwidth -    if last_line =~ '\('.s:symbols_start.'\).' -      let opened_prefix = matchlist(last_line, '\('.s:symbols_start.'\)\s*')[0] -      let ind += (opened_symbol * strlen(opened_prefix)) +function! s:indent_opened_symbol(ind) +  if s:opened_symbol > 0 +    if s:pending_parenthesis > 0 +          \ && s:last_line !~ '^\s*def' +          \ && s:last_line !~ s:arrow +      let b:old_ind = a:ind +      return matchend(s:last_line, '(') +      " if start symbol is followed by a character, indent based on the +      " whitespace after the symbol, otherwise use the default shiftwidth +      " Avoid negative indentation index +    elseif s:last_line =~ '\('.s:symbols_start.'\).' +      let regex = '\('.s:symbols_start.'\)\s*' +      let opened_prefix = matchlist(s:last_line, regex)[0] +      return a:ind + (s:opened_symbol * strlen(opened_prefix))      else -      let ind += (opened_symbol * &sw) -    endif - -    if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords -      let ind += &sw -    endif +      return a:ind + (s:opened_symbol * &sw) +    end +  elseif s:opened_symbol < 0 +    let ind = get(b:, 'old_ind', a:ind + (s:opened_symbol * &sw)) +    let ind = float2nr(ceil(floor(ind)/&sw)*&sw) +    return ind <= 0 ? 0 : ind +  else +    return a:ind +  end +endfunction -    if current_line =~ '^\s*\('.s:symbols_end.'\)' -      let ind -= &sw -    endif +function! s:indent_last_line_end_symbol_or_indent_keyword(ind) +  if s:last_line =~ '^\s*\('.s:symbols_end.'\)' +        \ || s:last_line =~ s:indent_keywords +    return a:ind + &sw +  else +    return a:ind +  end +endfunction -    if last_line =~ s:ending_with_assignment && opened_symbol == 0 -      let b:old_ind = indent(lnum) -      let ind += &sw -    end +function! s:indent_symbols_ending(ind) +  if s:current_line =~ '^\s*\('.s:symbols_end.'\)' +    return a:ind - &sw +  else +    return a:ind +  end +endfunction -    " if line starts with pipeline -    " and last line ends with a pipeline, -    " align them -    if last_line =~ '|>.*$' && -          \ current_line =~ s:starts_with_pipeline -      let ind = float2nr(match(last_line, '|>') / &sw) * &sw +function! s:indent_assignment(ind) +  if s:last_line =~ s:ending_with_assignment +    let b:old_ind = indent(s:last_line_ref) " FIXME: side effect +    return a:ind + &sw +  else +    return a:ind +  end +endfunction +function! s:indent_pipeline(ind) +  if s:last_line =~ s:starts_with_pipeline +        \ && s:current_line =~ s:starts_with_pipeline +    indent(s:last_line_ref) +  elseif s:current_line =~ s:starts_with_pipeline +        \ && s:last_line =~ '^[^=]\+=.\+$' +    let b:old_ind = indent(s:last_line_ref)      " if line starts with pipeline      " and last line is an attribution      " indents pipeline in same level as attribution -    elseif current_line =~ s:starts_with_pipeline && -          \ last_line =~ '^[^=]\+=.\+$' - -      if !exists('b:old_ind') || b:old_ind == 0 -        let b:old_ind = indent(lnum) -      end -      let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw -    endif - -    " if last line starts with pipeline -    " and current line doesn't start with pipeline -    " returns the indentation before the pipeline -    if last_line =~ s:starts_with_pipeline && -          \ current_line !~ s:starts_with_pipeline -      let ind = b:old_ind -    endif - -    if current_line =~ s:deindent_keywords -      let bslnum = searchpair( -            \ s:pair_start, -            \ s:pair_middle, -            \ s:pair_end, -            \ 'nbW', -            \ s:block_skip -            \ ) - -      let ind = indent(bslnum) -    endif +    return match(s:last_line, '=\s*\zs[^ ]') +  else +    return a:ind +  end +endfunction + +function! s:indent_after_pipeline(ind) +  if s:last_line =~ s:starts_with_pipeline +    if empty(substitute(s:current_line, ' ', '', 'g')) +          \ || s:current_line =~ s:starts_with_pipeline +      return indent(s:last_line_ref) +    elseif s:last_line !~ s:indent_keywords +      return b:old_ind +    else +      return a:ind +    end +  else +    return a:ind +  end +endfunction + +function! s:deindent_keyword(ind) +  if s:current_line =~ s:deindent_keywords +    let bslnum = searchpair( +          \ s:pair_start, +          \ s:pair_middle, +          \ s:pair_end, +          \ 'nbW', +          \ s:block_skip +          \ ) + +    return indent(bslnum) +  else +    return a:ind +  end +endfunction +function! s:indent_arrow(ind) +  if s:current_line =~ s:arrow      " indent case statements '->' -    if current_line =~ s:arrow -      let ind += &sw -    endif -  endif +    return a:ind + &sw +  else +    return a:ind +  end +endfunction -  return ind +function! GetElixirIndent() +  let s:current_line_ref = v:lnum +  let s:last_line_ref = prevnonblank(s:current_line_ref - 1) +  let s:current_line = getline(s:current_line_ref) +  let s:last_line = getline(s:last_line_ref) +  let s:pending_parenthesis = 0 +  let s:opened_symbol = 0 + +  if s:last_line !~ s:arrow +    let splitted_line = split(s:last_line, '\zs') +    let s:pending_parenthesis = +          \ + count(splitted_line, '(') - count(splitted_line, ')') +    let s:opened_symbol = +          \ + s:pending_parenthesis +          \ + count(splitted_line, '[') - count(splitted_line, ']') +          \ + count(splitted_line, '{') - count(splitted_line, '}') +  end + +  if s:last_line_ref == 0 +    " At the start of the file use zero indent. +    return 0 +  elseif !s:is_indentable_syntax() +    " Current syntax is not indentable, keep last line indentation +    return indent(s:last_line_ref) +  else +    let ind = indent(s:last_line_ref) +    let ind = s:indent_opened_symbol(ind) +    let ind = s:indent_symbols_ending(ind) +    let ind = s:indent_pipeline(ind) +    let ind = s:indent_after_pipeline(ind) +    let ind = s:indent_assignment(ind) +    let ind = s:indent_last_line_end_symbol_or_indent_keyword(ind) +    let ind = s:deindent_keyword(ind) +    let ind = s:indent_arrow(ind) +    return ind +  end  endfunction  let &cpo = s:cpo_save diff --git a/indent/eruby.vim b/indent/eruby.vim index 82313a08..3736f529 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -43,6 +43,10 @@ if exists("*GetErubyIndent")    finish  endif +" this file uses line continuations +let s:cpo_sav = &cpo +set cpo&vim +  function! GetErubyIndent(...)    " The value of a single shift-width    if exists('*shiftwidth') @@ -101,6 +105,9 @@ function! GetErubyIndent(...)    return ind  endfunction +let &cpo = s:cpo_sav +unlet! s:cpo_sav +  " vim:set sw=2 sts=2 ts=8 noet:  endif diff --git a/indent/haskell.vim b/indent/haskell.vim index 7aa94367..ebdab5e7 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -63,15 +63,32 @@ setlocal indentexpr=GetHaskellIndent()  setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>  function! s:isInBlock(hlstack) -  return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 +  return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1 +endfunction + +function! s:stripTrailingComment(line) +  if a:line =~ '^\s*--\(-\+\|\s\+\)' || a:line =~ '^\s*{-' +    return a:line +  else +    let l:stripped = split(a:line, '-- ') +    if len(l:stripped) > 1 +      return substitute(l:stripped[0], '\s*$', '', '') +    else +      return a:line +    endif +  endif +endfunction + +function! s:isSYN(grp, line, col) +  return index(s:getHLStack(a:line, a:col), a:grp) != -1  endfunction  function! s:getNesting(hlstack) -  return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens"') +  return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens" || v:val == "haskellBlockComment" || v:val == "haskellPragma" ')  endfunction -function! s:getHLStack() -  return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') +function! s:getHLStack(line, col) +  return map(synstack(a:line, a:col), 'synIDattr(v:val, "name")')  endfunction  " indent matching character @@ -110,14 +127,14 @@ function! s:indentGuard(pos, prevline)  endfunction  function! GetHaskellIndent() -  let l:hlstack = s:getHLStack() +  let l:hlstack = s:getHLStack(line('.'), col('.'))    " do not indent in strings and quasiquotes    if index(l:hlstack, 'haskellQuasiQuote') > -1 || index(l:hlstack, 'haskellBlockComment') > -1      return -1    endif -  let l:prevline = getline(v:lnum - 1) +  let l:prevline = s:stripTrailingComment(getline(v:lnum - 1))    let l:line     = getline(v:lnum)    " indent multiline strings @@ -138,6 +155,9 @@ function! GetHaskellIndent()    if l:line =~ '^\s*--'      return match(l:prevline, '-- ')    endif +  if l:prevline =~ '^\s*--' +    return match(l:prevline, '\S') +  endif    "   { foo :: Int    " >>, @@ -149,14 +169,18 @@ function! GetHaskellIndent()      if s:isInBlock(l:hlstack)        normal! 0        call search(',', 'cW') -      let l:n = s:getNesting(s:getHLStack()) +      let l:n = s:getNesting(s:getHLStack(line('.'), col('.')))        call search('[([{]', 'bW') +      let l:cl = line('.') +      let l:cc = col('.') -      while l:n != s:getNesting(s:getHLStack()) +      while l:n != s:getNesting(s:getHLStack(l:cl, l:cc)) || s:isSYN('haskellString', l:cl, l:cc) || s:isSYN('haskellChar', l:cl, l:cc)          call search('[([{]', 'bW') +        let l:cl = line('.') +        let l:cc = col('.')        endwhile -      return col('.') - 1 +      return l:cc - 1      else        let l:s = s:indentGuard(match(l:line, ','), l:prevline)        if l:s > -1 @@ -192,11 +216,20 @@ function! GetHaskellIndent()    " >>>>y = 2    if l:prevline =~ '\C\<let\>\s\+.\+$'      if l:line =~ '\C^\s*\<let\>' -      return match(l:prevline, '\C\<let\>') +      let l:s = match(l:prevline, '\C\<let\>') +      if s:isSYN('haskellLet', v:lnum - 1, l:s + 1) +        return l:s +      endif      elseif l:line =~ '\C^\s*\<in\>' -      return match(l:prevline, '\C\<let\>') + g:haskell_indent_in +      let l:s = match(l:prevline, '\C\<let\>') +      if s:isSYN('haskellLet', v:lnum - 1, l:s + 1) +        return l:s + g:haskell_indent_in +      endif      else -      return match(l:prevline, '\C\<let\>') + g:haskell_indent_let +      let l:s = match(l:prevline, '\C\<let\>') +      if s:isSYN('haskellLet', v:lnum - 1, l:s + 1) +        return l:s + g:haskell_indent_let +      endif      endif    endif @@ -225,20 +258,13 @@ function! GetHaskellIndent()      return match(l:prevline, '\S') + &shiftwidth    endif -  "" where foo -  "" >>>>>>bar -  if l:prevline =~ '\C\<where\>\s\+\S\+.*$' -    if  l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: ' -      return match(l:prevline, ':: ') -    else -      return match(l:prevline, '\C\<where\>') + g:haskell_indent_where -  endif -  endif -    " do foo    " >>>bar    if l:prevline =~ '\C\<do\>\s\+\S\+.*$' -    return match(l:prevline, '\C\<do\>') + g:haskell_indent_do +    let l:s = match(l:prevline, '\C\<do\>') +    if s:isSYN('haskellKeyword', v:lnum - 1, l:s + 1) +      return l:s + g:haskell_indent_do +    endif    endif    " case foo of @@ -247,6 +273,19 @@ function! GetHaskellIndent()      return match(l:prevline, '\C\<case\>') + g:haskell_indent_case    endif +  "" where foo +  "" >>>>>>bar +  if l:prevline =~ '\C\<where\>\s\+\S\+.*$' +    if  l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: ' +      return match(l:prevline, ':: ') +    else +      let l:s = match(l:prevline, '\C\<where\>') +      if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1) +        return l:s + g:haskell_indent_where +      endif +    endif +  endif +    " newtype Foo = Foo    " >>deriving    if l:prevline =~ '\C\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>' diff --git a/indent/javascript.vim b/indent/javascript.vim index add0dfb1..e8573790 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -2,26 +2,26 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==  " Vim indent file  " Language: Javascript -" Maintainer:   vim-javascript community -" URL:          https://github.com/pangloss/vim-javascript -" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org +" Maintainer: vim-javascript community +" URL: https://github.com/pangloss/vim-javascript +" Last Change: August 20, 2016  " Only load this indent file when no other was loaded. -if exists("b:did_indent") +if exists('b:did_indent')    finish  endif  let b:did_indent = 1  " Now, set up our indentation expression and keys that trigger it.  setlocal indentexpr=GetJavascriptIndent() -setlocal nolisp +setlocal nolisp noautoindent nosmartindent  setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e  setlocal cinoptions+=j1,J1 -let b:undo_indent = 'setlocal indentexpr< indentkeys< cinoptions<' +let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< cinoptions<'  " Only define the function once. -if exists("*GetJavascriptIndent") +if exists('*GetJavascriptIndent')    finish  endif @@ -30,125 +30,120 @@ set cpo&vim  " Get shiftwidth value  if exists('*shiftwidth') -  func s:sw() +  function s:sw()      return shiftwidth() -  endfunc +  endfunction  else -  func s:sw() +  function s:sw()      return &sw -  endfunc +  endfunction  endif -let s:line_pre = '^\s*\%(\/\*.*\*\/\s*\)*' -let s:expr_case = s:line_pre . '\%(\%(case\>.*\)\|default\)\s*:\C' +let s:line_pre = '^\s*\%(\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\=\)\@>' +let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:'  " Regex of syntax group names that are or delimit string or are comments. -let s:syng_strcom = '\%(string\|regex\|special\|doc\|comment\|template\)\c' +let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'  " Regex of syntax group names that are strings or documentation. -let s:syng_comment = '\%(comment\|doc\)\c' +let s:syng_comment = '\%(comment\|doc\)'  " Expression used to check whether we should skip a match with searchpair(). -let s:skip_expr = "line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : s:IsSyn(line('.'),col('.'),'')" +let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'" -func s:lookForParens(start,end,flags,time) -  try -    return searchpair(a:start,'',a:end,a:flags,s:skip_expr,0,a:time) -  catch /E118/ -    return searchpair(a:start,'',a:end,a:flags,0,0) -  endtry -endfunc +if has('reltime') +  function s:GetPair(start,end,flags,time) +    return searchpair(a:start,'',a:end,a:flags,s:skip_expr,max([prevnonblank(v:lnum) - 2000,0]),a:time) +  endfunction +else +  function s:GetPair(start,end,flags,n) +    return searchpair(a:start,'',a:end,a:flags,0,max([prevnonblank(v:lnum) - 2000,0])) +  endfunction +endif -let s:line_term = '\s*\%(\%(:\@<!\/\/.*\)\=\|\%(\/\*.*\*\/\s*\)*\)$' +let s:line_term = '\s*\%(\%(\/\%(\%(\*.\{-}\*\/\)\|\%(\*\+\)\)\)\s*\)\=$'  " configurable regexes that define continuation lines, not including (, {, or [.  if !exists('g:javascript_opfirst') -  let g:javascript_opfirst = '\%([,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)\C' +  let g:javascript_opfirst = '\%([<>,:?^%|*&]\|\([-/.+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'  endif -let g:javascript_opfirst = s:line_pre . g:javascript_opfirst -  if !exists('g:javascript_continuation') -  let g:javascript_continuation = '\%([*,.?:^%]\|+\@<!+\|-\@<!-\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)\C' +  let g:javascript_continuation = '\%([<=,.?/*:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'  endif + +let g:javascript_opfirst = s:line_pre . g:javascript_opfirst  let g:javascript_continuation .= s:line_term -function s:Onescope(lnum,text,add) -  return a:text =~ '\%(\<else\|\<do\|=>' . (a:add ? '\|\<try\|\<finally' : '' ) . '\)\C' . s:line_term || -        \ (a:add && a:text =~ s:line_pre . s:line_term && getline(s:PrevCodeLine(a:lnum - 1)) =~ ')' . s:line_term) || -        \ (cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1 && -        \ s:lookForParens('(', ')', 'cbW', 100) > 0 && -        \ search((a:add ? '\%(function\*\|[A-Za-z_$][0-9A-Za-z_$]*\)\C' : -        \ '\<\%(for\%(\s+each\)\=\|if\|let\|switch\|while\|with\)\C') . '\_s*\%#','bW')) && -        \ (a:add || (expand("<cword>") == 'while' ? !s:lookForParens('\<do\>\C', '\<while\>\C','bW',100) : 1)) +function s:OneScope(lnum,text,add) +  return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' : +        \ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) || +        \ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) && +        \ s:GetPair('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') && +        \ (a:add || ((expand('<cword>') !=# 'while' || !s:GetPair('\C\<do\>', '\C\<while\>','nbW',100)) && +        \ expand('cword') !=# 'each' || search('\C\<for\_s\+\%#','nbW'))) ? expand('<cword>') : ''  endfunction -" Auxiliary Functions {{{2 - -" Check if the character at lnum:col is inside a string, comment, or is ascii. -function s:IsSyn(lnum, col, reg) -  return synIDattr(synID(a:lnum, a:col, 1), 'name') =~? (a:reg != '' ? a:reg : s:syng_strcom) +" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader +function s:IsBlock() +  return getline(line('.'))[col('.')-1] == '{' && !search( +        \ '\C\%(\<return\s*\|\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\)\%#','bnW') && +        \ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock()))  endfunction +" Auxiliary Functions {{{2 +  " Find line above 'lnum' that isn't empty, in a comment, or in a string.  function s:PrevCodeLine(lnum) -  let lnum = prevnonblank(a:lnum) -  while lnum > 0 -    if !s:IsSyn(lnum, matchend(getline(lnum), '^\s*[^''"]'),'') -      break +  let l:lnum = prevnonblank(a:lnum) +  while l:lnum +    if synIDattr(synID(l:lnum,matchend(getline(l:lnum), '^\s*[^''"]'),0),'name') !~? s:syng_strcom +      return l:lnum      endif -    let lnum = prevnonblank(lnum - 1) +    let l:lnum = prevnonblank(l:lnum - 1)    endwhile -  return lnum  endfunction -" Check if line 'lnum' has more opening brackets than closing ones. -function s:LineHasOpeningBrackets(lnum) -  let open_0 = 0 -  let open_2 = 0 -  let open_4 = 0 -  let line = getline(a:lnum) -  let pos = match(line, '[][(){}]', 0) -  let last = 0 +" Check if line 'lnum' has a balanced amount of parentheses. +function s:Balanced(lnum) +  let [open_0,open_2,open_4] = [0,0,0] +  let l:line = getline(a:lnum) +  let pos = match(l:line, '[][(){}]', 0)    while pos != -1 -    if !s:IsSyn(a:lnum, pos + 1, '') -      let idx = stridx('(){}[]', line[pos]) +    if synIDattr(synID(a:lnum,pos + 1,0),'name') !~? s:syng_strcom +      let idx = stridx('(){}[]', l:line[pos])        if idx % 2 == 0          let open_{idx} = open_{idx} + 1 -        let last = pos        else          let open_{idx - 1} = open_{idx - 1} - 1        endif      endif -    let pos = match(line, '[][(){}]', pos + 1) +    let pos = match(l:line, '[][(){}]', pos + 1)    endwhile -  return [(open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2)) . (open_2 > 0 ? 1 : (open_2 == 0 ? 0 : 2)) . -        \ (open_4 > 0 ? 1 : (open_4 == 0 ? 0 : 2)), last] +  return (!open_4 + !open_2 + !open_0) - 2  endfunction  " }}}  function GetJavascriptIndent()    if !exists('b:js_cache')      let b:js_cache = [0,0,0] -  end -  " Get the current line. -  let line = getline(v:lnum) -  " previous nonblank line number -  let prevline = prevnonblank(v:lnum - 1) -  " previous line of code -  let lnum = s:PrevCodeLine(v:lnum - 1) -  if lnum == 0 -    return 0    endif +  " Get the current line. +  let l:line = getline(v:lnum) +  let syns = synIDattr(synID(v:lnum, 1, 0), 'name')    " start with strings,comments,etc.{{{2 -  if (line !~ '^[''"`]' && s:IsSyn(v:lnum,1,'string\|template')) || -        \ (line !~ '^\s*[/*]' && s:IsSyn(v:lnum,1,s:syng_comment)) +  if (l:line !~ '^[''"`]' && syns =~? '\%(string\|template\)') || +        \ (l:line !~ '^\s*[/*]' && syns =~? s:syng_comment)      return -1    endif -  if line !~ '^\%(\/\*\|\s*\/\/\)' && s:IsSyn(v:lnum,1,s:syng_comment) +  if l:line !~ '^\%(\/\*\|\s*\/\/\)' && syns =~? s:syng_comment      return cindent(v:lnum)    endif +  let l:lnum = s:PrevCodeLine(v:lnum - 1) +  if l:lnum == 0 +    return 0 +  endif -  if (line =~ s:expr_case) +  if (l:line =~# s:expr_case)      let cpo_switch = &cpo      set cpo+=%      let ind = cindent(v:lnum) @@ -157,41 +152,42 @@ function GetJavascriptIndent()    endif    "}}} -  " the containing paren, bracket, curly -  let pcounts = [0] -  if b:js_cache[0] >= lnum  && b:js_cache[0] <= v:lnum && b:js_cache[0] && -        \ (b:js_cache[0] > lnum || map(pcounts,'s:LineHasOpeningBrackets(lnum)')[0][0] !~ '2') -    let num = pcounts[0][0] =~ '1' ? lnum : b:js_cache[1] -    if pcounts[0][0] =~'1' -      call cursor(lnum,pcounts[0][1]) -    end +  " the containing paren, bracket, curly. Memoize, last lineNr either has the +  " same scope or starts a new one, unless if it closed a scope. +  call cursor(v:lnum,1) +  if b:js_cache[0] >= l:lnum  && b:js_cache[0] < v:lnum && b:js_cache[0] && +        \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum) > 0) +    let num = b:js_cache[1] +  elseif syns != '' && l:line[0] =~ '\s' +    let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] : +          \ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]'] +    let num = s:GetPair(pattern[0],pattern[1],'bW',2000)    else -    call cursor(v:lnum,1) -    let syns = synIDattr(synID(v:lnum, 1, 1), 'name') -    if line[0] =~ '\s' && syns != '' -      let pattern = syns =~? 'funcblock' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] : syns =~? 'jsbracket'? ['\[','\]'] : -            \ ['(\|{\|\[',')\|}\|\]'] -      let num = s:lookForParens(pattern[0],pattern[1],'bW',2000) -    else -      let num = s:lookForParens('(\|{\|\[',')\|}\|\]','bW',2000) -    end -  end +    let num = s:GetPair('[({[]','[])}]','bW',2000) +  endif    let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')] -  " most significant part -  if line =~ s:line_pre . '[])}]' +  if l:line =~ s:line_pre . '[])}]'      return indent(num) -  end -  let inb = num == 0 ? 1 : s:Onescope(num, strpart(getline(num),0,b:js_cache[2] - 1),1) -  let switch_offset = (!inb || num == 0) || expand("<cword>") != 'switch' ? 0 : &cino !~ ':' || !has('float') ?  s:sw() : -        \ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (match(&cino,'.*:\zs[^,]*s') ? s:sw() : 1)) -  if ((line =~ g:javascript_opfirst || -        \ (getline(lnum) =~ g:javascript_continuation && getline(lnum) !~ s:expr_case)) && -        \ inb) || (s:Onescope(lnum,getline(lnum),0) && line !~ s:line_pre . '{') +  endif + +  call cursor(b:js_cache[1],b:js_cache[2]) + +  let swcase = getline(l:lnum) =~# s:expr_case +  let pline = swcase ? getline(l:lnum) : substitute(getline(l:lnum), '\%(:\@<!\/\/.*\)$', '','') +  let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock()) +  let switch_offset = num == 0 || s:OneScope(num, strpart(getline(num),0,b:js_cache[2] - 1),1) !=# 'switch' ? 0 : +        \ &cino !~ ':' || !has('float') ?  s:sw() : +        \ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1)) + +  " most significant, find the indent amount +  if inb && !swcase && ((l:line =~# g:javascript_opfirst || pline =~# g:javascript_continuation) || +        \ num < l:lnum && s:OneScope(l:lnum,pline,0) =~# '\<\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)\>' && +        \ l:line !~ s:line_pre . '{')      return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset    elseif num > 0      return indent(num) + s:sw() + switch_offset -  end +  endif  endfunction diff --git a/indent/perl6.vim b/indent/perl6.vim deleted file mode 100644 index 78c6011d..00000000 --- a/indent/perl6.vim +++ /dev/null @@ -1,131 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 -   -" Vim indent file -" Language:      Perl 6 -" Maintainer:    vim-perl <vim-perl@googlegroups.com> -" Homepage:      http://github.com/vim-perl/vim-perl -" Bugs/requests: http://github.com/vim-perl/vim-perl/issues -" Last Change:   {{LAST_CHANGE}} -" Contributors:  Andy Lester <andy@petdance.com> -"                Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> -" -" Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr> - -" Suggestions and improvements by : -"   Aaron J. Sherman (use syntax for hints) -"   Artem Chuprina (play nice with folding) -" TODO: -" This file still relies on stuff from the Perl 5 syntax file, which Perl 6 -" does not use. -" -" Things that are not or not properly indented (yet) : -" - Continued statements -"     print "foo", -"       "bar"; -"     print "foo" -"       if bar(); -" - Multiline regular expressions (m//x) -" (The following probably needs modifying the perl syntax file) -" - qw() lists -" - Heredocs with terminators that don't match \I\i* - -" Only load this indent file when no other was loaded. -if exists("b:did_indent") -    finish -endif -let b:did_indent = 1 - -" Is syntax highlighting active ? -let b:indent_use_syntax = has("syntax") - -setlocal indentexpr=GetPerl6Indent() - -" we reset it first because the Perl 5 indent file might have been loaded due -" to a .pl/pm file extension, and indent files don't clean up afterwards -setlocal indentkeys& - -setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and -if !b:indent_use_syntax -    setlocal indentkeys+=0=EO -endif - -let s:cpo_save = &cpo -set cpo-=C - -function! GetPerl6Indent() - -    " Get the line to be indented -    let cline = getline(v:lnum) - -    " Indent POD markers to column 0 -    if cline =~ '^\s*=\L\@!' -        return 0 -    endif - -    " Get current syntax item at the line's first char -    let csynid = '' -    if b:indent_use_syntax -        let csynid = synIDattr(synID(v:lnum,1,0),"name") -    endif - -    " Don't reindent POD and heredocs -    if csynid =~ "^p6Pod" -        return indent(v:lnum) -    endif - - -    " Now get the indent of the previous perl line. - -    " Find a non-blank line above the current line. -    let lnum = prevnonblank(v:lnum - 1) -    " Hit the start of the file, use zero indent. -    if lnum == 0 -        return 0 -    endif -    let line = getline(lnum) -    let ind = indent(lnum) -    " Skip heredocs, POD, and comments on 1st column -    if b:indent_use_syntax -        let skippin = 2 -        while skippin -            let synid = synIDattr(synID(lnum,1,0),"name") -            if (synid =~ "^p6Pod" || synid =~ "p6Comment") -                let lnum = prevnonblank(lnum - 1) -                if lnum == 0 -                    return 0 -                endif -                let line = getline(lnum) -                let ind = indent(lnum) -                let skippin = 1 -            else -                let skippin = 0 -            endif -        endwhile -    endif - -        if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$' -            let ind = ind + &sw -        endif -        if cline =~ '^\s*[)}\]»>]' -            let ind = ind - &sw -        endif - -    " Indent lines that begin with 'or' or 'and' -    if cline =~ '^\s*\(or\|and\)\>' -        if line !~ '^\s*\(or\|and\)\>' -            let ind = ind + &sw -        endif -    elseif line =~ '^\s*\(or\|and\)\>' -        let ind = ind - &sw -    endif - -    return ind - -endfunction - -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim:ts=8:sts=4:sw=4:expandtab:ft=vim - -endif diff --git a/indent/plantuml.vim b/indent/plantuml.vim new file mode 100644 index 00000000..3e0f455d --- /dev/null +++ b/indent/plantuml.vim @@ -0,0 +1,58 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1 +   +if exists("b:did_indent") +  finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetPlantUMLIndent() +setlocal indentkeys=o,O,<CR>,<:>,!^F,0end,0else,} + +" only define the indent code once +if exists("*GetPlantUMLIndent") +  finish +endif + +let s:incIndent = +            \ '^\s*\(loop\|alt\|opt\|group\|critical\|else\|legend\|box\)\>\|' . +            \ '^\s*\([hr]\?note\|ref\)\>[^:]*$\|' . +            \ '^\s*title\s*$\|' . +            \ '^\s*skinparam\>.*{\s*$\|' . +            \ '^\s*state\>.*{' + +let s:decIndent = '^\s*\(end\|else\|}\)' + +function! GetPlantUMLIndent(...) abort +    "for current line, use arg if given or v:lnum otherwise +    let clnum = a:0 ? a:1 : v:lnum + +    if !s:insidePlantUMLTags(clnum) +        return indent(clnum) +    endif + +    let pnum = prevnonblank(clnum-1) +    let pindent = indent(pnum)  +    let pline = getline(pnum) +    let cline = getline(clnum) + +    if cline =~ s:decIndent +        if pline =~ s:incIndent +            return pindent +        else +            return pindent - shiftwidth() +        endif + +    elseif pline =~ s:incIndent +        return pindent + shiftwidth() +    endif + +    return pindent + +endfunction + +function! s:insidePlantUMLTags(lnum) abort +    call cursor(a:lnum, 1) +    return search('@startuml', 'Wbn') && search('@enduml', 'Wn') +endfunction + +endif diff --git a/indent/ruby.vim b/indent/ruby.vim index da622c1c..8d8fa2e9 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -94,11 +94,12 @@ let s:end_skip_expr = s:skip_expr .        \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'  " Regex that defines continuation lines, not including (, {, or [. -let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +let s:non_bracket_continuation_regex = +      \ '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$'  " Regex that defines continuation lines.  let s:continuation_regex = -      \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +      \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$'  " Regex that defines continuable keywords  let s:continuable_regex = @@ -108,6 +109,12 @@ let s:continuable_regex =  " Regex that defines bracket continuations  let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$' +" Regex that defines dot continuations +let s:dot_continuation_regex = '%\@<!\.\s*\%(#.*\)\=$' + +" Regex that defines backslash continuations +let s:backslash_continuation_regex = '%\@<!\\\s*$' +  " Regex that defines end of bracket continuation followed by another continuation  let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex @@ -196,7 +203,17 @@ function s:GetMSL(lnum)      " Otherwise, terminate search as we have found our MSL already.      let line = getline(lnum) -    if s:Match(msl, s:leading_operator_regex) +    if !s:Match(msl, s:backslash_continuation_regex) && +          \ s:Match(lnum, s:backslash_continuation_regex) +      " If the current line doesn't end in a backslash, but the previous one +      " does, look for that line's msl +      " +      " Example: +      "   foo = "bar" \ +      "     "baz" +      " +      let msl = lnum +    elseif s:Match(msl, s:leading_operator_regex)        " If the current line starts with a leading operator, keep its indent        " and keep looking for an MSL.        let msl = lnum @@ -221,18 +238,30 @@ function s:GetMSL(lnum)        "     three        "        let msl = lnum +    elseif s:Match(lnum, s:dot_continuation_regex) && +          \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex)) +      " If the current line is a bracket continuation or a block-starter, but +      " the previous is a dot, keep going to see if the previous line is the +      " start of another continuation. +      " +      " Example: +      "   parent. +      "     method_call { +      "     three +      " +      let msl = lnum      elseif s:Match(lnum, s:non_bracket_continuation_regex) &&            \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))        " If the current line is a bracket continuation or a block-starter, but -      " the previous is a non-bracket one, keep going to see if the previous -      " line is a part of another continuation. +      " the previous is a non-bracket one, respect the previous' indentation, +      " and stop here.        "        " Example:        "   method_call one,        "     two {        "     three        " -      let msl = lnum +      return lnum      elseif s:Match(lnum, s:bracket_continuation_regex) &&            \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))        " If both lines are bracket continuations (the current may also be a diff --git a/indent/scala.vim b/indent/scala.vim index 6f5d1da9..da6c2f5c 100644 --- a/indent/scala.vim +++ b/indent/scala.vim @@ -378,12 +378,17 @@ function! GetScalaIndent()    let prevline = scala#GetLine(prevlnum)    let curlnum = v:lnum    let curline = scala#GetLine(curlnum) +  if get(g:, 'scala_scaladoc_indent', 0) +    let star_indent = 2 +  else +    let star_indent = 1 +  end    if prevline =~ '^\s*/\*\*'      if prevline =~ '\*/\s*$'        return ind      else -      return ind + 1 +      return ind + star_indent      endif    endif @@ -538,7 +543,7 @@ function! GetScalaIndent()    if prevline =~ '^\s*\*/'     \ || prevline =~ '*/\s*$'      call scala#ConditionalConfirm("18") -    let ind = ind - 1 +    let ind = ind - star_indent    endif    if scala#LineEndsInIncomplete(prevline) diff --git a/syntax/coffee.vim b/syntax/coffee.vim index 8688a859..38839f35 100644 --- a/syntax/coffee.vim +++ b/syntax/coffee.vim @@ -34,7 +34,7 @@ hi def link coffeeConditional Conditional  syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display  hi def link coffeeException Exception -syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\)\>/ +syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\)\>/  \                       display  " The `own` keyword is only a keyword after `for`.  syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat diff --git a/syntax/eelixir.vim b/syntax/eelixir.vim index 38dee597..febb8e8a 100644 --- a/syntax/eelixir.vim +++ b/syntax/eelixir.vim @@ -4,6 +4,9 @@ if exists("b:current_syntax")    finish  endif +let s:cpo_save = &cpo +set cpo&vim +  if !exists("main_syntax")    let main_syntax = 'eelixir'  endif @@ -62,4 +65,7 @@ if main_syntax == 'eelixir'    unlet main_syntax  endif +let &cpo = s:cpo_save +unlet s:cpo_save +  endif diff --git a/syntax/elixir.vim b/syntax/elixir.vim index 3e964f0c..12223577 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -4,16 +4,22 @@ if exists("b:current_syntax")    finish  endif +let s:cpo_save = &cpo +set cpo&vim +  " syncing starts 2000 lines before top line so docstrings don't screw things up  syn sync minlines=2000  syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition +syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation +syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass +syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration -syn match elixirComment '#.*' contains=elixirTodo,@Spell +syn match elixirComment '^\s*#.*' contains=elixirTodo,@Spell  syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained  syn keyword elixirKeyword case when with cond for if unless try receive send -syn keyword elixirKeyword exit raise throw after rescue catch else +syn keyword elixirKeyword do end exit raise throw after rescue catch else  syn keyword elixirKeyword quote unquote super spawn spawn_link spawn_monitor  " Functions used on guards @@ -73,23 +79,20 @@ syn match elixirRegexCharClass         "\[:\(alnum\|alpha\|ascii\|blank\|cntrl\|  syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxfr]*" skip="\\\\" contains=@elixirRegexSpecial -syn cluster elixirRegexSpecial    contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation -syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass - -syn region elixirString        matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'\|\\\\" contains=@elixirStringContained -syn region elixirString        matchgroup=elixirStringDelimiter start='"' end='"' skip='\\"' contains=@elixirStringContained +syn region elixirString  matchgroup=elixirStringDelimiter start=+\z('\)+   end=+\z1+ skip=+\\\\+  contains=@elixirStringContained +syn region elixirString  matchgroup=elixirStringDelimiter start=+\z("\)+   end=+\z1+ skip=+\\\\+  contains=@elixirStringContained +syn region elixirString  matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ skip=+'\|\\\\+  contains=@elixirStringContained +syn region elixirString  matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ skip=+"\|\\\\+  contains=@elixirStringContained  syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop -syn region elixirDocStringStart matchgroup=elixirDocString start=+"""+ end=+$+ oneline contains=ALLBUT,@elixirNotTop -syn region elixirDocStringStart matchgroup=elixirDocString start=+'''+ end=+$+ oneline contains=ALLBUT,@elixirNotTop -syn region elixirDocString     start=+\z("""\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation,@Spell keepend fold -syn region elixirDocString     start=+\z('''\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation,@Spell keepend fold +syn match elixirDocString +\(@\w*doc\s*\)\@<=\%("""\_.\{-}\_^\s*"""\|".\{-\}"\)+ contains=elixirTodo,elixirInterpolation,@Spell fold  syn match elixirAtomInterpolated   ':\("\)\@=' contains=elixirString  syn match elixirString             "\(\w\)\@<!?\%(\\\(x\d{1,2}\|\h{1,2}\h\@!\>\|0[0-7]{0,2}[0-7]\@!\>\|[^x0MC]\)\|(\\[MC]-)+\w\|[^\s\\]\)"  syn region elixirBlock              matchgroup=elixirBlockDefinition start="\<do\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold -syn region elixirAnonymousFunction  matchgroup=elixirBlockDefinition start="\<fn\>"         end="\<end\>" contains=ALLBUT,@elixirNotTop fold +syn region elixirElseBlock          matchgroup=elixirBlockDefinition start="\<else\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold +syn region elixirAnonymousFunction  matchgroup=elixirBlockDefinition start="\<fn\>"     end="\<end\>" contains=ALLBUT,@elixirNotTop fold  syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter @@ -140,8 +143,6 @@ syn match  elixirOverridableDeclaration "[^[:space:];#<]\+"        contained con  syn match  elixirExceptionDeclaration   "[^[:space:];#<]\+"        contained contains=elixirAlias                           skipwhite skipnl  syn match  elixirCallbackDeclaration    "[^[:space:];#<,()\[\]]\+" contained contains=elixirFunctionDeclaration             skipwhite skipnl -syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration -  hi def link elixirBlockDefinition        Keyword  hi def link elixirDefine                 Define  hi def link elixirPrivateDefine          Define @@ -157,6 +158,7 @@ hi def link elixirOverridableDefine      Define  hi def link elixirExceptionDefine        Define  hi def link elixirCallbackDefine         Define  hi def link elixirStructDefine           Define +hi def link elixirModuleDeclaration      Type  hi def link elixirFunctionDeclaration    Function  hi def link elixirMacroDeclaration       Macro  hi def link elixirInclude                Include @@ -172,7 +174,7 @@ hi def link elixirVariable               Identifier  hi def link elixirSelf                   Identifier  hi def link elixirUnusedVariable         Comment  hi def link elixirNumber                 Number -hi def link elixirDocString              String +hi def link elixirDocString              Comment  hi def link elixirAtomInterpolated       elixirAtom  hi def link elixirRegex                  elixirString  hi def link elixirRegexEscape            elixirSpecial @@ -189,4 +191,7 @@ hi def link elixirSigilDelimiter         Delimiter  let b:current_syntax = "elixir" +let &cpo = s:cpo_save +unlet s:cpo_save +  endif diff --git a/syntax/gitrebase.vim b/syntax/gitrebase.vim index 54bd3984..3a66f0a2 100644 --- a/syntax/gitrebase.vim +++ b/syntax/gitrebase.vim @@ -23,7 +23,7 @@ syn match   gitrebaseExec   "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite  syn match   gitrebaseDrop   "\v^d%(rop)=>"   nextgroup=gitrebaseCommit skipwhite  syn match   gitrebaseSummary ".*"               contains=gitrebaseHash contained  syn match   gitrebaseCommand ".*"                                      contained -syn match   gitrebaseComment "^#.*"             contains=gitrebaseHash +syn match   gitrebaseComment "^\s*#.*"             contains=gitrebaseHash  syn match   gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite  hi def link gitrebaseCommit         gitrebaseHash diff --git a/syntax/go.vim b/syntax/go.vim index 78143429..203be1f2 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -127,12 +127,14 @@ hi def link     goComplexes         Type  " Predefined functions and values -syn match       goBuiltins          /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/ -syn match       goBuiltins          /\<\v(make|new|panic|print|println|real|recover)\ze\(/ -syn keyword     goBoolean           iota true false nil +syn match       goBuiltins                 /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/ +syn match       goBuiltins                 /\<\v(make|new|panic|print|println|real|recover)\ze\(/ +syn keyword     goPredefinedIdentifiers    nil iota +syn keyword     goBoolean                  true false -hi def link     goBuiltins          Keyword -hi def link     goBoolean           Boolean +hi def link     goBuiltins                 Keyword +hi def link     goPredefinedIdentifiers    Identifier +hi def link     goBoolean                  Boolean  " Comments; their contents  syn keyword     goTodo              contained TODO FIXME XXX BUG @@ -177,7 +179,7 @@ else  endif  if g:go_highlight_format_strings != 0 -  syn match       goFormatSpecifier   /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString +  syn match       goFormatSpecifier   /\([^%]\(%%\)*\)\@<=%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString    hi def link     goFormatSpecifier   goSpecialString  endif @@ -273,6 +275,7 @@ hi def link     goSpaceError        Error  syn keyword     goTodo              contained NOTE  hi def link     goTodo              Todo +syn match goVarArgs /\.\.\./  " Operators;  if g:go_highlight_operators != 0 @@ -287,9 +290,9 @@ if g:go_highlight_operators != 0    " match remaining two-char operators: := && || <- ++ --    syn match goOperator /:=\|||\|<-\|++\|--/    " match ... -  syn match goOperator /\.\.\./ -  hi def link     goPointerOperator   Operator +  hi def link     goPointerOperator   goOperator +  hi def link     goVarArgs           goOperator  endif  hi def link     goOperator          Operator @@ -314,8 +317,7 @@ hi def link     goMethod            Type  " Fields;  if g:go_highlight_fields != 0 -  syn match goVarArgs               /\.\.\.\w\+\>/ -  syn match goField                 /\.\a\+\([\ \n\r\:\)\[]\)\@=/hs=s+1 +  syn match goField                 /\.\w\+\([.\ \n\r\:\)\[,]\)\@=/hs=s+1  endif  hi def link    goField              Identifier @@ -368,13 +370,27 @@ if g:go_highlight_build_constraints != 0    hi def link goPackageComment    Comment  endif -" :GoSameIds -hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black -  " :GoCoverage commands  hi def link goCoverageNormalText Comment -hi def      goCoverageCovered    ctermfg=green  -hi def      goCoverageUncover    ctermfg=red  + +function! s:hi() +  " :GoSameIds +  if &background == 'dark' +    hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black guibg=white guifg=black +  else +    hi def goSameId term=bold cterm=bold ctermbg=14 guibg=Cyan +  endif + +  " :GoCoverage commands +  hi def      goCoverageCovered    ctermfg=green guifg=#A6E22E +  hi def      goCoverageUncover    ctermfg=red guifg=#F92672 +endfunction + +augroup vim-go-hi +  autocmd! +  autocmd ColorScheme * call s:hi() +augroup end +call s:hi()  " Search backwards for a global declaration to start processing the syntax.  "syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ diff --git a/syntax/haskell.vim b/syntax/haskell.vim index 5133899b..b35c0225 100644 --- a/syntax/haskell.vim +++ b/syntax/haskell.vim @@ -31,7 +31,7 @@ syn match haskellTypeSig    \ haskellOperators,    \ haskellSeparator,    \ haskellParens -syn keyword haskelLWhere where +syn keyword haskellWhere where  syn keyword haskellLet let  syn keyword haskellDeclKeyword module class instance newtype deriving in  syn match haskellDecl "\<\(type\|data\)\>\s\+\(\<family\>\)\?" @@ -95,7 +95,7 @@ syn region haskellBlockComment start="{-" end="-}"    \ @Spell  syn region haskellPragma start="{-#" end="#-}"  syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained -syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-z][a-zA-z0-9_']*|" end="|\]" +syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"  syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP  syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP  syn match haskellPreProc "^#.*$" @@ -145,26 +145,21 @@ highlight def link haskellChar String  highlight def link haskellBacktick Operator  highlight def link haskellQuasiQuoted String  highlight def link haskellTodo Todo +highlight def link haskellPreProc PreProc +highlight def link haskellAssocType Type +highlight def link haskellQuotedType Type +highlight def link haskellType Type +highlight def link haskellImportKeywords Include  if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1 -  highlight def link haskellPreProc PreProc -  highlight def link haskellAssocType Type -  highlight def link haskellImportKeywords Include    highlight def link haskellDeclKeyword Keyword    highlight def link haskellDecl Keyword    highlight def link haskellWhere Keyword    highlight def link haskellLet Keyword -  highlight def link haskellQuotedType Type -  highlight def link haskellType Type  else -  highlight def link haskellPreProc Macro -  highlight def link haskellAssocType Structure -  highlight def link haskellImportKeywords Structure    highlight def link haskellDeclKeyword Structure    highlight def link haskellDecl Structure    highlight def link haskellWhere Structure    highlight def link haskellLet Structure -  highlight def link haskellQuotedType Include -  highlight def link haskellType Include  endif  if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1 diff --git a/syntax/perl6.vim b/syntax/perl6.vim deleted file mode 100644 index 35fddcd8..00000000 --- a/syntax/perl6.vim +++ /dev/null @@ -1,1967 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 -   -" Vim syntax file -" Language:      Perl 6 -" Maintainer:    vim-perl <vim-perl@googlegroups.com> -" Homepage:      http://github.com/vim-perl/vim-perl/tree/master -" Bugs/requests: http://github.com/vim-perl/vim-perl/issues -" Last Change:   {{LAST_CHANGE}} - -" Contributors:  Luke Palmer <fibonaci@babylonia.flatirons.org> -"                Moritz Lenz <moritz@faui2k3.org> -"                Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> -" -" This is a big undertaking. Perl 6 is the sort of language that only Perl -" can parse. But I'll do my best to get vim to. -" -" The ftdetect/perl11.vim file in this repository takes care of setting the -" right filetype for Perl 6 files. To set it explicitly you can also add this -" line near the bottom of your source file: -"   # vim: filetype=perl6 - -" TODO: -"   * Go over the list of keywords/types to see what's deprecated/missing -"   * Add more support for folding (:help syn-fold) -" -" If you want to have Pir code inside Q:PIR// strings highlighted, do: -"   let perl6_embedded_pir=1 -" -" The above requires pir.vim, which you can find in Parrot's repository: -" https://github.com/parrot/parrot/tree/master/editor -" -" To highlight Perl 5 regexes (m:P5//): -"   let perl6_perl5_regexes=1 -" -" To enable folding: -"   let perl6_fold=1 - -if version < 704 | throw "perl6.vim uses regex syntax which Vim <7.4 doesn't support. Try 'make fix_old_vim' in the vim-perl repository." | endif - -" 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 -endif -let s:keepcpo= &cpo -set cpo&vim - -" Patterns which will be interpolated by the preprocessor (tools/preproc.pl): -" -" @@IDENT_NONDIGIT@@     "[A-Za-z_\xC0-\xFF]" -" @@IDENT_CHAR@@         "[A-Za-z_\xC0-\xFF0-9]" -" @@IDENTIFIER@@         "\%(@@IDENT_NONDIGIT@@\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\@=\)*\)" -" @@IDENTIFIER_START@@   "@@IDENT_CHAR@@\@1<!\%(@@IDENT_NONDIGIT@@[-']\)\@2<!" -" @@IDENTIFIER_END@@     "\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\)\@!" -" @@METAOP@@             #\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+# -" @@ADVERBS@@            "\%(\_s*:!\?@@IDENTIFIER@@\%(([^)]*)\)\?\)*" -" -" Same but escaped, for use in string eval -" @@IDENT_NONDIGIT_Q@@   "[A-Za-z_\\xC0-\\xFF]" -" @@IDENT_CHAR_Q@@       "[A-Za-z_\\xC0-\\xFF0-9]" -" @@IDENTIFIER_Q@@       "\\%(@@IDENT_NONDIGIT_Q@@\\%(@@IDENT_CHAR_Q@@\\|[-']@@IDENT_NONDIGIT_Q@@\\@=\\)*\\)" -" @@IDENTIFIER_START_Q@@ "@@IDENT_CHAR_Q@@\\@1<!\\%(@@IDENT_NONDIGIT_Q@@[-']\\)\\@2<!" -" @@IDENTIFIER_END_Q@@   "\\%(@@IDENT_CHAR_Q@@\\|[-']@@IDENT_NONDIGIT_Q@@\\)\\@!" - -" Identifiers (subroutines, methods, constants, classes, roles, etc) -syn match p6Identifier display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" - -let s:keywords = { - \ "p6Include": [ - \   "use require unit", - \ ], - \ "p6Conditional": [ - \   "if else elsif unless with orwith without", - \ ], - \ "p6VarStorage": [ - \   "let my our state temp has constant", - \ ], - \ "p6Repeat": [ - \   "for loop repeat while until gather given", - \ ], - \ "p6FlowControl": [ - \   "take do when next last redo return return-rw contend maybe defer", - \   "start default exit make continue break goto leave async lift", - \ ], - \ "p6ClosureTrait": [ - \   "BEGIN CHECK INIT START FIRST ENTER LEAVE KEEP", - \   "UNDO NEXT LAST PRE POST END CATCH CONTROL TEMP", - \ ], - \ "p6Exception": [ - \   "die fail try warn", - \ ], - \ "p6Pragma": [ - \   "oo fatal", - \ ], - \ "p6Operator": [ - \   "div xx x mod also leg cmp before after eq ne le lt not", - \   "gt ge eqv ff fff and andthen or xor orelse extra lcm gcd o", - \ ], - \ "p6Type": [ - \   "int int1 int2 int4 int8 int16 int32 int64", - \   "rat rat1 rat2 rat4 rat8 rat16 rat32 rat64", - \   "buf buf1 buf2 buf4 buf8 buf16 buf32 buf64", - \   "uint uint1 uint2 uint4 uint8 uint16 uint32 bit bool", - \   "uint64 utf8 utf16 utf32 bag set mix num complex", - \ ], -\ } - -" These can be immediately followed by parentheses -let s:types = [ - \ "Object Any Junction Whatever Capture Match", - \ "Signature Proxy Matcher Package Module Class", - \ "Grammar Scalar Array Hash KeyHash KeySet KeyBag", - \ "Pair List Seq Range Set Bag Map Mapping Void Undef", - \ "Failure Exception Code Block Routine Sub Macro", - \ "Method Submethod Regex Str Blob Char Byte Parcel", - \ "Codepoint Grapheme StrPos StrLen Version Num", - \ "Complex Bit True False Order Same Less More", - \ "Increasing Decreasing Ordered Callable AnyChar", - \ "Positional Associative Ordering KeyExtractor", - \ "Comparator OrderingPair IO KitchenSink Role", - \ "Int Rat Buf UInt Abstraction Numeric Real", - \ "Nil Mu", -\ ] - -" We explicitly enumerate the alphanumeric infix operators allowed after [RSXZ] -" to avoid matching package names that start with those letters. -let s:alpha_metaops = [ - \ "div mod gcd lcm xx x does but cmp leg eq ne gt ge lt le before after eqv", - \ "min max not so andthen and or orelse", -\ ] -let s:words_space = join(s:alpha_metaops, " ") -let s:temp = split(s:words_space) -let s:alpha_metaops_or = join(s:temp, "\\|") - -" We don't use "syn keyword" here because that always has higher priority -" than matches/regions, which would prevent these words from matching as -" autoquoted strings before "=>" or "p5=>". -syn match p6KeywordStart display "\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!\)\@=[A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!" -    \ nextgroup=p6Attention,p6Variable,p6Include,p6Conditional,p6VarStorage,p6Repeat,p6FlowControl,p6ClosureTrait,p6Exception,p6Number,p6Pragma,p6Type,p6Operator,p6Identifier - -for [group, words] in items(s:keywords) -    let s:words_space = join(words, " ") -    let s:temp = split(s:words_space) -    let s:words = join(s:temp, "\\|") -    exec "syn match ". group ." display \"[.^]\\@1<!\\%(". s:words . "\\)(\\@!\\%([A-Za-z_\\xC0-\\xFF0-9]\\|[-'][A-Za-z_\\xC0-\\xFF]\\)\\@!\" contained" -endfor - -let s:words_space = join(s:types, " ") -let s:temp = split(s:words_space) -let s:words = join(s:temp, "\\|") -exec "syn match p6Type display \"\\%(". s:words . "\\)\\%([A-Za-z_\\xC0-\\xFF0-9]\\|[-'][A-Za-z_\\xC0-\\xFF]\\)\\@!\" contained" -unlet s:keywords s:types s:words_space s:temp s:words - -syn match p6PreDeclare display "[.^]\@1<!\<\%(multi\|proto\|only\)\>" nextgroup=p6Declare,p6Identifier skipwhite skipempty -syn match p6Declare display "[.^]\@1<!\<\%(macro\|sub\|submethod\|method\|category\|module\|class\|role\|package\|enum\|grammar\|slang\|subset\)\>" nextgroup=p6Identifier skipwhite skipempty -syn match p6DeclareRegex display "[.^]\@1<!\<\%(regex\|rule\|token\)\>" nextgroup=p6RegexName skipwhite skipempty - -syn match p6TypeConstraint  display "\%([.^]\|^\s*\)\@<!\a\@=\%(does\|as\|but\|trusts\|of\|returns\|handles\|where\|augment\|supersede\)\>" -syn match p6TypeConstraint  display "\%([.^]\|^\s*\)\@<![A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!is\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6Property -syn match p6Property        display "\a\@=\%(signature\|context\|also\|shape\|prec\|irs\|ofs\|ors\|export\|deep\|binary\|unary\|reparsed\|rw\|parsed\|cached\|readonly\|defequiv\|will\|ref\|copy\|inline\|tighter\|looser\|equiv\|assoc\|required\)" contained - -" packages, must come after all the keywords -syn match p6Identifier display "\%(::\)\@2<=\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)*" -syn match p6Identifier display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(::\)\@=" - -" The sigil in ::*Package -syn match p6PackageTwigil display "\%(::\)\@2<=\*" - -" some standard packages -syn match p6Type display "\%(::\)\@2<!\%(Order\%(::Same\|::More\|::Less\)\?\|Bool\%(::True\|::False\)\?\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" - -" Don't put a "\+" at the end of the character class. That makes it so -" greedy that the "%" " in "+%foo" won't be allowed to match as a sigil, -" among other things -syn match p6Operator display "[-+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅∘]" -syn match p6Operator display "\%(:\@1<!::\@2!\|::=\|\.::\)" -" these require whitespace on the left side -syn match p6Operator display "\%(\s\|^\)\@1<=\%(xx=\|p5=>\)" -" index overloading -syn match p6Operator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)" - -" Reduce metaoperators like [+] -syn match p6ReduceOp display "\%(^\|\s\|(\)\@1<=!*\%([RSXZ\[]\)*[&RSXZ]\?\[\+(\?\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+)\?]\+" -syn match p6SetOp    display "R\?(\%([-^.+|&]\|[<>][=+]\?\|cont\|elem\))" - -" Reverse, cross, and zip metaoperators -exec "syn match p6RSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:alnum:][:space:]]\\)\\+\\|\\s\\@=\\|$\\)\"" - -syn match p6BlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@=" - -syn match p6Number     display "[A-Za-z_\xC0-\xFF0-9]\@1<!\%(\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?Inf\|NaN\)" -syn match p6Number     display "[A-Za-z_\xC0-\xFF0-9]\@1<!\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?\%(\%(\d\|__\@!\)*[._]\@1<!\.\)\?_\@!\%(\d\|_\)\+_\@1<!\%([eE]-\?_\@!\%(\d\|_\)\+\)\?i\?" -syn match p6Number     display "[A-Za-z_\xC0-\xFF0-9]\@1<!\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?0[obxd]\@="  nextgroup=p6OctBase,p6BinBase,p6HexBase,p6DecBase -syn match p6OctBase    display "o" contained nextgroup=p6OctNumber -syn match p6BinBase    display "b" contained nextgroup=p6BinNumber -syn match p6HexBase    display "x" contained nextgroup=p6HexNumber -syn match p6DecBase    display "d" contained nextgroup=p6DecNumber -syn match p6OctNumber  display "[0-7][0-7_]*" contained -syn match p6BinNumber  display "[01][01_]*" contained -syn match p6HexNumber  display "\x[[:xdigit:]_]*" contained -syn match p6DecNumber  display "\d[[:digit:]_]*" contained - -syn match p6Version    display "\<v\d\+\%(\.\%(\*\|\d\+\)\)*+\?" - -" Contextualizers -syn match p6Context display "\<\%(item\|list\|slice\|hash\)\>" -syn match p6Context display "\%(\$\|@\|%\|&\)(\@=" - -" Quoting - -" one cluster for every quote adverb -syn cluster p6Interp_scalar -    \ add=p6InterpScalar - -syn cluster p6Interp_array -    \ add=p6InterpArray - -syn cluster p6Interp_hash -    \ add=p6InterpHash - -syn cluster p6Interp_function -    \ add=p6InterpFunction - -syn cluster p6Interp_closure -    \ add=p6InterpClosure - -syn cluster p6Interp_q -    \ add=p6EscQQ -    \ add=p6EscBackSlash - -syn cluster p6Interp_backslash -    \ add=@p6Interp_q -    \ add=p6Escape -    \ add=p6EscOpenCurly -    \ add=p6EscCodePoint -    \ add=p6EscHex -    \ add=p6EscOct -    \ add=p6EscOctOld -    \ add=p6EscNull - -syn cluster p6Interp_qq -    \ add=@p6Interp_scalar -    \ add=@p6Interp_array -    \ add=@p6Interp_hash -    \ add=@p6Interp_function -    \ add=@p6Interp_closure -    \ add=@p6Interp_backslash -    \ add=p6MatchVarSigil - -syn region p6InterpScalar -    \ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" -    \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\|\%(\d\+\|!\|/\|¢\)\)\)" -    \ end="\z1\zs" -    \ contained keepend -    \ contains=TOP - -syn region p6InterpScalar -    \ matchgroup=p6Context -    \ start="\$\ze()\@!" -    \ skip="([^)]*)" -    \ end=")\zs" -    \ contained -    \ contains=TOP - -syn region p6InterpArray -    \ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" -    \ end="\z1\zs" -    \ contained keepend -    \ contains=TOP - -syn region p6InterpArray -    \ matchgroup=p6Context -    \ start="@\ze()\@!" -    \ skip="([^)]*)" -    \ end=")\zs" -    \ contained -    \ contains=TOP - -syn region p6InterpHash -    \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" -    \ end="\z1\zs" -    \ contained keepend -    \ contains=TOP - -syn region p6InterpHash -    \ matchgroup=p6Context -    \ start="%\ze()\@!" -    \ skip="([^)]*)" -    \ end=")\zs" -    \ contained -    \ contains=TOP - -syn region p6InterpFunction -    \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" -    \ end="\z1\zs" -    \ contained keepend -    \ contains=TOP - -syn region p6InterpFunction -    \ matchgroup=p6Context -    \ start="&\ze()\@!" -    \ skip="([^)]*)" -    \ end=")\zs" -    \ contained -    \ contains=TOP - -syn region p6InterpClosure -    \ start="\\\@1<!{}\@!" -    \ skip="{[^}]*}" -    \ end="}" -    \ contained keepend -    \ contains=TOP - -" generic escape -syn match p6Escape          display "\\\S" contained - -" escaped closing delimiters -syn match p6EscQuote        display "\\'" contained -syn match p6EscDoubleQuote  display "\\\"" contained -syn match p6EscCloseAngle   display "\\>" contained -syn match p6EscCloseFrench  display "\\»" contained -syn match p6EscBackTick     display "\\`" contained -syn match p6EscForwardSlash display "\\/" contained -syn match p6EscVerticalBar  display "\\|" contained -syn match p6EscExclamation  display "\\!" contained -syn match p6EscComma        display "\\," contained -syn match p6EscDollar       display "\\\$" contained -syn match p6EscCloseCurly   display "\\}" contained -syn match p6EscCloseBracket display "\\\]" contained - -" matches :key, :!key, :$var, :key<var>, etc -" Since we don't know in advance how the adverb ends, we use a trick. -" Consume nothing with the start pattern (\ze at the beginning), -" while capturing the whole adverb into \z1 and then putting it before -" the match start (\zs) of the end pattern. -syn region p6Adverb -    \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)" -    \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@1<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\)\|\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\)" -    \ end="\z1\zs" -    \ contained keepend -    \ contains=TOP - -" <words> -" Distinguishing this from the "less than" operator is tricky. For now, -" it matches if any of the following is true: -" -" * There is whitespace missing on either side of the "<", since -"   people tend to put spaces around "less than". We make an exception -"   for " = < ... >" assignments though. -" * It comes after "enum", "for", "any", "all", or "none" -" * It's the first or last thing on a line (ignoring whitespace) -" * It's preceded by "(\s*" or "=\s\+" -" * It's empty and terminated on the same line (e.g. <> and < >) -" -" It never matches when: -" -" * Preceded by [<+~=!] (e.g. <<foo>>, =<$foo>, * !< 3) -" * Followed by [-=] (e.g. <--, <=, <==, <->) -syn region p6StringAngle -    \ matchgroup=p6Quote -    \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" -    \ start="\%(\s\|[<+~=!]\)\@<!<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" -    \ start="[<+~=!]\@1<!<\%(\s\|<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" -    \ start="\%(^\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" -    \ start="[<+~=!]\@1<!<\%(\s*$\)\@=" -    \ start="\%((\s*\|=\s\+\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!" -    \ start="<\%(\s*>\)\@=" -    \ skip="\\\@1<!\\>" -    \ end=">" -    \ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle - -syn region p6StringAngleFixed -    \ matchgroup=p6Quote -    \ start="<" -    \ skip="\\\@1<!\\>" -    \ end=">" -    \ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle -    \ contained - -syn region p6InnerAnglesOne -    \ matchgroup=p6StringAngle -    \ start="\\\@1<!<" -    \ skip="\\\@1<!\\>" -    \ end=">" -    \ transparent contained -    \ contains=p6InnerAnglesOne - -" <<words>> -syn region p6StringAngles -    \ matchgroup=p6Quote -    \ start="<<=\@!" -    \ skip="\\\@1<!\\>" -    \ end=">>" -    \ contains=p6InnerAnglesTwo,@p6Interp_qq,p6Comment,p6BracketComment,p6EscHash,p6EscCloseAngle,p6Adverb,p6StringSQ,p6StringDQ - -syn region p6InnerAnglesTwo -    \ matchgroup=p6StringAngles -    \ start="<<" -    \ skip="\\\@1<!\\>" -    \ end=">>" -    \ transparent contained -    \ contains=p6InnerAnglesTwo - -" «words» -syn region p6StringFrench -    \ matchgroup=p6Quote -    \ start="«" -    \ skip="\\\@1<!\\»" -    \ end="»" -    \ contains=p6InnerFrench,@p6Interp_qq,p6Comment,p6BracketComment,p6EscHash,p6EscCloseFrench,p6Adverb,p6StringSQ,p6StringDQ - -syn region p6InnerFrench -    \ matchgroup=p6StringFrench -    \ start="\\\@1<!«" -    \ skip="\\\@1<!\\»" -    \ end="»" -    \ transparent contained -    \ contains=p6InnerFrench - -" Hyperops. They need to come after "<>" and "«»" strings in order to override -" them, but before other types of strings, to avoid matching those delimiters -" as parts of hyperops. -syn match p6HyperOp display #[^[:digit:][{('",:[:space:]][^[{('",:[:space:]]*\%(«\|<<\)# -syn match p6HyperOp display "«\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+[«»]" -syn match p6HyperOp display "»\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(«\|»\?\)" -syn match p6HyperOp display "<<\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|>>\)" -syn match p6HyperOp display ">>\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|\%(>>\)\?\)" - -" 'string' -syn region p6StringSQ -    \ matchgroup=p6Quote -    \ start="'" -    \ skip="\\\@1<!\\'" -    \ end="'" -    \ contains=@p6Interp_q,p6EscQuote -    \ keepend extend - -" "string" -syn region p6StringDQ -    \ matchgroup=p6Quote -    \ start=+"+ -    \ skip=+\\\@1<!\\"+ -    \ end=+"+ -    \ contains=@p6Interp_qq,p6EscDoubleQuote -    \ keepend extend - -" Q// and friends - -syn match p6QuoteQStart display "\%(:\|\%(sub\|role\)\s\)\@5<![Qq]\@=" nextgroup=p6QuoteQ,p6QuoteQ_q,p6QuoteQ_qww,p6QuoteQ_qq,p6QuoteQ_to,p6QuoteQ_qto,p6QuoteQ_qqto,p6Identifier -syn match p6QuoteQ      display "Q\%(qq\|ww\|[abcfhpsqvwx]\)\?[A-Za-z(]\@!" nextgroup=p6PairsQ skipwhite skipempty contained -syn match p6QuoteQ_q    display "q[abcfhpsvwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_q skipwhite skipempty contained -syn match p6QuoteQ_qww  display "qww[A-Za-z(]\@!" nextgroup=p6PairsQ_qww skipwhite skipempty contained -syn match p6QuoteQ_qq   display "qq[pwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_qq skipwhite skipempty contained -syn match p6QuoteQ_to   display "Qto[A-Za-z(]\@!" nextgroup=p6StringQ_to skipwhite skipempty contained -syn match p6QuoteQ_qto  display "qto[A-Za-z(]\@!" nextgroup=p6StringQ_qto skipwhite skipempty contained -syn match p6QuoteQ_qqto display "qqto[A-Za-z(]\@!" nextgroup=p6StringQ_qqto skipwhite skipempty contained -syn match p6QuoteQ_qto  display "q\_s*\%(\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*:\%(to\|heredoc\)\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*(\@!\)\@=" nextgroup=p6PairsQ_qto skipwhite skipempty contained -syn match p6QuoteQ_qqto display "qq\_s*\%(\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*:\%(to\|heredoc\)\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*(\@!\)\@=" nextgroup=p6PairsQ_qqto skipwhite skipempty contained -syn match p6PairsQ      "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6StringQ -syn match p6PairsQ_q    "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6StringQ_q -syn match p6PairsQ_qww  "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6StringQ_qww -syn match p6PairsQ_qq   "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6StringQ_qq -syn match p6PairsQ_qto  "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6StringQ_qto -syn match p6PairsQ_qqto "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6StringQ_qqto - - -if exists("perl6_embedded_pir") || exists("perl6_extended_all") -    syn include @p6PIR syntax/pir.vim -    syn match p6Quote_QPIR display "Q[A-Za-z(]\@!\%(\_s*:PIR\)\@=" nextgroup=p6PairsQ_PIR skipwhite skipempty -    syn match p6Pairs_QPIR contained "\_s*:PIR" transparent skipwhite skipempty nextgroup=p6StringQ_PIR -endif - -" hardcoded set of delimiters -let s:plain_delims = [ -  \ ["DQ",          "\\\"",         "\\\"", "p6EscDoubleQuote",  "\\\\\\@1<!\\\\\\\""], -  \ ["SQ",          "'",            "'",    "p6EscQuote",        "\\\\\\@1<!\\\\'"], -  \ ["Slash",       "/",            "/",    "p6EscForwardSlash", "\\\\\\@1<!\\\\/"], -  \ ["BackTick",    "`",            "`",    "p6EscBackTick",     "\\\\\\@1<!\\\\`"], -  \ ["Bar",         "|",            "|",    "p6EscVerticalBar",  "\\\\\\@1<!\\\\|"], -  \ ["Exclamation", "!",            "!",    "p6EscExclamation",  "\\\\\\@1<!\\\\!"], -  \ ["Comma",       ",",            ",",    "p6EscComma",        "\\\\\\@1<!\\\\,"], -  \ ["Dollar",      "\\$",          "\\$",  "p6EscDollar",       "\\\\\\@1<!\\\\\\$"], -\ ] -let s:bracketing_delims = [ -  \ ["Curly",   "{",            "}",    "p6EscCloseCurly",   "\\%(\\\\\\@1<!\\\\}\\|{[^}]*}\\)"], -  \ ["Angle",   "<",            ">",    "p6EscCloseAngle",   "\\%(\\\\\\@1<!\\\\>\\|<[^>]*>\\)"], -  \ ["French",  "«",            "»",    "p6EscCloseFrench",  "\\%(\\\\\\@1<!\\\\»\\|«[^»]*»\\)"], -  \ ["Bracket", "\\\[",         "]",    "p6EscCloseBracket", "\\%(\\\\\\@1<!\\\\]\\|\\[^\\]]*]\\)"], -  \ ["Paren",   "\\s\\@1<=(",   ")",    "p6EscCloseParen",   "\\%(\\\\\\@1<!\\\\)\\|([^)]*)\\)"], -\ ] -let s:all_delims = s:plain_delims + s:bracketing_delims - -for [name, start_delim, end_delim, end_group, skip] in s:all_delims -    exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" end=\"".end_delim."\" contained" -    exec "syn region p6StringQ_q matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,".end_group." contained" -    exec "syn region p6StringQ_qww matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,p6StringSQ,p6StringDQ".end_group." contained" -    exec "syn region p6StringQ_qq matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_qq,".end_group." contained" -    exec "syn region p6StringQ_to matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" end=\"^\\s*\\z1$\" contained" -    exec "syn region p6StringQ_qto matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_q,".end_group." contained" -    exec "syn region p6StringQ_qqto matchgroup=p6Quote start=\"".start_delim."\\z(\[^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_qq,".end_group." contained" - -    if exists("perl6_embedded_pir") || exists("perl6_extended_all") -        exec "syn region p6StringQ_PIR matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6PIR,".end_group." contained" -    endif -endfor -unlet s:plain_delims s:all_delims - -" :key -syn match p6Operator display ":\@1<!::\@!!\?" nextgroup=p6Key,p6StringAngleFixed,p6StringAngles,p6StringFrench -syn match p6Key display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" contained nextgroup=p6StringAngleFixed,p6StringAngles,p6StringFrench - -" Regexes and grammars - -syn match p6RegexName    display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\?" nextgroup=p6RegexBlockCrap skipwhite skipempty contained -syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained - -syn region p6RegexBlock -    \ matchgroup=p6Normal -    \ start="{" -    \ end="}" -    \ contained -    \ contains=@p6Regexen,@p6Variables - -" Perl 6 regex bits - -syn cluster p6Regexen -    \ add=p6RxMeta -    \ add=p6RxEscape -    \ add=p6EscCodePoint -    \ add=p6EscHex -    \ add=p6EscOct -    \ add=p6EscNull -    \ add=p6RxAnchor -    \ add=p6RxCapture -    \ add=p6RxGroup -    \ add=p6RxAlternation -    \ add=p6RxBoundary -    \ add=p6RxAdverb -    \ add=p6RxAdverbArg -    \ add=p6RxStorage -    \ add=p6RxAssertion -    \ add=p6RxAssertGroup -    \ add=p6RxQuoteWords -    \ add=p6RxClosure -    \ add=p6RxStringSQ -    \ add=p6RxStringDQ -    \ add=p6Comment -    \ add=p6BracketComment -    \ add=p6MatchVarSigil - -syn match p6RxMeta        display contained ".\%([A-Za-z_\xC0-\xFF0-9]\|\s\)\@1<!" -syn match p6RxAnchor      display contained "[$^]" -syn match p6RxEscape      display contained "\\\S" -syn match p6RxCapture     display contained "[()]" -syn match p6RxAlternation display contained "|" -syn match p6RxRange       display contained "\.\." - -" misc escapes -syn match p6EscOctOld    display "\\[1-9]\d\{1,2}" contained -syn match p6EscNull      display "\\0\d\@!" contained -syn match p6EscCodePoint display "\\[cC]" contained nextgroup=p6CodePoint -syn match p6EscHex       display "\\[xX]" contained nextgroup=p6HexSequence -syn match p6EscOct       display "\\o" contained nextgroup=p6OctSequence -syn match p6EscQQ        display "\\qq" contained nextgroup=p6QQSequence -syn match p6EscOpenCurly display "\\{" contained -syn match p6EscHash      display "\\#" contained -syn match p6EscBackSlash display "\\\\" contained - -syn region p6QQSequence -    \ matchgroup=p6Escape -    \ start="\[" -    \ skip="\[[^\]]*]" -    \ end="]" -    \ contained transparent -    \ contains=@p6Interp_qq - -syn match p6CodePoint   display "\%(\d\+\|\S\)" contained -syn region p6CodePoint -    \ matchgroup=p6Escape -    \ start="\[" -    \ end="]" -    \ contained - -syn match p6HexSequence display "\x\+" contained -syn region p6HexSequence -    \ matchgroup=p6Escape -    \ start="\[" -    \ end="]" -    \ contained - -syn match p6OctSequence display "\o\+" contained -syn region p6OctSequence -    \ matchgroup=p6Escape -    \ start="\[" -    \ end="]" -    \ contained - -" $<match>, @<match> -syn region p6MatchVarSigil -    \ matchgroup=p6Variable -    \ start="[$@]\%(<<\@!\)\@=" -    \ end=">\@1<=" -    \ contains=p6MatchVar - -syn region p6MatchVar -    \ matchgroup=p6Twigil -    \ start="<" -    \ end=">" -    \ contained - -syn region p6RxClosure -    \ matchgroup=p6Normal -    \ start="{" -    \ end="}" -    \ contained -    \ containedin=p6RxClosure -    \ contains=TOP -syn region p6RxGroup -    \ matchgroup=p6StringSpecial2 -    \ start="\[" -    \ end="]" -    \ contained -    \ contains=@p6Regexen,@p6Variables,p6MatchVarSigil -syn region p6RxAssertion -    \ matchgroup=p6StringSpecial2 -    \ start="<\%(?\?\%(before\|after\)\|\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\)\|[+?*]\)\?" -    \ end=">" -    \ contained -    \ contains=@p6Regexen,p6Identifier,@p6Variables,p6RxCharClass,p6RxAssertCall -syn region p6RxAssertGroup -    \ matchgroup=p6StringSpecial2 -    \ start="<\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\[" -    \ skip="\\\@1<!\\]" -    \ end="]" -    \ contained -syn match p6RxAssertCall display "\%(::\|\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)" contained nextgroup=p6RxAssertArgs -syn region p6RxAssertArgs -    \ start="(" -    \ end=")" -    \ contained keepend -    \ contains=TOP -syn region p6RxAssertArgs -    \ start=":" -    \ end="\ze>" -    \ contained keepend -    \ contains=TOP -syn match p6RxBoundary display contained "\%([«»]\|<<\|>>\)" -syn region p6RxCharClass -    \ matchgroup=p6StringSpecial2 -    \ start="\%(<[-!+?]\?\)\@2<=\[" -    \ skip="\\]" -    \ end="]" -    \ contained -    \ contains=p6RxRange,p6RxEscape,p6EscHex,p6EscOct,p6EscCodePoint,p6EscNull -syn region p6RxQuoteWords -    \ matchgroup=p6StringSpecial2 -    \ start="<\s" -    \ end="\s\?>" -    \ contained -syn region p6RxAdverb -    \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)" -    \ end="\z1\zs" -    \ contained keepend -    \ contains=TOP -syn region p6RxAdverbArg -    \ start="\%(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\@<=(" -    \ skip="([^)]\{-})" -    \ end=")" -    \ contained -    \ keepend -    \ contains=TOP -syn region p6RxStorage -    \ matchgroup=p6Operator -    \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@=" -    \ end="$" -    \ contains=TOP -    \ contained -    \ keepend - -" 'string' inside a regex -syn region p6RxStringSQ -    \ matchgroup=p6Quote -    \ start="'" -    \ skip="\\\@1<!\\'" -    \ end="'" -    \ contained -    \ contains=p6EscQuote,p6EscBackSlash - -" "string" inside a regex -syn region p6RxStringDQ -    \ matchgroup=p6Quote -    \ start=+"+ -    \ skip=+\\\@1<!\\"+ -    \ end=+"+ -    \ contained -    \ contains=p6EscDoubleQuote,p6EscBackSlash,@p6Interp_qq - -" $!, $var, $!var, $::var, $package::var $*::package::var, etc -" Thus must come after the matches for the "$" regex anchor, but before -" the match for the $ regex delimiter -syn cluster p6Variables -    \ add=p6VarSlash -    \ add=p6VarExclam -    \ add=p6VarMatch -    \ add=p6VarNum -    \ add=p6Variable - -syn match p6BareSigil    display "[@$%&]\%(\s*\%([,)}=]\|where\>\)\)\@=" -syn match p6VarSlash     display "\$/" -syn match p6VarExclam    display "\$!" -syn match p6VarMatch     display "\$¢" -syn match p6VarNum       display "\$\d\+" -syn match p6Variable     display "self" -syn match p6Variable     display "[@$%&]\?[@&$%]\$*\%(::\|\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\)\|[A-Za-z_\xC0-\xFF]\)\@=" nextgroup=p6Twigil,p6VarName,p6PackageScope -syn match p6VarName      display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" nextgroup=p6PostHyperOp contained -syn match p6Close        display "[\])]" nextgroup=p6PostHyperOp -syn match p6PostHyperOp  display "\%(»\|>>\)" contained -syn match p6Twigil       display "\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=" nextgroup=p6PackageScope,p6VarName contained -syn match p6PackageScope display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\?::" nextgroup=p6PackageScope,p6VarName contained - -" Perl 6 regex regions - -syn match p6MatchStart_m    display "\.\@1<!\<\%(mm\?\|rx\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_m -syn match p6MatchStart_s    display "\.\@1<!\<[sS]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_s -syn match p6MatchStart_tr   display "\.\@1<!\<tr\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=p6MatchAdverbs_tr -syn match p6MatchAdverbs_m  "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Match -syn match p6MatchAdverbs_s  "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Substitution -syn match p6MatchAdverbs_tr "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=p6Transliteration - -" /foo/ -syn region p6MatchBare -    \ matchgroup=p6Quote -    \ start="/\@1<!\%(\%(\_^\|[!\[,=~|&/:({]\|\^\?fff\?\^\?\|=>\|\<\%(if\|unless\|while\|when\|where\|so\)\)\s*\)\@<=/[/=]\@!" -    \ skip="\\/" -    \ end="/" -    \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum - -" m/foo/, m$foo$, m!foo!, etc -syn region p6Match -    \ matchgroup=p6Quote -    \ start=+\z([/!$,|`"]\)+ -    \ skip="\\\z1" -    \ end="\z1" -    \ contained -    \ contains=@p6Regexen,p6Variable,p6VarNum - -" m<foo>, m«foo», m{foo}, etc -for [name, start_delim, end_delim, end_group, skip] in s:bracketing_delims -    exec "syn region p6Match matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Regexen,@p6Variables" -endfor - -" Substitutions - -" s/foo//, s$foo$$, s!foo!!, etc -syn region p6Substitution -    \ matchgroup=p6Quote -    \ start=+\z([/!$,|`"]\)+ -    \ skip="\\\z1" -    \ end="\z1"me=e-1 -    \ contained -    \ contains=@p6Regexen,p6Variable,p6VarNum -    \ nextgroup=p6Replacement - -syn region p6Replacement -    \ matchgroup=p6Quote -    \ start="\z(.\)" -    \ skip="\\\z1" -    \ end="\z1" -    \ contained -    \ contains=@p6Interp_qq - -" s<foo><bar>, s«foo»«bar», s{foo}{bar}, etc -for [name, start_delim, end_delim, end_group, skip] in s:bracketing_delims -    exec "syn region p6Substitution matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Regexen,@p6Variables nextgroup=p6Repl".name -    exec "syn region p6Repl".name." matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Interp_qq" -endfor - -" Transliteration - -" tr/foo/bar/, tr|foo|bar, etc -syn region p6Transliteration -    \ matchgroup=p6Quote -    \ start=+\z([/!$,|`"]\)+ -    \ skip="\\\z1" -    \ end="\z1"me=e-1 -    \ contained -    \ contains=p6RxRange -    \ nextgroup=p6TransRepl - -syn region p6TransRepl -    \ matchgroup=p6Quote -    \ start="\z(.\)" -    \ skip="\\\z1" -    \ end="\z1" -    \ contained -    \ contains=@p6Interp_qq,p6RxRange - -" tr<foo><bar>, tr«foo»«bar», tr{foo}{bar}, etc -for [name, start_delim, end_delim, end_group, skip] in s:bracketing_delims -    exec "syn region p6Transliteration matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=p6RxRange nextgroup=p6TransRepl".name -    exec "syn region p6TransRepl".name." matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Interp_qq,p6RxRange" -endfor -unlet s:bracketing_delims - -if exists("perl6_perl5_regexes") || exists("perl6_extended_all") - -" Perl 5 regex regions - -syn cluster p6RegexP5Base -    \ add=p6RxP5Escape -    \ add=p6RxP5Oct -    \ add=p6RxP5Hex -    \ add=p6RxP5EscMeta -    \ add=p6RxP5CodePoint -    \ add=p6RxP5Prop - -" normal regex stuff -syn cluster p6RegexP5 -    \ add=@p6RegexP5Base -    \ add=p6RxP5Quantifier -    \ add=p6RxP5Meta -    \ add=p6RxP5QuoteMeta -    \ add=p6RxP5ParenMod -    \ add=p6RxP5Verb -    \ add=p6RxP5Count -    \ add=p6RxP5Named -    \ add=p6RxP5ReadRef -    \ add=p6RxP5WriteRef -    \ add=p6RxP5CharClass -    \ add=p6RxP5Anchor - -" inside character classes -syn cluster p6RegexP5Class -    \ add=@p6RegexP5Base -    \ add=p6RxP5Posix -    \ add=p6RxP5Range - -syn match p6RxP5Escape     display contained "\\\S" -syn match p6RxP5CodePoint  display contained "\\c\S\@=" nextgroup=p6RxP5CPId -syn match p6RxP5CPId       display contained "\S" -syn match p6RxP5Oct        display contained "\\\%(\o\{1,3}\)\@=" nextgroup=p6RxP5OctSeq -syn match p6RxP5OctSeq     display contained "\o\{1,3}" -syn match p6RxP5Anchor     display contained "[\^$]" -syn match p6RxP5Hex        display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=p6RxP5HexSeq -syn match p6RxP5HexSeq     display contained "\x\{1,2}" -syn region p6RxP5HexSeq -    \ matchgroup=p6RxP5Escape -    \ start="{" -    \ end="}" -    \ contained -syn region p6RxP5Named -    \ matchgroup=p6RxP5Escape -    \ start="\%(\\N\)\@2<={" -    \ end="}" -    \ contained -syn match p6RxP5Quantifier display contained "\%([+*]\|(\@1<!?\)" -syn match p6RxP5ReadRef    display contained "\\[1-9]\d\@!" -syn match p6RxP5ReadRef    display contained "\[A-Za-z_\xC0-\xFF0-9]<\@=" nextgroup=p6RxP5ReadRefId -syn region p6RxP5ReadRefId -    \ matchgroup=p6RxP5Escape -    \ start="<" -    \ end=">" -    \ contained -syn match p6RxP5WriteRef   display contained "\\g\%(\d\|{\)\@=" nextgroup=p6RxP5WriteRefId -syn match p6RxP5WriteRefId display contained "\d\+" -syn region p6RxP5WriteRefId -    \ matchgroup=p6RxP5Escape -    \ start="{" -    \ end="}" -    \ contained -syn match p6RxP5Prop       display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=p6RxP5PropId -syn match p6RxP5PropId     display contained "\a" -syn region p6RxP5PropId -    \ matchgroup=p6RxP5Escape -    \ start="{" -    \ end="}" -    \ contained -syn match p6RxP5Meta       display contained "[(|).]" -syn match p6RxP5ParenMod   display contained "(\@1<=?\@=" nextgroup=p6RxP5Mod,p6RxP5ModName,p6RxP5Code -syn match p6RxP5Mod        display contained "?\%(<\?=\|<\?!\|[#:|]\)" -syn match p6RxP5Mod        display contained "?-\?[impsx]\+" -syn match p6RxP5Mod        display contained "?\%([-+]\?\d\+\|R\)" -syn match p6RxP5Mod        display contained "?(DEFINE)" -syn match p6RxP5Mod        display contained "?\%(&\|P[>=]\)" nextgroup=p6RxP5ModDef -syn match p6RxP5ModDef     display contained "\h\w*" -syn region p6RxP5ModName -    \ matchgroup=p6StringSpecial -    \ start="?'" -    \ end="'" -    \ contained -syn region p6RxP5ModName -    \ matchgroup=p6StringSpecial -    \ start="?P\?<" -    \ end=">" -    \ contained -syn region p6RxP5Code -    \ matchgroup=p6StringSpecial -    \ start="??\?{" -    \ end="})\@=" -    \ contained -    \ contains=TOP -syn match p6RxP5EscMeta    display contained "\\[?*.{}()[\]|\^$]" -syn match p6RxP5Count      display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=p6RxP5CountId -syn region p6RxP5CountId -    \ matchgroup=p6RxP5Escape -    \ start="{" -    \ end="}" -    \ contained -syn match p6RxP5Verb       display contained "(\@1<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)" -syn region p6RxP5QuoteMeta -    \ matchgroup=p6RxP5Escape -    \ start="\\Q" -    \ end="\\E" -    \ contained -    \ contains=@p6Variables,p6EscBackSlash -syn region p6RxP5CharClass -    \ matchgroup=p6StringSpecial -    \ start="\[\^\?" -    \ skip="\\]" -    \ end="]" -    \ contained -    \ contains=@p6RegexP5Class -syn region p6RxP5Posix -    \ matchgroup=p6RxP5Escape -    \ start="\[:" -    \ end=":]" -    \ contained -syn match p6RxP5Range      display contained "-" - -" m:P5// -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=/" -    \ skip="\\/" -    \ end="/" -    \ contains=@p6RegexP5,p6Variable,p6VarExclam,p6VarMatch,p6VarNum - -" m:P5!! -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=!" -    \ skip="\\!" -    \ end="!" -    \ contains=@p6RegexP5,p6Variable,p6VarSlash,p6VarMatch,p6VarNum - -" m:P5$$, m:P5||, etc -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=\z([\"'`|,$]\)" -    \ skip="\\\z1" -    \ end="\z1" -    \ contains=@p6RegexP5,@p6Variables - -" m:P5 () -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s\+\)\@<=()\@!" -    \ skip="\\)" -    \ end=")" -    \ contains=@p6RegexP5,@p6Variables - -" m:P5[] -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=[]\@!" -    \ skip="\\]" -    \ end="]" -    \ contains=@p6RegexP5,@p6Variables - -" m:P5{} -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<={}\@!" -    \ skip="\\}" -    \ end="}" -    \ contains=@p6RegexP5,p6Variables - -" m:P5<> -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=<>\@!" -    \ skip="\\>" -    \ end=">" -    \ contains=@p6RegexP5,p6Variables - -" m:P5«» -syn region p6Match -    \ matchgroup=p6Quote -    \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=«»\@!" -    \ skip="\\»" -    \ end="»" -    \ contains=@p6RegexP5,p6Variables - -endif - -" Comments - -syn match p6Attention display "\<\%(ACHTUNG\|ATTN\|ATTENTION\|FIXME\|NB\|TODO\|TBD\|WTF\|XXX\|NOTE\)" contained - -" normal end-of-line comment -syn match p6Comment display "#.*" contains=p6Attention - -" Multiline comments. Arbitrary numbers of opening brackets are allowed, -" but we only define regions for 1 to 3 -syn region p6BracketComment -    \ start="#[`|=](" -    \ skip="([^)]*)" -    \ end=")" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ start="#[`|=]\[" -    \ skip="\[[^\]]*]" -    \ end="]" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ start="#[`|=]{" -    \ skip="{[^}]*}" -    \ end="}" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ start="#[`|=]<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ start="#[`|=]«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contains=p6Attention,p6BracketComment - -" Comments with double and triple delimiters -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]((" -    \ skip="((\%([^)\|))\@!]\)*))" -    \ end="))" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=](((" -    \ skip="(((\%([^)]\|)\%())\)\@!\)*)))" -    \ end=")))" -    \ contains=p6Attention,p6BracketComment - -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]\[\[" -    \ skip="\[\[\%([^\]]\|]]\@!\)*]]" -    \ end="]]" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]\[\[\[" -    \ skip="\[\[\[\%([^\]]\|]\%(]]\)\@!\)*]]]" -    \ end="]]]" -    \ contains=p6Attention,p6BracketComment - -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]{{" -    \ skip="{{\%([^}]\|}}\@!\)*}}" -    \ end="}}" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]{{{" -    \ skip="{{{\%([^}]\|}\%(}}\)\@!\)*}}}" -    \ end="}}}" -    \ contains=p6Attention,p6BracketComment - -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]<<" -    \ skip="<<\%([^>]\|>>\@!\)*>>" -    \ end=">>" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]<<<" -    \ skip="<<<\%([^>]\|>\%(>>\)\@!\)*>>>" -    \ end=">>>" -    \ contains=p6Attention,p6BracketComment - -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]««" -    \ skip="««\%([^»]\|»»\@!\)*»»" -    \ end="»»" -    \ contains=p6Attention,p6BracketComment -syn region p6BracketComment -    \ matchgroup=p6BracketComment -    \ start="#[`|=]«««" -    \ skip="«««\%([^»]\|»\%(»»\)\@!\)*»»»" -    \ end="»»»" -    \ contains=p6Attention,p6BracketComment - -syn match p6Shebang display "\%^#!.*" - -" => and p5=> autoquoting -syn match p6StringP5Auto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+p5=>" -syn match p6StringAuto   display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\%(p5\)\@2<![RSXZ]\@1<!=>" -syn match p6StringAuto   display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+=>" -syn match p6StringAuto   display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)p5\ze=>" - -" Pod - -" Abbreviated blocks (implicit code forbidden) -syn region p6PodAbbrRegion -    \ matchgroup=p6PodPrefix -    \ start="^\s*\zs=\ze\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodAbbrNoCodeType -    \ keepend - -syn region p6PodAbbrNoCodeType -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodName,p6PodAbbrNoCode - -syn match p6PodName contained ".\+" contains=@p6PodFormat -syn match p6PodComment contained ".\+" - -syn region p6PodAbbrNoCode -    \ start="^" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=@p6PodFormat - -" Abbreviated blocks (everything is code) -syn region p6PodAbbrRegion -    \ matchgroup=p6PodPrefix -    \ start="^\s*\zs=\zecode\>" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodAbbrCodeType -    \ keepend - -syn region p6PodAbbrCodeType -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodName,p6PodAbbrCode - -syn region p6PodAbbrCode -    \ start="^" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained - -" Abbreviated blocks (everything is a comment) -syn region p6PodAbbrRegion -    \ matchgroup=p6PodPrefix -    \ start="^=\zecomment\>" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodAbbrCommentType -    \ keepend - -syn region p6PodAbbrCommentType -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodComment,p6PodAbbrNoCode - -" Abbreviated blocks (implicit code allowed) -syn region p6PodAbbrRegion -    \ matchgroup=p6PodPrefix -    \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodAbbrType -    \ keepend - -syn region p6PodAbbrType -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodName,p6PodAbbr - -syn region p6PodAbbr -    \ start="^" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=@p6PodFormat,p6PodImplicitCode - -" Abbreviated block to end-of-file -syn region p6PodAbbrRegion -    \ matchgroup=p6PodPrefix -    \ start="^=\zeEND\>" -    \ end="\%$" -    \ contains=p6PodAbbrEOFType -    \ keepend - -syn region p6PodAbbrEOFType -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="\%$" -    \ contained -    \ contains=p6PodName,p6PodAbbrEOF - -syn region p6PodAbbrEOF -    \ start="^" -    \ end="\%$" -    \ contained -    \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -" Directives -syn region p6PodDirectRegion -    \ matchgroup=p6PodPrefix -    \ start="^=\%(config\|use\)\>" -    \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" -    \ contains=p6PodDirectArgRegion -    \ keepend - -syn region p6PodDirectArgRegion -    \ matchgroup=p6PodType -    \ start="\S\+" -    \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" -    \ contained -    \ contains=p6PodDirectConfigRegion - -syn region p6PodDirectConfigRegion -    \ start="" -    \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" -    \ contained -    \ contains=@p6PodConfig - -" =encoding is a special directive -syn region p6PodDirectRegion -    \ matchgroup=p6PodPrefix -    \ start="^=encoding\>" -    \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" -    \ contains=p6PodEncodingArgRegion -    \ keepend - -syn region p6PodEncodingArgRegion -    \ matchgroup=p6PodName -    \ start="\S\+" -    \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" -    \ contained - -" Paragraph blocks (implicit code forbidden) -syn region p6PodParaRegion -    \ matchgroup=p6PodPrefix -    \ start="^\s*\zs=for\>" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodParaNoCodeTypeRegion -    \ keepend extend - -syn region p6PodParaNoCodeTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodParaNoCode,p6PodParaConfigRegion - -syn region p6PodParaConfigRegion -    \ start="" -    \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\@1<!\)" -    \ contained -    \ contains=@p6PodConfig - -syn region p6PodParaNoCode -    \ start="^[^=]" -    \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=@p6PodFormat - -" Paragraph blocks (everything is code) -syn region p6PodParaRegion -    \ matchgroup=p6PodPrefix -    \ start="^\s*\zs=for\>\ze\s*code\>" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodParaCodeTypeRegion -    \ keepend extend - -syn region p6PodParaCodeTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodParaCode,p6PodParaConfigRegion - -syn region p6PodParaCode -    \ start="^[^=]" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained - -" Paragraph blocks (implicit code allowed) -syn region p6PodParaRegion -    \ matchgroup=p6PodPrefix -    \ start="^\s*\zs=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" -    \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contains=p6PodParaTypeRegion -    \ keepend extend - -syn region p6PodParaTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=p6PodPara,p6PodParaConfigRegion - -syn region p6PodPara -    \ start="^[^=]" -    \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)" -    \ contained -    \ contains=@p6PodFormat,p6PodImplicitCode - -" Paragraph block to end-of-file -syn region p6PodParaRegion -    \ matchgroup=p6PodPrefix -    \ start="^=for\>\ze\s\+END\>" -    \ end="\%$" -    \ contains=p6PodParaEOFTypeRegion -    \ keepend extend - -syn region p6PodParaEOFTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="\%$" -    \ contained -    \ contains=p6PodParaEOF,p6PodParaConfigRegion - -syn region p6PodParaEOF -    \ start="^[^=]" -    \ end="\%$" -    \ contained -    \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -" Delimited blocks (implicit code forbidden) -syn region p6PodDelimRegion -    \ matchgroup=p6PodPrefix -    \ start="^\z(\s*\)\zs=begin\>" -    \ end="^\z1\zs=end\>" -    \ contains=p6PodDelimNoCodeTypeRegion -    \ keepend extend skipwhite -    \ nextgroup=p6PodType - -syn region p6PodDelimNoCodeTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\s*\zs\ze=end\>" -    \ contained -    \ contains=p6PodDelimNoCode,p6PodDelimConfigRegion - -syn region p6PodDelimConfigRegion -    \ start="" -    \ end="^\s*\zs\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)" -    \ contained -    \ contains=@p6PodConfig - -syn region p6PodDelimNoCode -    \ start="^" -    \ end="^\s*\zs\ze=end\>" -    \ contained -    \ contains=@p6PodNestedBlocks,@p6PodFormat - -" Delimited blocks (everything is code) -syn region p6PodDelimRegion -    \ matchgroup=p6PodPrefix -    \ start="^\z(\s*\)\zs=begin\>\ze\s*code\>" -    \ end="^\z1\zs=end\>" -    \ contains=p6PodDelimCodeTypeRegion -    \ keepend extend skipwhite -    \ nextgroup=p6PodType - -syn region p6PodDelimCodeTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\s*\zs\ze=end\>" -    \ contained -    \ contains=p6PodDelimCode,p6PodDelimConfigRegion - -syn region p6PodDelimCode -    \ start="^" -    \ end="^\s*\zs\ze=end\>" -    \ contained -    \ contains=@p6PodNestedBlocks - -" Delimited blocks (implicit code allowed) -syn region p6PodDelimRegion -    \ matchgroup=p6PodPrefix -    \ start="^\z(\s*\)\zs=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" -    \ end="^\z1\zs=end\>" -    \ contains=p6PodDelimTypeRegion -    \ keepend extend skipwhite -    \ nextgroup=p6PodType - -syn region p6PodDelimTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="^\s*\zs\ze=end\>" -    \ contained -    \ contains=p6PodDelim,p6PodDelimConfigRegion - -syn region p6PodDelim -    \ start="^" -    \ end="^\s*\zs\ze=end\>" -    \ contained -    \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -" Delimited block to end-of-file -syn region p6PodDelimRegion -    \ matchgroup=p6PodPrefix -    \ start="^=begin\>\ze\s\+END\>" -    \ end="\%$" -    \ extend -    \ contains=p6PodDelimEOFTypeRegion - -syn region p6PodDelimEOFTypeRegion -    \ matchgroup=p6PodType -    \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" -    \ end="\%$" -    \ contained -    \ contains=p6PodDelimEOF,p6PodDelimConfigRegion - -syn region p6PodDelimEOF -    \ start="^" -    \ end="\%$" -    \ contained -    \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode - -syn cluster p6PodConfig -    \ add=p6PodConfigOperator -    \ add=p6PodExtraConfig -    \ add=p6StringAuto -    \ add=p6PodAutoQuote -    \ add=p6StringSQ - -syn region p6PodParens -    \ start="(" -    \ end=")" -    \ contained -    \ contains=p6Number,p6StringSQ - -syn match p6PodAutoQuote      display contained "=>" -syn match p6PodConfigOperator display contained ":!\?" nextgroup=p6PodConfigOption -syn match p6PodConfigOption   display contained "[^[:space:](<]\+" nextgroup=p6PodParens,p6StringAngle -syn match p6PodExtraConfig    display contained "^=" -syn match p6PodVerticalBar    display contained "|" -syn match p6PodColon          display contained ":" -syn match p6PodSemicolon      display contained ";" -syn match p6PodComma          display contained "," -syn match p6PodImplicitCode   display contained "^\s.*" -syn match p6PodType           display contained "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" - -" These may appear inside delimited blocks -syn cluster p6PodNestedBlocks -    \ add=p6PodAbbrRegion -    \ add=p6PodDirectRegion -    \ add=p6PodParaRegion -    \ add=p6PodDelimRegion - -" Pod formatting codes - -syn cluster p6PodFormat -    \ add=p6PodFormatOne -    \ add=p6PodFormatTwo -    \ add=p6PodFormatThree -    \ add=p6PodFormatFrench - -" Balanced angles found inside formatting codes. Ensures proper nesting. - -syn region p6PodFormatAnglesOne -    \ matchgroup=p6PodFormat -    \ start="<" -    \ skip="<[^>]*>" -    \ end=">" -    \ transparent contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne - -syn region p6PodFormatAnglesTwo -    \ matchgroup=p6PodFormat -    \ start="<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ transparent contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo - -syn region p6PodFormatAnglesThree -    \ matchgroup=p6PodFormat -    \ start="<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ transparent contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree - -syn region p6PodFormatAnglesFrench -    \ matchgroup=p6PodFormat -    \ start="«" -    \ skip="«[^»]*»" -    \ end="»" -    \ transparent contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree - -" All formatting codes - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="\u<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="\u<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="\u<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="\u«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree - -" C<> and V<> don't allow nested formatting formatting codes - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="[CV]<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="[CV]<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAnglesTwo - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="[CV]<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="[CV]«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench - -" L<> can have a "|" separator - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="L<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="L<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="L<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="L«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar - -" E<> can have a ";" separator - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="E<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodSemiColon - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="E<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodSemiColon - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="E<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="E«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon - -" M<> can have a ":" separator - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="M<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodColon - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="M<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodColon - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="M<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="M«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon - -" D<> can have "|" and ";" separators - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="D<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="D<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAngleTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="D<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="D«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon - -" X<> can have "|", "," and ";" separators - -syn region p6PodFormatOne -    \ matchgroup=p6PodFormatCode -    \ start="X<" -    \ skip="<[^>]*>" -    \ end=">" -    \ contained -    \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -syn region p6PodFormatTwo -    \ matchgroup=p6PodFormatCode -    \ start="X<<" -    \ skip="<<[^>]*>>" -    \ end=">>" -    \ contained -    \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -syn region p6PodFormatThree -    \ matchgroup=p6PodFormatCode -    \ start="X<<<" -    \ skip="<<<[^>]*>>>" -    \ end=">>>" -    \ contained -    \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -syn region p6PodFormatFrench -    \ matchgroup=p6PodFormatCode -    \ start="X«" -    \ skip="«[^»]*»" -    \ end="»" -    \ contained -    \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma - -" Define the default highlighting. -" 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_perl6_syntax_inits") -    if version < 508 -        let did_perl6_syntax_inits = 1 -        command -nargs=+ HiLink hi link <args> -    else -        command -nargs=+ HiLink hi def link <args> -    endif - -    HiLink p6EscOctOld        p6Error -    HiLink p6PackageTwigil    p6Twigil -    HiLink p6StringAngle      p6String -    HiLink p6StringAngleFixed p6String -    HiLink p6StringFrench     p6String -    HiLink p6StringAngles     p6String -    HiLink p6StringSQ         p6String -    HiLink p6StringDQ         p6String -    HiLink p6StringQ          p6String -    HiLink p6StringQ_q        p6String -    HiLink p6StringQ_qww      p6String -    HiLink p6StringQ_qq       p6String -    HiLink p6StringQ_to       p6String -    HiLink p6StringQ_qto      p6String -    HiLink p6StringQ_qqto     p6String -    HiLink p6RxStringSQ       p6String -    HiLink p6RxStringDQ       p6String -    HiLink p6Replacement      p6String -    HiLink p6ReplCurly        p6String -    HiLink p6ReplAngle        p6String -    HiLink p6ReplFrench       p6String -    HiLink p6ReplBracket      p6String -    HiLink p6ReplParen        p6String -    HiLink p6Transliteration  p6String -    HiLink p6TransRepl        p6String -    HiLink p6TransReplCurly   p6String -    HiLink p6TransReplAngle   p6String -    HiLink p6TransReplFrench  p6String -    HiLink p6TransReplBracket p6String -    HiLink p6TransReplParen   p6String -    HiLink p6StringAuto       p6String -    HiLink p6StringP5Auto     p6String -    HiLink p6Key              p6String -    HiLink p6Match            p6String -    HiLink p6Substitution     p6String -    HiLink p6MatchBare        p6String -    HiLink p6RegexBlock       p6String -    HiLink p6RxP5CharClass    p6String -    HiLink p6RxP5QuoteMeta    p6String -    HiLink p6RxCharClass      p6String -    HiLink p6RxQuoteWords     p6String -    HiLink p6ReduceOp         p6Operator -    HiLink p6SetOp            p6Operator -    HiLink p6RSXZOp           p6Operator -    HiLink p6HyperOp          p6Operator -    HiLink p6PostHyperOp      p6Operator -    HiLink p6QuoteQ           p6Quote -    HiLink p6QuoteQ_q         p6Quote -    HiLink p6QuoteQ_qww       p6Quote -    HiLink p6QuoteQ_qq        p6Quote -    HiLink p6QuoteQ_to        p6Quote -    HiLink p6QuoteQ_qto       p6Quote -    HiLink p6QuoteQ_qqto      p6Quote -    HiLink p6QuoteQ_PIR       p6Quote -    HiLink p6MatchStart_m     p6Quote -    HiLink p6MatchStart_s     p6Quote -    HiLink p6MatchStart_tr    p6Quote -    HiLink p6BareSigil        p6Variable -    HiLink p6RxRange          p6StringSpecial -    HiLink p6RxAnchor         p6StringSpecial -    HiLink p6RxBoundary       p6StringSpecial -    HiLink p6RxP5Anchor       p6StringSpecial -    HiLink p6CodePoint        p6StringSpecial -    HiLink p6RxMeta           p6StringSpecial -    HiLink p6RxP5Range        p6StringSpecial -    HiLink p6RxP5CPId         p6StringSpecial -    HiLink p6RxP5Posix        p6StringSpecial -    HiLink p6RxP5Mod          p6StringSpecial -    HiLink p6RxP5HexSeq       p6StringSpecial -    HiLink p6RxP5OctSeq       p6StringSpecial -    HiLink p6RxP5WriteRefId   p6StringSpecial -    HiLink p6HexSequence      p6StringSpecial -    HiLink p6OctSequence      p6StringSpecial -    HiLink p6RxP5Named        p6StringSpecial -    HiLink p6RxP5PropId       p6StringSpecial -    HiLink p6RxP5Quantifier   p6StringSpecial -    HiLink p6RxP5CountId      p6StringSpecial -    HiLink p6RxP5Verb         p6StringSpecial -    HiLink p6RxAssertGroup    p6StringSpecial2 -    HiLink p6Escape           p6StringSpecial2 -    HiLink p6EscNull          p6StringSpecial2 -    HiLink p6EscHash          p6StringSpecial2 -    HiLink p6EscQQ            p6StringSpecial2 -    HiLink p6EscQuote         p6StringSpecial2 -    HiLink p6EscDoubleQuote   p6StringSpecial2 -    HiLink p6EscBackTick      p6StringSpecial2 -    HiLink p6EscForwardSlash  p6StringSpecial2 -    HiLink p6EscVerticalBar   p6StringSpecial2 -    HiLink p6EscExclamation   p6StringSpecial2 -    HiLink p6EscDollar        p6StringSpecial2 -    HiLink p6EscOpenCurly     p6StringSpecial2 -    HiLink p6EscCloseCurly    p6StringSpecial2 -    HiLink p6EscCloseBracket  p6StringSpecial2 -    HiLink p6EscCloseAngle    p6StringSpecial2 -    HiLink p6EscCloseFrench   p6StringSpecial2 -    HiLink p6EscBackSlash     p6StringSpecial2 -    HiLink p6EscCodePoint     p6StringSpecial2 -    HiLink p6EscOct           p6StringSpecial2 -    HiLink p6EscHex           p6StringSpecial2 -    HiLink p6RxEscape         p6StringSpecial2 -    HiLink p6RxCapture        p6StringSpecial2 -    HiLink p6RxAlternation    p6StringSpecial2 -    HiLink p6RxP5             p6StringSpecial2 -    HiLink p6RxP5ReadRef      p6StringSpecial2 -    HiLink p6RxP5Oct          p6StringSpecial2 -    HiLink p6RxP5Hex          p6StringSpecial2 -    HiLink p6RxP5EscMeta      p6StringSpecial2 -    HiLink p6RxP5Meta         p6StringSpecial2 -    HiLink p6RxP5Escape       p6StringSpecial2 -    HiLink p6RxP5CodePoint    p6StringSpecial2 -    HiLink p6RxP5WriteRef     p6StringSpecial2 -    HiLink p6RxP5Prop         p6StringSpecial2 - -    HiLink p6Property       Tag -    HiLink p6Attention      Todo -    HiLink p6Type           Type -    HiLink p6Error          Error -    HiLink p6BlockLabel     Label -    HiLink p6Normal         Normal -    HiLink p6Identifier     Normal -    HiLink p6Package        Normal -    HiLink p6PackageScope   Normal -    HiLink p6Number         Number -    HiLink p6OctNumber      Number -    HiLink p6BinNumber      Number -    HiLink p6HexNumber      Number -    HiLink p6DecNumber      Number -    HiLink p6String         String -    HiLink p6Repeat         Repeat -    HiLink p6Pragma         Keyword -    HiLink p6PreDeclare     Keyword -    HiLink p6Declare        Keyword -    HiLink p6DeclareRegex   Keyword -    HiLink p6VarStorage     Special -    HiLink p6FlowControl    Special -    HiLink p6OctBase        Special -    HiLink p6BinBase        Special -    HiLink p6HexBase        Special -    HiLink p6DecBase        Special -    HiLink p6Twigil         Special -    HiLink p6StringSpecial2 Special -    HiLink p6Version        Special -    HiLink p6Comment        Comment -    HiLink p6BracketComment Comment -    HiLink p6Include        Include -    HiLink p6Shebang        PreProc -    HiLink p6ClosureTrait   PreProc -    HiLink p6Operator       Operator -    HiLink p6Context        Operator -    HiLink p6Quote          Delimiter -    HiLink p6TypeConstraint PreCondit -    HiLink p6Exception      Exception -    HiLink p6Variable       Identifier -    HiLink p6VarSlash       Identifier -    HiLink p6VarNum         Identifier -    HiLink p6VarExclam      Identifier -    HiLink p6VarMatch       Identifier -    HiLink p6VarName        Identifier -    HiLink p6MatchVar       Identifier -    HiLink p6RxP5ReadRefId  Identifier -    HiLink p6RxP5ModDef     Identifier -    HiLink p6RxP5ModName    Identifier -    HiLink p6Conditional    Conditional -    HiLink p6StringSpecial  SpecialChar - -    HiLink p6PodAbbr         p6Pod -    HiLink p6PodAbbrEOF      p6Pod -    HiLink p6PodAbbrNoCode   p6Pod -    HiLink p6PodAbbrCode     p6PodCode -    HiLink p6PodPara         p6Pod -    HiLink p6PodParaEOF      p6Pod -    HiLink p6PodParaNoCode   p6Pod -    HiLink p6PodParaCode     p6PodCode -    HiLink p6PodDelim        p6Pod -    HiLink p6PodDelimEOF     p6Pod -    HiLink p6PodDelimNoCode  p6Pod -    HiLink p6PodDelimCode    p6PodCode -    HiLink p6PodImplicitCode p6PodCode -    HiLink p6PodExtraConfig  p6PodPrefix -    HiLink p6PodVerticalBar  p6PodFormatCode -    HiLink p6PodColon        p6PodFormatCode -    HiLink p6PodSemicolon    p6PodFormatCode -    HiLink p6PodComma        p6PodFormatCode -    HiLink p6PodFormatOne    p6PodFormat -    HiLink p6PodFormatTwo    p6PodFormat -    HiLink p6PodFormatThree  p6PodFormat -    HiLink p6PodFormatFrench p6PodFormat - -    HiLink p6PodType           Type -    HiLink p6PodConfigOption   String -    HiLink p6PodCode           PreProc -    HiLink p6Pod               Comment -    HiLink p6PodComment        Comment -    HiLink p6PodAutoQuote      Operator -    HiLink p6PodConfigOperator Operator -    HiLink p6PodPrefix         Statement -    HiLink p6PodName           Identifier -    HiLink p6PodFormatCode     SpecialChar -    HiLink p6PodFormat         SpecialComment - -    delcommand HiLink -endif - -if exists("perl6_fold") || exists("perl6_extended_all") -    setl foldmethod=syntax -    syn region p6BlockFold -        \ start="^\z(\s*\)\%(my\|our\|augment\|multi\|proto\|only\)\?\s*\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\s\+\)\?\<\%(CATCH\|try\|ENTER\|LEAVE\|CHECK\|INIT\|BEGIN\|END\|KEEP\|UNDO\|PRE\|POST\|module\|package\|enum\|subset\|class\|sub\%(method\)\?\|multi\|method\|slang\|grammar\|regex\|token\|rule\)\>[^{]\+\%({\s*\%(#.*\)\?\)\?$" -        \ end="^\z1}" -        \ transparent fold keepend extend -endif - -let b:current_syntax = "perl6" - -let &cpo = s:keepcpo -unlet s:keepcpo - -" vim:ts=8:sts=4:sw=4:expandtab:ft=vim - -endif diff --git a/syntax/plantuml.vim b/syntax/plantuml.vim index 9ecd90eb..c8a24285 100644 --- a/syntax/plantuml.vim +++ b/syntax/plantuml.vim @@ -8,7 +8,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -  " TODO:         There are some bugs, add << >>  "  if exists("b:current_syntax") -    finish +  finish  endif  if version < 600 @@ -22,12 +22,13 @@ let b:current_syntax = "plantuml"  syntax sync minlines=100 -syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(include\|ifdef\|define\|endif\)\s*.*/ contains=plantumlDir +syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(include\|define\|undev\|ifdef\|endif\|ifndef\)\s*.*/ contains=plantumlDir  syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained -syntax keyword plantumlTypeKeyword namespace component package interface class interface enum object participant activity skinparam abstract -syntax keyword plantumlKeyword actor boundary control entity database partition title activate as deactivate note left right top bottom of end destroy -syntax keyword plantumlKeyword if then else endif +syntax keyword plantumlTypeKeyword actor participant usecase interface abstract enum component state object artifact folder rect node frame cloud database storage agent boundary control entity card +syntax keyword plantumlKeyword as also autonumber caption title newpage box alt opt loop par break critical note rnote hnote legend group left right of on link over end activate deactivate destroy create footbox hide show skinparam skin top bottom +syntax keyword plantumlKeyword package namespace page up down if else elseif endif partition footer header center rotate ref return is repeat start stop while endwhile fork again kill +syntax keyword plantumlKeyword then detach  syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained  syntax match plantumlColor /#[0-9A-Fa-f]\{6\}\>/ @@ -40,19 +41,18 @@ syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=p  syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained  " Class -syntax region plantumlClass start=/{/ end=/\s*}/ contains=plantumlClassArrows, -\                                                         plantumlKeyword, -\                                                         @plantumlClassOp +syntax region plantumlClassString matchgroup=plantumlClass start=/\s*class\ze [^{]\+{/ end=/\s*\ze}/ contains=plantumlKeyword, +\                                                                                                             @plantumlClassOp +syntax match plantumlClass /\s*class\ze [^{]\+$/  syntax match plantumlClassPublic      /+\w\+/ contained -syntax match plantumlClassPrivate     /-\w\+/ contained  -syntax match plantumlClassProtected   /#\w\+/ contained  +syntax match plantumlClassPrivate     /-\w\+/ contained +syntax match plantumlClassProtected   /#\w\+/ contained  syntax match plantumlClassPackPrivate /\~\w\+/ contained  syntax cluster plantumlClassOp contains=plantumlClassPublic,  \                                       plantumlClassPrivate,  \                                       plantumlClassProtected, -\                                       plantumlClassProtected,  \                                       plantumlClassPackPrivate  " Strings @@ -154,6 +154,7 @@ highlight default link plantumlDirectedOrVerticalArrowLR Special  highlight default link plantumlDirectedOrVerticalArrowRL Special  highlight default link plantumlLabel Special  highlight default link plantumlText Label +highlight default link plantumlClass Type  highlight default link plantumlClassPublic Structure  highlight default link plantumlClassPrivate Macro  highlight default link plantumlClassProtected Statement diff --git a/syntax/purescript.vim b/syntax/purescript.vim index 298a3008..eec5a0c0 100644 --- a/syntax/purescript.vim +++ b/syntax/purescript.vim @@ -11,45 +11,167 @@ if exists("b:current_syntax")    finish  endif -syn keyword purescriptModule module -syn keyword purescriptImport foreign import hiding -syn region purescriptQualifiedImport start="\<qualified\>" contains=purescriptType,purescriptDot end="\<as\>" -syn keyword purescriptStructure data newtype type class instance derive where -syn keyword purescriptStatement forall do case of let in +" Values +syn match purescriptIdentifier "\<[_a-z]\(\w\|\'\)*\>" +syn match purescriptNumber "0[xX][0-9a-fA-F]\+\|0[oO][0-7]\|[0-9]\+" +syn match purescriptFloat "[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=" +syn keyword purescriptBoolean true false + +" Delimiters +syn match purescriptDelimiter "[,;|.()[\]{}]" + +" Constructor +syn match purescriptConstructor "\<[A-Z]\w*\>" +syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained +  \ containedin=purescriptData,purescriptNewtype +  \ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment + +" Type +syn match purescriptType "\<[A-Z]\w*\>" contained +  \ containedin=purescriptTypeAlias +  \ nextgroup=purescriptType,purescriptTypeVar skipwhite +syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained +  \ containedin=purescriptData,purescriptNewtype,purescriptTypeAlias,purescriptFunctionDecl +syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^,.]\)*\>("rs=e-1 matchgroup=purescriptDelimiter end=")" contained extend +  \ contains=purescriptConstructor,purescriptDelimiter + +" Function +syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained +syn match purescriptFunction "(\(\W\&[^(),\"]\)\+)" contained extend +syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_]*`" + +" Module +syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl +syn match purescriptModuleKeyword "\<module\>" +syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>" +  \ contains=purescriptModuleKeyword,purescriptModuleName +  \ nextgroup=purescriptModuleParams skipwhite skipnl skipempty +syn region purescriptModuleParams start="(" end=")" fold contained keepend +  \ contains=purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment +  \ nextgroup=purescriptImportParams skipwhite + +" Import +syn match purescriptImportKeyword "\<\(foreign\|import\|qualified\)\>" +syn keyword purescriptAsKeyword as contained +syn keyword purescriptHidingKeyword hiding contained +syn match purescriptImport "\<import\>\s\+\(qualified\s\+\)\?\<\(\w\+\.\?\)*\>" +  \ contains=purescriptImportKeyword,purescriptModuleName +  \ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite +syn match purescriptImportParams "as\s\+\(\w\+\)" contained +  \ contains=purescriptModuleName,purescriptAsKeyword +  \ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite +syn match purescriptImportParams "hiding" contained +  \ contains=purescriptHidingKeyword +  \ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite + +" Function declaration +syn region purescriptFunctionDecl excludenl start="^\z(\s*\)\(foreign\s\+import\_s\+\)\?[_a-z]\(\w\|\'\)*\_s\{-}\(::\|∷\)" end="^\z1\=\S"me=s-1,re=s-1 keepend +  \ contains=purescriptFunctionDeclStart,purescriptForall,purescriptOperatorType,purescriptOperatorTypeSig,purescriptType,purescriptTypeVar,purescriptDelimiter,@purescriptComment +syn match purescriptFunctionDeclStart "^\s*\(foreign\s\+import\_s\+\)\?\([_a-z]\(\w\|\'\)*\)\_s\{-}\(::\|∷\)" contained +  \ contains=purescriptImportKeyword,purescriptFunction,purescriptOperatorType +syn keyword purescriptForall forall +syn match purescriptForall "∀" + +" Keywords  syn keyword purescriptConditional if then else -syn match purescriptNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>" -syn match purescriptFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" -syn match purescriptDelimiter  "[(),;[\]{}]" -syn keyword purescriptInfix infix infixl infixr -syn match purescriptOperators "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)" -syn match purescriptDot "\." -syn match purescriptType "\<\([A-Z][a-zA-Z0-9_]*\|_|_\)\>" -syn match purescriptLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" +syn keyword purescriptStatement do case of let in +syn keyword purescriptWhere where +syn match purescriptStructure "\<\(data\|newtype\|type\|class\)\>" +  \ nextgroup=purescriptType skipwhite +syn keyword purescriptStructure derive +syn keyword purescriptStructure instance +  \ nextgroup=purescriptFunction skipwhite + +" Infix +syn match purescriptInfixKeyword "\<\(infix\|infixl\|infixr\)\>" +syn match purescriptInfix "^\(infix\|infixl\|infixr\)\>\s\+\([0-9]\+\)\s\+\(type\s\+\)\?\(\S\+\)\s\+as\>" +  \ contains=purescriptInfixKeyword,purescriptNumber,purescriptAsKeyword,purescriptConstructor,purescriptStructure,purescriptFunction,purescriptBlockComment +  \ nextgroup=purescriptFunction,purescriptOperator,@purescriptComment + +" Operators +syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)" +syn match purescriptOperatorType "\(::\|∷\)" +  \ nextgroup=purescriptForall,purescriptType skipwhite skipnl skipempty +syn match purescriptOperatorFunction "\(->\|<-\|[\\→←]\)" +syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained +  \ nextgroup=purescriptType skipwhite skipnl skipempty + +" Type definition +syn region purescriptData start="^data\s\+\([A-Z]\w*\)" end="^\S"me=s-1,re=s-1 transparent +syn match purescriptDataStart "^data\s\+\([A-Z]\w*\)" contained +  \ containedin=purescriptData +  \ contains=purescriptStructure,purescriptType,purescriptTypeVar +syn match purescriptForeignData "\<foreign\s\+import\s\+data\>" +  \ contains=purescriptImportKeyword,purescriptStructure +  \ nextgroup=purescriptType skipwhite + +syn region purescriptNewtype start="^newtype\s\+\([A-Z]\w*\)" end="^\S"me=s-1,re=s-1 transparent +syn match purescriptNewtypeStart "^newtype\s\+\([A-Z]\w*\)" contained +  \ containedin=purescriptNewtype +  \ contains=purescriptStructure,purescriptType,purescriptTypeVar + +syn region purescriptTypeAlias start="^type\s\+\([A-Z]\w*\)" end="^\S"me=s-1,re=s-1 transparent +syn match purescriptTypeAliasStart "^type\s\+\([A-Z]\w*\)" contained +  \ containedin=purescriptTypeAlias +  \ contains=purescriptStructure,purescriptType,purescriptTypeVar + +" String  syn match purescriptChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'" -syn match purescriptBacktick "`[A-Za-z][A-Za-z0-9_]*`"  syn region purescriptString start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn region purescriptMultilineString start=+"""+ end=+"""+ -syn region purescriptBlockComment start="{-" end="-}" contains=purescriptBlockComment +syn region purescriptMultilineString start=+"""+ end=+"""+ fold + +" Comment +syn match purescriptLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" +syn region purescriptBlockComment start="{-" end="-}" fold +  \ contains=purescriptBlockComment +syn cluster purescriptComment contains=purescriptLineComment,purescriptBlockComment + +syn sync minlines=50 + +" highlight links +highlight def link purescriptModuleKeyword purescriptKeyword +highlight def link purescriptModuleName Include +highlight def link purescriptModuleParams purescriptDelimiter +highlight def link purescriptImportKeyword purescriptKeyword +highlight def link purescriptAsKeyword purescriptKeyword +highlight def link purescriptHidingKeyword purescriptKeyword -highlight def link purescriptImport Structure -highlight def link purescriptQualifiedImport Structure -highlight def link purescriptModule Structure -highlight def link purescriptStructure Structure -highlight def link purescriptStatement Statement  highlight def link purescriptConditional Conditional +highlight def link purescriptWhere purescriptKeyword +highlight def link purescriptInfixKeyword purescriptKeyword + +highlight def link purescriptBoolean Boolean  highlight def link purescriptNumber Number  highlight def link purescriptFloat Float +  highlight def link purescriptDelimiter Delimiter -highlight def link purescriptInfix PreProc -highlight def link purescriptOperators Operator -highlight def link purescriptDot Operator -highlight def link purescriptType Include -highlight def link purescriptLineComment Comment -highlight def link purescriptBlockComment Comment + +highlight def link purescriptOperatorTypeSig purescriptOperatorType +highlight def link purescriptOperatorFunction purescriptOperatorType +highlight def link purescriptOperatorType purescriptOperator + +highlight def link purescriptConstructorDecl purescriptConstructor +highlight def link purescriptConstructor purescriptFunction + +highlight def link purescriptTypeVar Identifier +highlight def link purescriptForall purescriptStatement + +highlight def link purescriptChar String +highlight def link purescriptBacktick purescriptOperator  highlight def link purescriptString String  highlight def link purescriptMultilineString String -highlight def link purescriptChar String -highlight def link purescriptBacktick Operator + +highlight def link purescriptLineComment purescriptComment +highlight def link purescriptBlockComment purescriptComment + +" purescript general highlights +highlight def link purescriptStructure purescriptKeyword +highlight def link purescriptKeyword Keyword +highlight def link purescriptStatement Statement +highlight def link purescriptOperator Operator +highlight def link purescriptFunction Function +highlight def link purescriptType Type +highlight def link purescriptComment Comment  let b:current_syntax = "purescript" diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 63ac6b46..ba7d9fe6 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -16,6 +16,10 @@ if exists("b:current_syntax")    finish  endif +" this file uses line continuations +let s:cpo_sav = &cpo +set cpo&vim +  " Folding Config {{{1  if has("folding") && exists("ruby_fold")    setlocal foldmethod=syntax @@ -140,7 +144,7 @@ endif  syn match  rubyCapitalizedMethod	"\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@="  syn match  rubyBlockParameter	  "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contained -syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter +syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" oneline display contains=rubyBlockParameter  syn match rubyInvalidVariable	 "$[^ A-Za-z_-]"  syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~]# @@ -544,6 +548,9 @@ hi def link rubySpaceError		rubyError  " Postscript {{{1  let b:current_syntax = "ruby" +let &cpo = s:cpo_sav +unlet! s:cpo_sav +  " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:  endif diff --git a/syntax/tmux.vim b/syntax/tmux.vim index 6c627fd5..abf4c21a 100644 --- a/syntax/tmux.vim +++ b/syntax/tmux.vim @@ -3,7 +3,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1  " Vim syntax file  " Language: tmux(1) configuration file  " Maintainer: Tiago Cunha <tcunha@users.sourceforge.net> -" Last Change: $Date: 2010-07-27 18:29:07 $  " License: This file is placed in the public domain.  "  " To install this file: @@ -230,6 +229,8 @@ syn keyword tmuxOptsSet  	\ set-titles  	\ set-titles-string  	\ status +	\ status-bg +	\ status-fg  	\ status-interval  	\ status-justify  	\ status-keys @@ -274,6 +275,7 @@ syn keyword tmuxOptsSetw  	\ window-active-style  	\ window-status-activity-style  	\ window-status-bell-style +	\ window-status-current-bg  	\ window-status-current-format  	\ window-status-current-style  	\ window-status-format diff --git a/syntax/typescript.vim b/syntax/typescript.vim index 12fd0fe5..f129731f 100644 --- a/syntax/typescript.vim +++ b/syntax/typescript.vim @@ -124,7 +124,7 @@ syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math  syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError -syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type namespace from get set +syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public type namespace from get set  "}}}  "" typescript/DOM/HTML/CSS specified things"{{{ | 
