This commit is contained in:
Adam Stankiewicz
2020-03-02 00:34:02 +01:00
parent 35ea4d2b90
commit 6b540d7db0
38 changed files with 1853 additions and 1031 deletions

View File

@@ -136,7 +136,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [php](https://github.com/StanAngeloff/php.vim) (syntax) - [php](https://github.com/StanAngeloff/php.vim) (syntax)
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin) - [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin)
- [pony](https://github.com/jakwings/vim-pony) (syntax, indent, autoload, ftplugin) - [pony](https://github.com/jakwings/vim-pony) (syntax, indent, autoload, ftplugin)
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, ftplugin) - [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, compiler, ftplugin)
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent) - [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin) - [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
- [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, autoload, ftplugin) - [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, autoload, ftplugin)
@@ -166,7 +166,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent) - [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent)
- [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent) - [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent)
- [svg](https://github.com/vim-scripts/svg.vim) (syntax) - [svg](https://github.com/vim-scripts/svg.vim) (syntax)
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin) - [swift](https://github.com/keith/swift.vim) (syntax, indent, compiler, ftplugin)
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax) - [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax, ftplugin) - [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax, ftplugin)
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, autoload, ftplugin) - [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, autoload, ftplugin)

View File

@@ -2,17 +2,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') =
"Vim conceal file "Vim conceal file
" Language: Mathematica " Language: Mathematica
" Maintainer: Voldikss <dyzplus@gmail.com> " Maintainer: R. Menon <rsmenon@icloud.com>
" Last Change: 2019 Jan 23 by Voldikss " Last Change: Feb 25, 2013
" Source: https://github.com/voldikss/vim-mma/after/syntax/mma.vim
" Credits:
" Rsmenon: https://github.com/rsmenon
if (exists('g:mma_candy') && g:mma_candy == 0) || !has('conceal') || &enc != 'utf-8' if (exists('g:mma_candy') && g:mma_candy == 0) || !has('conceal') || &enc != 'utf-8'
finish finish
endif endif
"These are fairly safe and straightforward conceals "These are fairly safe and straightforward conceals
if exists('g:mma_candy') && g:mma_candy > 0 if exists('g:mma_candy') && g:mma_candy > 0
"Rules "Rules

View File

@@ -42,8 +42,8 @@ syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil
syn keyword yamlConstant TRUE True true YES Yes yes ON On on syn keyword yamlConstant TRUE True true YES Yes yes ON On on
syn keyword yamlConstant FALSE False false NO No no OFF Off off syn keyword yamlConstant FALSE False false NO No no OFF Off off
syn match yamlKey "^\s*\zs[^ \t\"]\+\ze\s*:" syn match yamlKey "^\s*\zs[^ \t\"\'#]\+\ze\s*:"
syn match yamlKey "^\s*-\s*\zs[^ \t\"\']\+\ze\s*:" syn match yamlKey "^\s*-\s*\zs[^ \t\"\'#]\+\ze\s*:"
syn match yamlAnchor "&\S\+" syn match yamlAnchor "&\S\+"
syn match yamlAlias "*\S\+" syn match yamlAlias "*\S\+"

View File

@@ -13,6 +13,9 @@ function! s:L2U_Setup()
if !has_key(b:, "l2u_enabled") if !has_key(b:, "l2u_enabled")
let b:l2u_enabled = 0 let b:l2u_enabled = 0
endif endif
if !has_key(b:, "l2u_autodetect_enable")
let b:l2u_autodetect_enable = 1
endif
" Did we install the L2U tab mappings? " Did we install the L2U tab mappings?
if !has_key(b:, "l2u_tab_set") if !has_key(b:, "l2u_tab_set")
@@ -92,34 +95,39 @@ endfunction
" Each time the filetype changes, we may need to enable or " Each time the filetype changes, we may need to enable or
" disable the LaTeX-to-Unicode functionality " disable the LaTeX-to-Unicode functionality
function! LaTeXtoUnicode#Refresh() function! LaTeXtoUnicode#Refresh()
call s:L2U_Setup() call s:L2U_Setup()
" skip if manually overridden
if !b:l2u_autodetect_enable
return ''
endif
" by default, LaTeX-to-Unicode is only active on julia files " by default, LaTeX-to-Unicode is only active on julia files
let file_types = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types", "julia")) let file_types = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types", "julia"))
let file_types_blacklist = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types_blacklist", "$^")) let file_types_blacklist = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types_blacklist", "$^"))
if match(&filetype, file_types) < 0 || match(&filetype, file_types_blacklist) >= 0 if match(&filetype, file_types) < 0 || match(&filetype, file_types_blacklist) >= 0
if b:l2u_enabled if b:l2u_enabled
call LaTeXtoUnicode#Disable() call LaTeXtoUnicode#Disable(1)
else else
return return ''
endif endif
elseif !b:l2u_enabled elseif !b:l2u_enabled
call LaTeXtoUnicode#Enable() call LaTeXtoUnicode#Enable(1)
endif endif
endfunction endfunction
function! LaTeXtoUnicode#Enable() function! LaTeXtoUnicode#Enable(...)
let auto_set = a:0 > 0 ? a:1 : 0
if b:l2u_enabled if b:l2u_enabled
return return ''
end end
call s:L2U_ResetLastCompletionInfo() call s:L2U_ResetLastCompletionInfo()
let b:l2u_enabled = 1 let b:l2u_enabled = 1
let b:l2u_autodetect_enable = auto_set
" If we're editing the first file upon opening vim, this will only init the " If we're editing the first file upon opening vim, this will only init the
" command line mode mapping, and the full initialization will be performed by " command line mode mapping, and the full initialization will be performed by
@@ -127,18 +135,18 @@ function! LaTeXtoUnicode#Enable()
" Otherwise, if we're opening a file from within a running vim session, this " Otherwise, if we're opening a file from within a running vim session, this
" will actually initialize all the LaTeX-to-Unicode substitutions. " will actually initialize all the LaTeX-to-Unicode substitutions.
call LaTeXtoUnicode#Init() call LaTeXtoUnicode#Init()
return ''
return
endfunction endfunction
function! LaTeXtoUnicode#Disable() function! LaTeXtoUnicode#Disable(...)
let auto_set = a:0 > 0 ? a:1 : 0
if !b:l2u_enabled if !b:l2u_enabled
return return ''
endif endif
let b:l2u_enabled = 0 let b:l2u_enabled = 0
let b:l2u_autodetect_enable = auto_set
call LaTeXtoUnicode#Init() call LaTeXtoUnicode#Init()
return return ''
endfunction endfunction
" Translate old options to their new equivalents " Translate old options to their new equivalents
@@ -246,7 +254,6 @@ function! LaTeXtoUnicode#omnifunc(findstart, base)
endif endif
let b:l2u_in_fallback = 0 let b:l2u_in_fallback = 0
" set info for the callback " set info for the callback
let b:l2u_tab_completing = 1
let b:l2u_found_completion = 1 let b:l2u_found_completion = 1
" analyse current line " analyse current line
let col1 = col('.') let col1 = col('.')
@@ -375,6 +382,7 @@ function! LaTeXtoUnicode#Tab()
endif endif
" reset the in_fallback info " reset the in_fallback info
let b:l2u_in_fallback = 0 let b:l2u_in_fallback = 0
let b:l2u_tab_completing = 1
" temporary change to completeopt to use the `longest` setting, which is " temporary change to completeopt to use the `longest` setting, which is
" probably the only one which makes sense given that the goal of the " probably the only one which makes sense given that the goal of the
" completion is to substitute the final string " completion is to substitute the final string
@@ -383,7 +391,8 @@ function! LaTeXtoUnicode#Tab()
set completeopt-=noinsert set completeopt-=noinsert
" invoke omnicompletion; failure to perform LaTeX-to-Unicode completion is " invoke omnicompletion; failure to perform LaTeX-to-Unicode completion is
" handled by the CompleteDone autocommand. " handled by the CompleteDone autocommand.
return "\<C-X>\<C-O>" call feedkeys("\<C-X>\<C-O>", 'n')
return ""
endfunction endfunction
" This function is called at every CompleteDone event, and is meant to handle " This function is called at every CompleteDone event, and is meant to handle
@@ -409,7 +418,7 @@ function! LaTeXtoUnicode#FallbackCallback()
endfunction endfunction
" This is the function that performs the substitution in command-line mode " This is the function that performs the substitution in command-line mode
function! LaTeXtoUnicode#CmdTab(triggeredbytab) function! LaTeXtoUnicode#CmdTab(trigger)
" first stage " first stage
" analyse command line " analyse command line
let col1 = getcmdpos() - 1 let col1 = getcmdpos() - 1
@@ -418,10 +427,12 @@ function! LaTeXtoUnicode#CmdTab(triggeredbytab)
let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0) let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0)
" completion not found " completion not found
if col0 == -1 if col0 == -1
if a:triggeredbytab if a:trigger == &wildchar
call feedkeys("\<Tab>", 'nt') " fall-back to the default <Tab> call feedkeys(nr2char(a:trigger), 'nt') " fall-back to the default wildchar
elseif a:trigger == char2nr("\<S-Tab>")
call feedkeys("\<S-Tab>", 'nt') " fall-back to the default <S-Tab>
endif endif
return l return ''
endif endif
let base = l[col0 : col1-1] let base = l[col0 : col1-1]
" search for matches " search for matches
@@ -430,39 +441,28 @@ function! LaTeXtoUnicode#CmdTab(triggeredbytab)
for k in keys(g:l2u_symbols_dict) for k in keys(g:l2u_symbols_dict)
if k ==# base if k ==# base
let exact_match = 1 let exact_match = 1
endif break
if len(k) >= len(base) && k[0 : len(base)-1] ==# base elseif len(k) >= len(base) && k[0 : len(base)-1] ==# base
call add(partmatches, k) call add(partmatches, k)
endif endif
endfor endfor
if len(partmatches) == 0 if !exact_match && len(partmatches) == 0
if a:triggeredbytab " no matches, call fallbacks
call feedkeys("\<Tab>", 'nt') " fall-back to the default <Tab> if a:trigger == &wildchar
call feedkeys(nr2char(a:trigger), 'nt') " fall-back to the default wildchar
elseif a:trigger == char2nr("\<S-Tab>")
call feedkeys("\<S-Tab>", 'nt') " fall-back to the default <S-Tab>
endif endif
return l elseif exact_match
endif " exact matches are replaced with Unicode
" exact matches are replaced with Unicode
if exact_match
let unicode = g:l2u_symbols_dict[base] let unicode = g:l2u_symbols_dict[base]
if col0 > 0 call feedkeys(repeat("\b", len(base)) . unicode, 'nt')
let pre = l[0 : col0 - 1]
else
let pre = ''
endif
let posdiff = col1-col0 - len(unicode)
call setcmdpos(col1 - posdiff + 1)
return pre . unicode . l[col1 : -1]
endif
" no exact match: complete with the longest common prefix
let common = s:L2U_longest_common_prefix(partmatches)
if col0 > 0
let pre = l[0 : col0 - 1]
else else
let pre = '' " no exact match: complete with the longest common prefix
let common = s:L2U_longest_common_prefix(partmatches)
call feedkeys(common[len(base):], 'nt')
endif endif
let posdiff = col1-col0 - len(common) return ''
call setcmdpos(col1 - posdiff + 1)
return pre . common . l[col1 : -1]
endfunction endfunction
" Setup the L2U tab mapping " Setup the L2U tab mapping
@@ -473,7 +473,8 @@ function! s:L2U_SetTab(wait_insert_enter)
let b:l2u_cmdtab_keys = [b:l2u_cmdtab_keys] let b:l2u_cmdtab_keys = [b:l2u_cmdtab_keys]
endif endif
for k in b:l2u_cmdtab_keys for k in b:l2u_cmdtab_keys
exec 'cnoremap <buffer> '.k.' <C-\>eLaTeXtoUnicode#CmdTab('.(k ==? '<Tab>').')<CR>' exec 'let trigger = char2nr("'.(k[0] == '<' ? '\' : '').k.'")'
exec 'cnoremap <buffer><expr> '.k.' LaTeXtoUnicode#CmdTab('.trigger.')'
endfor endfor
let b:l2u_cmdtab_set = 1 let b:l2u_cmdtab_set = 1
endif endif
@@ -637,6 +638,7 @@ function! LaTeXtoUnicode#Init(...)
call s:L2U_SetTab(wait_insert_enter) call s:L2U_SetTab(wait_insert_enter)
call s:L2U_SetAutoSub(wait_insert_enter) call s:L2U_SetAutoSub(wait_insert_enter)
call s:L2U_SetKeymap() call s:L2U_SetKeymap()
return ''
endfunction endfunction
function! LaTeXtoUnicode#Toggle() function! LaTeXtoUnicode#Toggle()
@@ -648,7 +650,7 @@ function! LaTeXtoUnicode#Toggle()
call LaTeXtoUnicode#Enable() call LaTeXtoUnicode#Enable()
echo "LaTeX-to-Unicode enabled" echo "LaTeX-to-Unicode enabled"
endif endif
return return ''
endfunction endfunction
endif endif

View File

@@ -1,14 +1,16 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
function! cargo#Load() function! cargo#Load()
" Utility call to get this script loaded, for debugging " Utility call to get this script loaded, for debugging
endfunction endfunction
function! cargo#cmd(args) function! cargo#cmd(args) abort
" Trim trailing spaces. This is necessary since :terminal command parses " Trim trailing spaces. This is necessary since :terminal command parses
" trailing spaces as an empty argument. " trailing spaces as an empty argument.
let args = substitute(a:args, '\s\+$', '', '') let args = substitute(a:args, '\s\+$', '', '')
if has('terminal') if exists('g:cargo_shell_command_runner')
let cmd = g:cargo_shell_command_runner
elseif has('terminal')
let cmd = 'terminal' let cmd = 'terminal'
elseif has('nvim') elseif has('nvim')
let cmd = 'noautocmd new | terminal' let cmd = 'noautocmd new | terminal'
@@ -67,6 +69,10 @@ function! cargo#build(args)
call cargo#cmd("build " . a:args) call cargo#cmd("build " . a:args)
endfunction endfunction
function! cargo#check(args)
call cargo#cmd("check " . a:args)
endfunction
function! cargo#clean(args) function! cargo#clean(args)
call cargo#cmd("clean " . a:args) call cargo#cmd("clean " . a:args)
endfunction endfunction

View File

@@ -7,6 +7,8 @@ let s:V = vital#crystal#new()
let s:P = s:V.import('Process') let s:P = s:V.import('Process')
let s:C = s:V.import('ColorEcho') let s:C = s:V.import('ColorEcho')
let s:IS_WINDOWS = has('win32')
if exists('*json_decode') if exists('*json_decode')
function! s:decode_json(text) abort function! s:decode_json(text) abort
return json_decode(a:text) return json_decode(a:text)
@@ -299,29 +301,47 @@ function! crystal_lang#run_current_spec(...) abort
endfunction endfunction
function! crystal_lang#format_string(code, ...) abort function! crystal_lang#format_string(code, ...) abort
if s:IS_WINDOWS
let redirect = '2> nul'
else
let redirect = '2>/dev/null'
endif
let cmd = printf( let cmd = printf(
\ '%s tool format --no-color %s -', \ '%s tool format --no-color %s - %s',
\ g:crystal_compiler_command, \ g:crystal_compiler_command,
\ get(a:, 1, '') \ get(a:, 1, ''),
\ redirect,
\ ) \ )
let output = s:P.system(cmd, a:code) let output = s:P.system(cmd, a:code)
if s:P.get_last_status() if s:P.get_last_status()
throw 'vim-crystal: Error on formatting: ' . output throw 'vim-crystal: Error on formatting with command: ' . cmd
endif endif
return output return output
endfunction endfunction
" crystal_lang#format(option_str [, on_save]) " crystal_lang#format(option_str [, on_save])
function! crystal_lang#format(option_str, ...) abort function! crystal_lang#format(option_str, ...) abort
if !executable(g:crystal_compiler_command)
" Finish command silently
return
endif
let on_save = a:0 > 0 ? a:1 : 0 let on_save = a:0 > 0 ? a:1 : 0
if !executable(g:crystal_compiler_command)
if on_save
" Finish command silently on save
return
else
throw 'vim-crystal: Command for formatting is not executable: ' . g:crystal_compiler_command
endif
endif
let before = join(getline(1, '$'), "\n") let before = join(getline(1, '$'), "\n")
let formatted = crystal_lang#format_string(before, a:option_str) try
let formatted = crystal_lang#format_string(before, a:option_str)
catch /^vim-crystal: /
echohl ErrorMsg
echomsg v:exception . ': Your code was not formatted. Exception was thrown at ' . v:throwpoint
echohl None
return
endtry
if !on_save if !on_save
let after = substitute(formatted, '\n$', '', '') let after = substitute(formatted, '\n$', '', '')
if before ==# after if before ==# after

View File

@@ -635,8 +635,12 @@ fu! csv#ArrangeCol(first, last, bang, limit, ...) range "{{{3
return return
endif endif
let cur=winsaveview() let cur=winsaveview()
" be sure, that b:col_width is actually valid
if exists("b:col_width") && eval(join(b:col_width, '+')) == 0
unlet! b:col_width
endif
" Force recalculation of Column width " Force recalculation of Column width
let row = exists("a:1") ? a:1 : line('$') let row = exists("a:1") && !empty(a:1) ? a:1 : line('$')
if a:bang || !empty(row) if a:bang || !empty(row)
if a:bang && exists("b:col_width") if a:bang && exists("b:col_width")
" Unarrange, so that if csv_arrange_align has changed " Unarrange, so that if csv_arrange_align has changed

View File

@@ -60,7 +60,10 @@ function! go#config#SetTermCloseOnExit(value) abort
endfunction endfunction
function! go#config#TermEnabled() abort function! go#config#TermEnabled() abort
return has('nvim') && get(g:, 'go_term_enabled', 0) " nvim always support
" vim will support if terminal feature exists
let l:support = has('nvim') || has('terminal')
return support && get(g:, 'go_term_enabled', 0)
endfunction endfunction
function! go#config#SetTermEnabled(value) abort function! go#config#SetTermEnabled(value) abort
@@ -162,23 +165,6 @@ function! go#config#SetGuruScope(scope) abort
endif endif
endfunction endfunction
function! go#config#GocodeUnimportedPackages() abort
return get(g:, 'go_gocode_unimported_packages', 0)
endfunction
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
function! go#config#GocodeSocketType() abort
return get(g:, 'go_gocode_socket_type', s:sock_type)
endfunction
function! go#config#GocodeProposeBuiltins() abort
return get(g:, 'go_gocode_propose_builtins', 1)
endfunction
function! go#config#GocodeProposeSource() abort
return get(g:, 'go_gocode_propose_source', 0)
endfunction
function! go#config#EchoCommandInfo() abort function! go#config#EchoCommandInfo() abort
return get(g:, 'go_echo_command_info', 1) return get(g:, 'go_echo_command_info', 1)
endfunction endfunction
@@ -263,6 +249,10 @@ function! go#config#AddtagsTransform() abort
return get(g:, 'go_addtags_transform', "snakecase") return get(g:, 'go_addtags_transform', "snakecase")
endfunction endfunction
function! go#config#AddtagsSkipUnexported() abort
return get(g:, 'go_addtags_skip_unexported', 0)
endfunction
function! go#config#TemplateAutocreate() abort function! go#config#TemplateAutocreate() abort
return get(g:, "go_template_autocreate", 1) return get(g:, "go_template_autocreate", 1)
endfunction endfunction
@@ -491,6 +481,10 @@ function! go#config#HighlightDebug() abort
return get(g:, 'go_highlight_debug', 1) return get(g:, 'go_highlight_debug', 1)
endfunction endfunction
function! go#config#DebugBreakpointSignText() abort
return get(g:, 'go_debug_breakpoint_sign_text', '>')
endfunction
function! go#config#FoldEnable(...) abort function! go#config#FoldEnable(...) abort
if a:0 > 0 if a:0 > 0
return index(go#config#FoldEnable(), a:1) > -1 return index(go#config#FoldEnable(), a:1) > -1
@@ -516,23 +510,30 @@ function! go#config#ReferrersMode() abort
endfunction endfunction
function! go#config#GoplsCompleteUnimported() abort function! go#config#GoplsCompleteUnimported() abort
return get(g:, 'go_gopls_complete_unimported', 0) return get(g:, 'go_gopls_complete_unimported', v:null)
endfunction endfunction
function! go#config#GoplsDeepCompletion() abort function! go#config#GoplsDeepCompletion() abort
return get(g:, 'go_gopls_deep_completion', 1) return get(g:, 'go_gopls_deep_completion', v:null)
endfunction endfunction
function! go#config#GoplsFuzzyMatching() abort function! go#config#GoplsMatcher() abort
return get(g:, 'go_gopls_fuzzy_matching', 1) if !exists('g:go_gopls_matcher') && get(g:, 'g:go_gopls_fuzzy_matching', v:null) is 1
return 'fuzzy'
endif
return get(g:, 'go_gopls_matcher', v:null)
endfunction endfunction
function! go#config#GoplsStaticCheck() abort function! go#config#GoplsStaticCheck() abort
return get(g:, 'go_gopls_staticcheck', 0) return get(g:, 'go_gopls_staticcheck', v:null)
endfunction endfunction
function! go#config#GoplsUsePlaceholders() abort function! go#config#GoplsUsePlaceholders() abort
return get(g:, 'go_gopls_use_placeholders', 0) return get(g:, 'go_gopls_use_placeholders', v:null)
endfunction
function! go#config#GoplsTempModfile() abort
return get(g:, 'go_gopls_temp_modfile', v:null)
endfunction endfunction
function! go#config#GoplsEnabled() abort function! go#config#GoplsEnabled() abort
@@ -543,6 +544,10 @@ function! go#config#DiagnosticsEnabled() abort
return get(g:, 'go_diagnostics_enabled', 0) return get(g:, 'go_diagnostics_enabled', 0)
endfunction endfunction
function! go#config#GoplsOptions() abort
return get(g:, 'go_gopls_options', [])
endfunction
" Set the default value. A value of "1" is a shortcut for this, for " Set the default value. A value of "1" is a shortcut for this, for
" compatibility reasons. " compatibility reasons.
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1 if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1

View File

@@ -1,30 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
function! julia#set_syntax_version(jvers) function! julia#set_syntax_version(jvers)
if &filetype != "julia" echo "The julia#set_syntax_version function is deprecated"
echo "Not a Julia file"
return
endif
syntax clear
let b:julia_syntax_version = a:jvers
set filetype=julia
endfunction endfunction
function! julia#toggle_deprecated_syntax() function! julia#toggle_deprecated_syntax()
if &filetype != "julia" echo "The julia#toggle_deprecated_syntax function is deprecated"
echo "Not a Julia file"
return
endif
syntax clear
let hd = get(b:, "julia_syntax_highlight_deprecated",
\ get(g:, "julia_syntax_highlight_deprecated", 0))
let b:julia_syntax_highlight_deprecated = hd ? 0 : 1
set filetype=julia
if b:julia_syntax_highlight_deprecated
echo "Highlighting of deprecated syntax enabled"
else
echo "Highlighting of deprecated syntax disabled"
endif
endfunction endfunction
if exists("loaded_matchit") if exists("loaded_matchit")

View File

@@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
" This file is autogenerated from the script 'generate_latex_symbols_table.jl' " This file is autogenerated from the script 'generate_latex_symbols_table.jl'
" The symbols are based on Julia version 1.3.0-DEV.263 " The symbols are based on Julia version 1.5.0-DEV.67
scriptencoding utf-8 scriptencoding utf-8
@@ -658,7 +658,9 @@ function! julia_latex_symbols#get_dict()
\ '\nequiv': '≢', \ '\nequiv': '≢',
\ '\Equiv': '≣', \ '\Equiv': '≣',
\ '\le': '≤', \ '\le': '≤',
\ '\leq': '≤',
\ '\ge': '≥', \ '\ge': '≥',
\ '\geq': '≥',
\ '\leqq': '≦', \ '\leqq': '≦',
\ '\geqq': '≧', \ '\geqq': '≧',
\ '\lneqq': '≨', \ '\lneqq': '≨',

View File

@@ -7,9 +7,6 @@ set cpoptions&vim
let $TF_CLI_ARGS_fmt='' let $TF_CLI_ARGS_fmt=''
function! terraform#fmt() function! terraform#fmt()
if !filereadable(expand('%:p'))
return
endif
let l:curw = winsaveview() let l:curw = winsaveview()
" Make a fake change so that the undo point is right. " Make a fake change so that the undo point is right.
normal! ix normal! ix

80
compiler/powershell.vim Normal file
View File

@@ -0,0 +1,80 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') == -1
" Compiler: powershell
" Run ps1 scripts in powershell and process their output. Quickly jump through
" stack traces and see script output in the quickfix.
if exists("current_compiler")
finish
endif
let current_compiler = "powershell"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
if !exists("g:ps1_makeprg_cmd")
if !has('win32') || executable('pwsh')
" pwsh is the future
let g:ps1_makeprg_cmd = 'pwsh'
else
" powershell is Windows-only
let g:ps1_makeprg_cmd = 'powershell'
endif
endif
" Show CategoryInfo, FullyQualifiedErrorId, etc?
let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0)
" Use absolute path because powershell requires explicit relative paths
" (./file.ps1 is okay, but # expands to file.ps1)
let &l:makeprg = g:ps1_makeprg_cmd .' %:p'
" Parse file, line, char from callstacks:
" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a
" cmdlet, function, script file, or operable program. Check the spelling
" of the name, or if a path was included, verify that the path is correct
" and try again.
" At C:\script.ps1:11 char:5
" + Write-Ouput $content
" + ~~~~~~~~~~~
" + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException
" + FullyQualifiedErrorId : CommandNotFoundException
" Showing error in context with underlining.
CompilerSet errorformat=%+G+%m
" Error summary.
CompilerSet errorformat+=%E%*\\S\ :\ %m
" Error location.
CompilerSet errorformat+=%CAt\ %f:%l\ char:%c
" Errors that span multiple lines (may be wrapped to width of terminal).
CompilerSet errorformat+=%C%m
" Ignore blank/whitespace-only lines.
CompilerSet errorformat+=%Z\\s%#
if g:ps1_efm_show_error_categories
CompilerSet errorformat^=%+G\ \ \ \ +\ %.%#\\s%#:\ %m
else
CompilerSet errorformat^=%-G\ \ \ \ +\ %.%#\\s%#:\ %m
endif
" Parse file, line, char from of parse errors:
" At C:\script.ps1:22 char:16
" + Stop-Process -Name "invalidprocess
" + ~~~~~~~~~~~~~~~
" The string is missing the terminator: ".
" + CategoryInfo : ParserError: (:) [], ParseException
" + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
CompilerSet errorformat+=At\ %f:%l\ char:%c
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2:
endif

43
compiler/swift.vim Normal file
View File

@@ -0,0 +1,43 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
" Vim compiler file
" Compiler: Swift Compiler
" Maintainer: Ayman Bagabas <ayman.bagabas@gmail.com>
" Latest Revision: 2020 Feb 16
if exists("current_compiler")
finish
endif
let current_compiler = "swiftc"
" vint: -ProhibitAbbreviationOption
let s:save_cpo = &cpo
set cpo&vim
" vint: +ProhibitAbbreviationOption
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
if has('patch-7.4.191')
CompilerSet makeprg=swiftc\ \%:S
else
CompilerSet makeprg=swiftc\ \%
endif
CompilerSet errorformat=
\%E%f:%l:%c:\ %trror:\ %m,
\%W%f:%l:%c:\ %tarning:\ %m,
\%I%f:%l:%c:\ note:\ %m,
\%E%f:%l:\ %trror:\ %m,
\%W%f:%l:\ %tarning:\ %m,
\%I%f:%l:\ note:\ %m,
" vint: -ProhibitAbbreviationOption
let &cpo = s:save_cpo
unlet s:save_cpo
" vint: +ProhibitAbbreviationOption
" vim: set et sw=4 sts=4 ts=8:
endif

View File

@@ -831,8 +831,10 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
augroup filetypedetect augroup filetypedetect
" mathematica, from mma.vim in voldikss/vim-mma " mathematica, from mma.vim in voldikss/vim-mma
autocmd BufNewFile,BufRead *.wl set filetype=mma autocmd BufNewFile,BufRead *.wl setfiletype mma
autocmd BufNewFile,BufRead *.wls set filetype=mma autocmd BufNewFile,BufRead *.wls setfiletype mma
autocmd BufNewFile,BufRead *.nb setfiletype mma
autocmd BufNewFile,BufRead *.m setfiletype mma
augroup end augroup end
endif endif
@@ -913,7 +915,7 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect augroup filetypedetect
" ocaml, from dune.vim in rgrinberg/vim-ocaml " ocaml, from dune.vim in rgrinberg/vim-ocaml
au BufRead,BufNewFile jbuild,dune,dune-project set ft=dune au BufRead,BufNewFile jbuild,dune,dune-project,dune-workspace set ft=dune
augroup end augroup end
endif endif

View File

@@ -43,30 +43,30 @@ setlocal errorformat=
let g:crystal_compiler_command = get(g:, 'crystal_compiler_command', 'crystal') let g:crystal_compiler_command = get(g:, 'crystal_compiler_command', 'crystal')
let g:crystal_auto_format = get(g:, 'crystal_auto_format', 0) let g:crystal_auto_format = get(g:, 'crystal_auto_format', 0)
command! -buffer -nargs=* CrystalImpl echo crystal_lang#impl(expand('%'), getpos('.'), <q-args>).output command! -buffer -nargs=* CrystalImpl echo crystal_lang#impl(expand('%'), getpos('.'), <q-args>).output
command! -buffer -nargs=0 CrystalDef call crystal_lang#jump_to_definition(expand('%'), getpos('.')) command! -buffer -nargs=0 CrystalDef call crystal_lang#jump_to_definition(expand('%'), getpos('.'))
command! -buffer -nargs=* CrystalContext echo crystal_lang#context(expand('%'), getpos('.'), <q-args>).output command! -buffer -nargs=* CrystalContext echo crystal_lang#context(expand('%'), getpos('.'), <q-args>).output
command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expand('%'), <q-args>) command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expand('%'), <q-args>)
command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>) command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>) command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>) command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0) command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0)
command! -buffer -nargs=* CrystalExpand echo crystal_lang#expand(expand('%'), getpos('.'), <q-args>).output command! -buffer -nargs=* CrystalExpand echo crystal_lang#expand(expand('%'), getpos('.'), <q-args>).output
nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR> nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR> nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
nnoremap <buffer><Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR> nnoremap <buffer><Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
nnoremap <buffer><Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR> nnoremap <buffer><Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
nnoremap <buffer><Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR> nnoremap <buffer><Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
nnoremap <buffer><Plug>(crystal-format) :<C-u>CrystalFormat<CR> nnoremap <buffer><Plug>(crystal-format) :<C-u>CrystalFormat<CR>
augroup plugin-ft-crystal augroup plugin-ft-crystal
autocmd BufWritePre <buffer> if g:crystal_auto_format | call crystal_lang#format('', 1) | endif autocmd BufWritePre <buffer> if g:crystal_auto_format | call crystal_lang#format('', 1) | endif
augroup END augroup END
if get(g:, 'crystal_define_mappings', 1) if get(g:, 'crystal_define_mappings', 1)
nmap <buffer>gd <Plug>(crystal-jump-to-definition) nmap <buffer>gd <Plug>(crystal-jump-to-definition)
nmap <buffer>gc <Plug>(crystal-show-context) nmap <buffer>gc <Plug>(crystal-show-context)
nmap <buffer>gss <Plug>(crystal-spec-switch) nmap <buffer>gss <Plug>(crystal-spec-switch)
nmap <buffer>gsa <Plug>(crystal-spec-run-all) nmap <buffer>gsa <Plug>(crystal-spec-run-all)
nmap <buffer>gsc <Plug>(crystal-spec-run-current) nmap <buffer>gsc <Plug>(crystal-spec-run-current)

View File

@@ -11,6 +11,4 @@ set lisp
setl commentstring=;\ %s setl commentstring=;\ %s
setl comments=:; setl comments=:;
setl iskeyword+=#,?,.,/
endif endif

View File

@@ -113,7 +113,7 @@ else
if !exists('g:ruby_default_path') if !exists('g:ruby_default_path')
if has("ruby") && has("win32") if has("ruby") && has("win32")
ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) ) ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) )
elseif executable('ruby') elseif executable('ruby') && !empty($HOME)
let g:ruby_default_path = s:query_path($HOME) let g:ruby_default_path = s:query_path($HOME)
else else
let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val') let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val')

View File

@@ -5,8 +5,23 @@ if exists('b:did_ftplugin')
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
setlocal formatoptions=t formatoptions+=croql
" j was only added in 7.3.541, so stop complaints about its nonexistence
" Where it makes sense, remove a comment leader when joining lines.
silent! setlocal formatoptions+=j
setlocal efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m setlocal efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:O//
setlocal commentstring=//%s
" When the matchit plugin is loaded, this makes the % command skip parens and
" braces in comments.
let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>'
let b:match_skip = 's:comment\|string\|character\|special'
" Insert a CCode attribute for the symbol below the cursor " Insert a CCode attribute for the symbol below the cursor
" https://wiki.gnome.org/Projects/Vala/LegacyBindings " https://wiki.gnome.org/Projects/Vala/LegacyBindings
function! CCode() abort function! CCode() abort
@@ -26,4 +41,11 @@ if get(g:, 'vala_syntax_folding_enabled', 1)
setlocal foldmethod=syntax setlocal foldmethod=syntax
endif endif
" filter files in the browse dialog
if (has("browsefilter")) && !exists("b:browsefilter")
let b:browsefilter = "Vala Source Files (*.vala)\t*.vala\n" .
\ "Vala Vapi Files (*.vapi)\t*.vapi\n" .
\ "All Files (*.*)\t*.*\n"
endif
endif endif

View File

@@ -17,7 +17,7 @@ setlocal nosmartindent
setlocal indentexpr=GetCrystalIndent(v:lnum) setlocal indentexpr=GetCrystalIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,. setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,.
setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
setlocal indentkeys+==private,=protected,=public setlocal indentkeys+==private,=protected
" Only define the function once. " Only define the function once.
if exists('*GetCrystalIndent') if exists('*GetCrystalIndent')
@@ -49,12 +49,12 @@ let s:skip_expr =
" Regex used for words that, at the start of a line, add a level of indent. " Regex used for words that, at the start of a line, add a level of indent.
let s:crystal_indent_keywords = let s:crystal_indent_keywords =
\ '^\s*\zs\<\%(module\|\%(private\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)\|enum\|if' . \ '^\s*\zs\<\%(\%(\%(private\|protected\)\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)' .
\ '\|for\|macro\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\|lib' . \ '\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\|union' .
\ '\|\%(protected\|private\)\=\s*def\):\@!\>' . \ '\|\%(private\|protected\)\=\s*\%(def\|class\|struct\|module\|macro\|lib\|enum\)\):\@!\>' .
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' . \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
\ '\|{%\s*\<\%(if\|for\|while\|until\|lib\|case\|unless\|begin\|else\|elsif\|when\)' \ '\|{%\s*\<\%(if\|for\|while\|until\|case\|unless\|begin\|else\|elsif\|when\)'
" Regex used for words that, at the start of a line, remove a level of indent. " Regex used for words that, at the start of a line, remove a level of indent.
let s:crystal_deindent_keywords = let s:crystal_deindent_keywords =
@@ -64,10 +64,11 @@ let s:crystal_deindent_keywords =
" Regex that defines the start-match for the 'end' keyword. " Regex that defines the start-match for the 'end' keyword.
" TODO: the do here should be restricted somewhat (only at end of line)? " TODO: the do here should be restricted somewhat (only at end of line)?
let s:end_start_regex = let s:end_start_regex =
\ '{%\s*\<\%(if\|for\|while\|until\|unless\|begin\|lib\)\>\|' . \ '{%\s*\<\%(if\|for\|while\|until\|unless\|begin\)\>\|' .
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(module\|\%(private\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)\|enum\|macro\|if\|for\|while\|until\|case\|unless\|begin\|lib' . \ '\<\%(\%(\%(private\|protected\)\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)' .
\ '\|\%(protected\|private\)\=\s*def\):\@!\>' . \ '\|if\|for\|while\|until\|case\|unless\|begin\|union' .
\ '\|\%(private\|protected\)\=\s*\%(def\|lib\|enum\|macro\|module\)\):\@!\>' .
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>' \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword. " Regex that defines the middle-match for the 'end' keyword.
@@ -122,7 +123,7 @@ let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex
let s:leading_operator_regex = '^\s*[.]' let s:leading_operator_regex = '^\s*[.]'
" Regex that describes all indent access modifiers " Regex that describes all indent access modifiers
let s:access_modifier_regex = '\C^\s*\%(public\|protected\|private\)\s*\%(#.*\)\=$' let s:access_modifier_regex = '\C^\s*\%(protected\|private\)\s*\%(#.*\)\=$'
" 2. Auxiliary Functions {{{1 " 2. Auxiliary Functions {{{1
" ====================== " ======================

View File

@@ -50,9 +50,8 @@ function GetJuliaNestingStruct(lnum, ...)
let e = a:0 > 1 ? a:2 : -1 let e = a:0 > 1 ? a:2 : -1
let blocks_stack = [] let blocks_stack = []
let num_closed_blocks = 0 let num_closed_blocks = 0
let tt = get(b:, 'julia_syntax_version', 10) == 6 ? '\|\%(\%(abstract\|primitive\)\s\+\)\@<!type' : ''
while 1 while 1
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\?\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|immutable\|let\|\%(bare\)\?module\|quote\|do'.tt.'\)\>', s, e) let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\?\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|immutable\|let\|\%(bare\)\?module\|quote\|do\)\>', s, e)
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s, e) let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s, e)
if fb < 0 && fe < 0 if fb < 0 && fe < 0
@@ -134,7 +133,7 @@ function GetJuliaNestingStruct(lnum, ...)
continue continue
endif endif
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|\%(staged\)\?function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\|immutable\|let\|quote\|do'.tt.'\)\>', s) let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|\%(staged\)\?function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\|immutable\|let\|quote\|do\)\>', s)
if i >= 0 && i == fb if i >= 0 && i == fb
if match(line, '\C\<\%(mutable\|abstract\|primitive\)', i) != -1 if match(line, '\C\<\%(mutable\|abstract\|primitive\)', i) != -1
let s = i+11 let s = i+11

View File

@@ -78,7 +78,7 @@ function! s:is_string_comment(lnum, col)
if has('syntax_items') if has('syntax_items')
for id in synstack(a:lnum, a:col) for id in synstack(a:lnum, a:col)
let synname = synIDattr(id, "name") let synname = synIDattr(id, "name")
if synname == "rustString" || synname =~ "^rustComment" if synname == "reasonString" || synname =~ "^reasonComment"
return 1 return 1
endif endif
endfor endfor
@@ -97,7 +97,7 @@ function GetReasonIndent(lnum)
if has('syntax_items') if has('syntax_items')
let synname = synIDattr(synID(a:lnum, 1, 1), "name") let synname = synIDattr(synID(a:lnum, 1, 1), "name")
if synname == "rustString" if synname == "reasonString"
" If the start of the line is in a string, don't change the indent " If the start of the line is in a string, don't change the indent
return -1 return -1
elseif synname =~ '\(Comment\|Todo\)' elseif synname =~ '\(Comment\|Todo\)'

View File

@@ -20,7 +20,7 @@ syntax match typescriptSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x
" From vim runtime " From vim runtime
" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48> " <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48>
syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}]+me=e-1 nextgroup=typescriptDotNotation oneline syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}:]+me=e-1 nextgroup=typescriptDotNotation oneline
syntax region typescriptTemplate syntax region typescriptTemplate
\ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ \ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/

View File

@@ -86,7 +86,7 @@ syntax region typescriptObjectType matchgroup=typescriptBraces
\ start=/{/ end=/}/ \ start=/{/ end=/}/
\ contains=@typescriptTypeMember,typescriptEndColons,@typescriptComments,typescriptAccessibilityModifier,typescriptReadonlyModifier \ contains=@typescriptTypeMember,typescriptEndColons,@typescriptComments,typescriptAccessibilityModifier,typescriptReadonlyModifier
\ nextgroup=@typescriptTypeOperator \ nextgroup=@typescriptTypeOperator
\ contained skipwhite fold \ contained skipwhite skipnl fold
syntax cluster typescriptTypeMember contains= syntax cluster typescriptTypeMember contains=
\ @typescriptCallSignature, \ @typescriptCallSignature,

View File

@@ -39,7 +39,7 @@ syn keyword carpFunc println print get-line from-string mod random
syn keyword carpFunc random-between str mask delete append length duplicate syn keyword carpFunc random-between str mask delete append length duplicate
syn keyword carpFunc cstr chars from-chars to-int from-int sin cos sqrt acos syn keyword carpFunc cstr chars from-chars to-int from-int sin cos sqrt acos
syn keyword carpFunc atan2 exit time seed-random for cond floor abs sort-with syn keyword carpFunc atan2 exit time seed-random for cond floor abs sort-with
syn keyword carpFunc subarray prefix-array suffix-array reverse sum min max syn keyword carpFunc slice prefix suffix reverse sum min max
syn keyword carpFunc first last reduce format zero read-file bit-shift-left syn keyword carpFunc first last reduce format zero read-file bit-shift-left
syn keyword carpFunc bit-shift-right bit-and bit-or bit-xor bit-not safe-add syn keyword carpFunc bit-shift-right bit-and bit-or bit-xor bit-not safe-add
syn keyword carpFunc safe-sub safe-mul even? odd? cmp allocate repeat-indexed syn keyword carpFunc safe-sub safe-mul even? odd? cmp allocate repeat-indexed
@@ -47,8 +47,8 @@ syn keyword carpFunc sanitize-addresses memory-balance reset-memory-balance!
syn keyword carpFunc log-memory-balance! memory-logged assert-balanced trace syn keyword carpFunc log-memory-balance! memory-logged assert-balanced trace
syn keyword carpFunc assert syn keyword carpFunc assert
syn keyword carpFunc pi e swap! update! char-at tail head split-by words lines syn keyword carpFunc pi e swap! update! char-at tail head split-by words lines
syn keyword carpFunc pad-left pad-right count-char empty? random-sized substring syn keyword carpFunc pad-left pad-right count-char empty? random-sized
syn keyword carpFunc prefix-string suffix-string starts-with? ends-with? syn keyword carpFunc starts-with? ends-with?
syn keyword carpFunc string-join free sleep-seconds sleep-micros substitute syn keyword carpFunc string-join free sleep-seconds sleep-micros substitute
syn keyword carpFunc neg to-float match matches? find global-match match-str syn keyword carpFunc neg to-float match matches? find global-match match-str
syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp
@@ -111,7 +111,7 @@ syn match carpNumber "\<[-+]\?\d\+/\d\+[lfb]\?\>" contains=carpContainedNumbe
syn keyword carpBoolean true false syn keyword carpBoolean true false
syn match carpChar "\<\\.\w\@!" syn match carpChar "\\\(\(newline\)\|\(space\)\|\(tab\)\|\(.\)\)"
syn region carpQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal syn region carpQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
syn region carpQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=@carpQuotedStuff,@carpQuotedOrNormal syn region carpQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=@carpQuotedStuff,@carpQuotedOrNormal

View File

@@ -1,16 +1,67 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" Language: Crystal " Language: Crystal
" Maintainer: rhysd <https://rhysd.github.io>
"
" Based on Ruby syntax highlight " Based on Ruby syntax highlight
" which was made by Mirko Nasato and Doug Kearns " which was made by Mirko Nasato and Doug Kearns
" --------------------------------------------- " ----------------------------------------------
" Prelude
if exists('b:current_syntax') if exists('b:current_syntax')
finish finish
endif endif
" eCrystal Config
if exists('g:main_syntax') && g:main_syntax ==# 'ecrystal'
let b:crystal_no_expensive = 1
end
" Folding Config
if has('folding') && exists('g:crystal_fold')
setlocal foldmethod=syntax
endif
let s:foldable_groups = split(
\ get(
\ b:,
\ 'crystal_foldable_groups',
\ get(g:, 'crystal_foldable_groups', 'ALL')
\ )
\ )
function! s:foldable(...) abort
if index(s:foldable_groups, 'NONE') > -1
return 0
endif
if index(s:foldable_groups, 'ALL') > -1
return 1
endif
for l:i in a:000
if index(s:foldable_groups, l:i) > -1
return 1
endif
endfor
return 0
endfunction
function! s:run_syntax_fold(args) abort
let [_0, _1, groups, cmd; _] = matchlist(a:args, '\(["'']\)\(.\{-}\)\1\s\+\(.*\)')
if call('s:foldable', split(groups))
let cmd .= ' fold'
endif
exe cmd
endfunction
com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)
" Not-Top Cluster
syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr
" Whitespace Errors
if exists('g:crystal_space_errors') if exists('g:crystal_space_errors')
if !exists('g:crystal_no_trail_space_error') if !exists('g:crystal_no_trail_space_error')
syn match crystalSpaceError display excludenl "\s\+$" syn match crystalSpaceError display excludenl "\s\+$"
@@ -28,91 +79,94 @@ if exists('g:crystal_operators')
endif endif
" Expression Substitution and Backslash Notation " Expression Substitution and Backslash Notation
syn match crystalStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match crystalStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
syn match crystalStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn match crystalStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
syn region crystalInterpolation matchgroup=crystalInterpolationDelim start="#{" end="}" contained contains=ALLBUT,@crystalNotTop syn region crystalInterpolation matchgroup=crystalInterpolationDelim start="#{" end="}" contained contains=ALLBUT,@crystalNotTop
syn match crystalInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=crystalInterpolationDelim,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable,crystalPredefinedVariable syn match crystalInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=crystalInterpolationDelim,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalInterpolationDelim "#\ze\%(\$\|@@\=\)\w\+" display contained syn match crystalInterpolationDelim "#\ze\%(\$\|@@\=\)\w\+" display contained
syn match crystalInterpolation "#\$\%(-\w\|\W\)" display contained contains=crystalInterpolationDelim,crystalPredefinedVariable,crystalInvalidVariable syn match crystalInterpolation "#\$\%(-\w\|\W\)" display contained contains=crystalInterpolationDelim,crystalPredefinedVariable,crystalInvalidVariable
syn match crystalInterpolationDelim "#\ze\$\%(-\w\|\W\)" display contained syn match crystalInterpolationDelim "#\ze\$\%(-\w\|\W\)" display contained
syn region crystalNoInterpolation start="\\#{" end="}" contained syn region crystalNoInterpolation start="\\#{" end="}" contained
syn match crystalNoInterpolation "\\#{" display contained syn match crystalNoInterpolation "\\#{" display contained
syn match crystalNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained syn match crystalNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained
syn match crystalNoInterpolation "\\#\$\W" display contained syn match crystalNoInterpolation "\\#\$\W" display contained
syn match crystalDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE syn match crystalDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE
syn region crystalNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=crystalString end=")" transparent contained syn region crystalNestedParentheses matchgroup=crystalString start="(" skip="\\\\\|\\)" end=")" transparent contained
syn region crystalNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=crystalString end="}" transparent contained syn region crystalNestedCurlyBraces matchgroup=crystalString start="{" skip="\\\\\|\\}" end="}" transparent contained
syn region crystalNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=crystalString end=">" transparent contained syn region crystalNestedAngleBrackets matchgroup=crystalString start="<" skip="\\\\\|\\>" end=">" transparent contained
syn region crystalNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=crystalString end="\]" transparent contained syn region crystalNestedSquareBrackets matchgroup=crystalString start="\[" skip="\\\\\|\\\]" end="\]" transparent contained
" These are mostly Oniguruma ready " These are mostly Oniguruma ready
syn region crystalRegexpComment matchgroup=crystalRegexpSpecial start="(?#" skip="\\)" end=")" contained syn region crystalRegexpComment matchgroup=crystalRegexpSpecial start="(?#" skip="\\)" end=")" contained
syn region crystalRegexpParens matchgroup=crystalRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@crystalRegexpSpecial syn region crystalRegexpParens matchgroup=crystalRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@crystalRegexpSpecial
syn region crystalRegexpBrackets matchgroup=crystalRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=crystalStringEscape,crystalRegexpEscape,crystalRegexpCharClass oneline syn region crystalRegexpBrackets matchgroup=crystalRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=crystalStringEscape,crystalRegexpEscape,crystalRegexpCharClass oneline
syn match crystalRegexpCharClass "\\[DdHhSsWw]" contained display syn match crystalRegexpCharClass "\\[DdHhSsWw]" contained display
syn match crystalRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained syn match crystalRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained
syn match crystalRegexpEscape "\\[].*?+^$|\\/(){}[]" contained syn match crystalRegexpEscape "\\[].*?+^$|\\/(){}[]" contained
syn match crystalRegexpQuantifier "[*?+][?+]\=" contained display syn match crystalRegexpQuantifier "[*?+][?+]\=" contained display
syn match crystalRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display syn match crystalRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display
syn match crystalRegexpAnchor "[$^]\|\\[ABbGZz]" contained display syn match crystalRegexpAnchor "[$^]\|\\[ABbGZz]" contained display
syn match crystalRegexpDot "\." contained display syn match crystalRegexpDot "\." contained display
syn match crystalRegexpSpecial "|" contained display syn match crystalRegexpSpecial "|" contained display
syn match crystalRegexpSpecial "\\[1-9]\d\=\d\@!" contained display syn match crystalRegexpSpecial "\\[1-9]\d\=\d\@!" contained display
syn match crystalRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display syn match crystalRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display
syn match crystalRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display syn match crystalRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display
syn match crystalRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display syn match crystalRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display
syn match crystalRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display syn match crystalRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display
syn cluster crystalStringSpecial contains=crystalInterpolation,crystalNoInterpolation,crystalStringEscape syn cluster crystalStringSpecial contains=crystalInterpolation,crystalNoInterpolation,crystalStringEscape
syn cluster crystalExtendedStringSpecial contains=@crystalStringSpecial,crystalNestedParentheses,crystalNestedCurlyBraces,crystalNestedAngleBrackets,crystalNestedSquareBrackets syn cluster crystalExtendedStringSpecial contains=@crystalStringSpecial,crystalNestedParentheses,crystalNestedCurlyBraces,crystalNestedAngleBrackets,crystalNestedSquareBrackets,crystalNestedRawParentheses,crystalNestedRawCurlyBraces,crystalNestedRawAngleBrackets,crystalNestedRawSquareBrackets
syn cluster crystalRegexpSpecial contains=crystalInterpolation,crystalNoInterpolation,crystalStringEscape,crystalRegexpSpecial,crystalRegexpEscape,crystalRegexpBrackets,crystalRegexpCharClass,crystalRegexpDot,crystalRegexpQuantifier,crystalRegexpAnchor,crystalRegexpParens,crystalRegexpComment syn cluster crystalRegexpSpecial contains=crystalInterpolation,crystalNoInterpolation,crystalStringEscape,crystalRegexpSpecial,crystalRegexpEscape,crystalRegexpBrackets,crystalRegexpCharClass,crystalRegexpDot,crystalRegexpQuantifier,crystalRegexpAnchor,crystalRegexpParens,crystalRegexpComment
" Numbers and ASCII Codes " Numbers and ASCII Codes
syn match crystalASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" syn match crystalASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
syn match crystalInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\%(_*[ufi]\%(32\|64\)\)\=\>" display syn match crystalInteger "\<0x[[:xdigit:]_]\+\%([ui]\%(8\|16\|32\|64\|128\)\|f\%(32\|64\)\)\=\>" display
syn match crystalInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(_\x\+\)*\%(_*[ufi]\%(32\|64\)\)\=\>" display syn match crystalInteger "\<0o[0-7_]\+\%([ui]\%(8\|16\|32\|64\|128\)\)\=\>" display
syn match crystalInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\%(_\x\+\)*\%(_*[ufi]\%(32\|64\)\)\=\>" display syn match crystalInteger "\<0b[01_]\+\%([ui]\%(8\|16\|32\|64\|128\)\)\=\>" display
syn match crystalInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\%(_\x\+\)*\%(_*[ufi]\%(32\|64\)\)\=\>" display syn match crystalInteger "\<\d[[:digit:]_]*\%([ui]\%(8\|16\|32\|64\|128\)\|f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display
syn match crystalFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\%(_*f\%(32\|64\)\)\=\>" display syn match crystalFloat "\<\d[[:digit:]_]*\.\d[[:digit:]_]*\%(f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display
syn match crystalFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\%(_*f\%(32\|64\)\)\=\>" display syn match crystalFloat "\<\d[[:digit:]_]*\%(\.\d[[:digit:]_]*\)\=\%([eE][-+]\=[[:digit:]_]\+\)\%(f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display
" Note: 042 is invalid but 0, 0_, 0_u8 and 0_1 are valid (#73)
syn match crystalInvalidInteger "\.\@<!\<0\d\+\>" contained containedin=crystalFloat,crystalInteger display
" Identifiers " Identifiers
syn match crystalLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match crystalLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
syn match crystalBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent syn match crystalBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
syn match crystalTypeName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalTypeName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalClassName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalClassName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalModuleName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalModuleName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalStructName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalStructName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalLibName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalLibName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalEnumName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalEnumName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" syn match crystalConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@="
syn match crystalClassVariable "@@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display syn match crystalClassVariable "@@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalInstanceVariable "@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display syn match crystalInstanceVariable "@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalGlobalVariable "$\%(\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\|-.\)" syn match crystalGlobalVariable "$\%(\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\|-.\)"
syn match crystalFreshVariable "\%(\h\|[^\x00-\x7F]\)\@<!%\%(\h\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display syn match crystalFreshVariable "\%(\h\|[^\x00-\x7F]\)\@<!%\%(\h\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalSymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[][=?]\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" syn match crystalSymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[][=?]\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
syn match crystalSymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" syn match crystalSymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
syn match crystalSymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" syn match crystalSymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
syn match crystalSymbol "[]})\"':]\@<!:\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" syn match crystalSymbol "[]})\"':]\@<!:\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
syn match crystalSymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1 syn match crystalSymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1
syn match crystalSymbol "[]})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="he=e-1 syn match crystalSymbol "[]})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="he=e-1
syn match crystalSymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 syn match crystalSymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1
syn match crystalSymbol "[[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="hs=s+1,he=e-1 syn match crystalSymbol "[[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="hs=s+1,he=e-1
syn region crystalSymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@crystalStringSpecial fold
syn match crystalBlockParameter "\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" contained SynFold ':' syn region crystalSymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@crystalStringSpecial
syn match crystalBlockParameter "\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" contained
syn region crystalBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=crystalBlockParameter syn region crystalBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=crystalBlockParameter
syn match crystalInvalidVariable "$[^ %A-Za-z_-]" syn match crystalInvalidVariable "$[^ %A-Za-z_-]"
syn match crystalPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~]# syn match crystalPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~]#
syn match crystalPredefinedVariable "$\d\+" display syn match crystalPredefinedVariable "$\d\+" display
syn match crystalPredefinedVariable "$_\>" display syn match crystalPredefinedVariable "$_\>" display
syn match crystalPredefinedVariable "$-[0FIKadilpvw]\>" display syn match crystalPredefinedVariable "$-[0FIKadilpvw]\>" display
syn match crystalPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display syn match crystalPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display
syn match crystalPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display syn match crystalPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!"
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!"
@@ -120,77 +174,82 @@ syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(crystal_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(crystal_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
" Normal Regular Expression " Normal Regular Expression
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial fold SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=/]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial fold SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=/]\@!" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
" Generalized Regular Expression " Generalized Regular Expression
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@crystalRegexpSpecial fold SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r{" end="}[imx]*" skip="\\\\\|\\}" contains=@crystalRegexpSpecial
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@crystalRegexpSpecial fold SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r<" end=">[imx]*" skip="\\\\\|\\>" contains=@crystalRegexpSpecial,crystalNestedAngleBrackets,crystalDelimEscape
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@crystalRegexpSpecial,crystalNestedAngleBrackets,crystalDelimEscape fold SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r\[" end="\][imx]*" skip="\\\\\|\\\]" contains=@crystalRegexpSpecial
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@crystalRegexpSpecial fold SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r(" end=")[imx]*" skip="\\\\\|\\)" contains=@crystalRegexpSpecial
syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@crystalRegexpSpecial fold SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r|" end="|[imx]*" skip="\\\\\|\\|" contains=@crystalRegexpSpecial
" Normal String and Shell Command Output " Normal String
syn region crystalString matchgroup=crystalStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@crystalStringSpecial,@Spell fold let s:spell_cluster = exists('crystal_spellcheck_strings') ? ',@Spell' : ''
syn region crystalString matchgroup=crystalStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@crystalStringSpecial fold let s:fold_arg = s:foldable('string') ? ' fold' : ''
exe 'syn region crystalString matchgroup=crystalStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@crystalStringSpecial' . s:spell_cluster . s:fold_arg
unlet s:spell_cluster s:fold_arg
" Shell Command Output
SynFold 'string' syn region crystalString matchgroup=crystalStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@crystalStringSpecial
" Character " Character
syn match crystalCharLiteral "'\%([^\\]\|\\[abefnrstv'\\]\|\\\o\{1,3}\|\\x\x\{1,2}\|\\u\x\{4}\)'" contains=crystalStringEscape display syn match crystalCharLiteral "'\%([^\\]\|\\[abefnrstv'\\]\|\\\o\{1,3}\|\\x\x\{1,2}\|\\u\x\{4}\)'" contains=crystalStringEscape display
" Generalized Single Quoted String, Symbol and Array of Strings " Generalized Single Quoted String, Symbol and Array of Strings
syn region crystalString matchgroup=crystalStringDelimiter start="%[qwi]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold syn region crystalNestedRawParentheses matchgroup=crystalString start="(" end=")" transparent contained
syn region crystalString matchgroup=crystalStringDelimiter start="%[qwi]{" end="}" skip="\\\\\|\\}" fold contains=crystalNestedCurlyBraces,crystalDelimEscape syn region crystalNestedRawCurlyBraces matchgroup=crystalString start="{" end="}" transparent contained
syn region crystalString matchgroup=crystalStringDelimiter start="%[qwi]<" end=">" skip="\\\\\|\\>" fold contains=crystalNestedAngleBrackets,crystalDelimEscape syn region crystalNestedRawAngleBrackets matchgroup=crystalString start="<" end=">" transparent contained
syn region crystalString matchgroup=crystalStringDelimiter start="%[qwi]\[" end="\]" skip="\\\\\|\\\]" fold contains=crystalNestedSquareBrackets,crystalDelimEscape syn region crystalNestedRawSquareBrackets matchgroup=crystalString start="\[" end="\]" transparent contained
syn region crystalString matchgroup=crystalStringDelimiter start="%[qwi](" end=")" skip="\\\\\|\\)" fold contains=crystalNestedParentheses,crystalDelimEscape
syn region crystalString matchgroup=crystalStringDelimiter start="%q " end=" " skip="\\\\\|\\)" fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%q(" end=")" contains=crystalNestedRawParentheses
syn region crystalSymbol matchgroup=crystalSymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1" skip="\\\\\|\\\z1" fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%q{" end="}" contains=crystalNestedRawCurlyBraces
syn region crystalSymbol matchgroup=crystalSymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=crystalNestedCurlyBraces,crystalDelimEscape SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%q<" end=">" contains=crystalNestedRawAngleBrackets
syn region crystalSymbol matchgroup=crystalSymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=crystalNestedAngleBrackets,crystalDelimEscape SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%q\[" end="\]" contains=crystalNestedRawSquareBrackets
syn region crystalSymbol matchgroup=crystalSymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=crystalNestedSquareBrackets,crystalDelimEscape SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%q|" end="|"
syn region crystalSymbol matchgroup=crystalSymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=crystalNestedParentheses,crystalDelimEscape
SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[wi](" end=")" skip="\\\\\|\\)" contains=crystalNestedParentheses,crystalDelimEscape
SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[wi]{" end="}" skip="\\\\\|\\}" contains=crystalNestedCurlyBraces,crystalDelimEscape
SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[wi]<" end=">" skip="\\\\\|\\>" contains=crystalNestedAngleBrackets,crystalDelimEscape
SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[wi]\[" end="\]" skip="\\\\\|\\\]" contains=crystalNestedSquareBrackets,crystalDelimEscape
SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[wi]|" end="|" skip="\\\\\|\\|" contains=crystalDelimEscape
" Generalized Double Quoted String and Array of Strings and Shell Command Output " Generalized Double Quoted String and Array of Strings and Shell Command Output
" Note: %= is not matched here as the beginning of a double quoted string " Note: %= is not matched here as the beginning of a double quoted string
syn region crystalString matchgroup=crystalStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@crystalStringSpecial fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\=(" end=")" skip="\\\\\|\\)" contains=@crystalStringSpecial,crystalNestedParentheses,crystalDelimEscape
syn region crystalString matchgroup=crystalStringDelimiter start="%[QWIx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@crystalStringSpecial fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\={" end="}" skip="\\\\\|\\}" contains=@crystalStringSpecial,crystalNestedCurlyBraces,crystalDelimEscape
syn region crystalString matchgroup=crystalStringDelimiter start="%[QWIx]\={" end="}" skip="\\\\\|\\}" contains=@crystalStringSpecial,crystalNestedCurlyBraces,crystalDelimEscape fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\=<" end=">" skip="\\\\\|\\>" contains=@crystalStringSpecial,crystalNestedAngleBrackets,crystalDelimEscape
syn region crystalString matchgroup=crystalStringDelimiter start="%[QWIx]\=<" end=">" skip="\\\\\|\\>" contains=@crystalStringSpecial,crystalNestedAngleBrackets,crystalDelimEscape fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@crystalStringSpecial,crystalNestedSquareBrackets,crystalDelimEscape
syn region crystalString matchgroup=crystalStringDelimiter start="%[QWIx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@crystalStringSpecial,crystalNestedSquareBrackets,crystalDelimEscape fold SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\=|" end="|" skip="\\\\\|\\|" contains=@crystalStringSpecial,crystalDelimEscape
syn region crystalString matchgroup=crystalStringDelimiter start="%[QWIx]\=(" end=")" skip="\\\\\|\\)" contains=@crystalStringSpecial,crystalNestedParentheses,crystalDelimEscape fold
syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx] " end=" " skip="\\\\\|\\)" contains=@crystalStringSpecial fold
" Here Document " Here Document
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@crystalNotTop
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@crystalNotTop
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@crystalNotTop
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@crystalNotTop
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial keepend
if exists('g:main_syntax') && g:main_syntax ==# 'ecrystal'
let b:crystal_no_expensive = 1
end
" Module, Class, Method, and Alias Declarations
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalFunction,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalFunction,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalFunction syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalFunction
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalTypeName syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalTypeName
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalClassName,crystalOperator syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalClassName,crystalOperator
syn match crystalModuleDeclaration "[^[:space:];#]\+" contained contains=crystalModuleName,crystalOperator syn match crystalModuleDeclaration "[^[:space:];#]\+" contained contains=crystalModuleName,crystalOperator
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalStructName,crystalOperator syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalStructName,crystalOperator
syn match crystalLibDeclaration "[^[:space:];#]\+" contained contains=crystalLibName,crystalOperator syn match crystalLibDeclaration "[^[:space:];#]\+" contained contains=crystalLibName,crystalOperator
syn match crystalMacroDeclaration "[^[:space:];#(]\+" contained contains=crystalFunction syn match crystalMacroDeclaration "[^[:space:];#(]\+" contained contains=crystalFunction
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalEnumName syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalEnumName
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2 syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
@@ -200,59 +259,61 @@ syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDecl
" Keywords " Keywords
" Note: the following keywords have already been defined: " Note: the following keywords have already been defined:
" begin case class def do end for if module unless until while " begin case class def do end for if module unless until while
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!" syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
syn match crystalOperator "\<defined?" display syn match crystalOperator "\<defined?" display
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|of\|with\|uninitialized\|union\)\>[?!]\@!" syn match crystalKeyword "\<\%(super\|previous_def\|yield\|of\|with\|uninitialized\|union\)\>[?!]\@!"
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!" syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax " Expensive Mode - match 'end' with the appropriate opening keyword for syntax
" based folding and special highlighting of module/class/method definitions " based folding and special highlighting of module/class/method definitions
if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive') if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
syn match crystalDefine "\<undef\>" nextgroup=crystalFunction skipwhite skipnl syn match crystalDefine "\<undef\>" nextgroup=crystalFunction skipwhite skipnl
syn match crystalDefine "\<\%(type\|alias\)\>\%(\s*\h\w*\s*=\)\@=" nextgroup=crystalTypeDeclaration skipwhite skipnl syn match crystalDefine "\<\%(type\|alias\)\>\%(\s*\h\w*\s*=\)\@=" nextgroup=crystalTypeDeclaration skipwhite skipnl
syn match crystalClass "\<class\>" nextgroup=crystalClassDeclaration skipwhite skipnl syn match crystalClass "\<class\>" nextgroup=crystalClassDeclaration skipwhite skipnl
syn match crystalModule "\<module\>" nextgroup=crystalModuleDeclaration skipwhite skipnl syn match crystalModule "\<module\>" nextgroup=crystalModuleDeclaration skipwhite skipnl
syn match crystalStruct "\<struct\>" nextgroup=crystalStructDeclaration skipwhite skipnl syn match crystalStruct "\<struct\>" nextgroup=crystalStructDeclaration skipwhite skipnl
syn match crystalLib "\<lib\>" nextgroup=crystalLibDeclaration skipwhite skipnl syn match crystalLib "\<lib\>" nextgroup=crystalLibDeclaration skipwhite skipnl
syn match crystalMacro "\<macro\>" nextgroup=crystalMacroDeclaration skipwhite skipnl syn match crystalMacro "\<macro\>" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalEnum "\<enum\>" nextgroup=crystalEnumDeclaration skipwhite skipnl syn match crystalEnum "\<enum\>" nextgroup=crystalEnumDeclaration skipwhite skipnl
syn region crystalMethodBlock start="\<\%(def\|macro\)\>" matchgroup=crystalDefine end="\%(\<\%(def\|macro\)\_s\+\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'def' syn region crystalMethodBlock start="\<\%(def\|macro\)\>" matchgroup=crystalDefine end="\%(\<\%(def\|macro\)\_s\+\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalBlock start="\<class\>" matchgroup=crystalClass end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'class' syn region crystalBlock start="\<class\>" matchgroup=crystalClass end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalBlock start="\<module\>" matchgroup=crystalModule end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'module' syn region crystalBlock start="\<module\>" matchgroup=crystalModule end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalBlock start="\<struct\>" matchgroup=crystalStruct end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'struct' syn region crystalBlock start="\<struct\>" matchgroup=crystalStruct end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalBlock start="\<lib\>" matchgroup=crystalLib end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'lib' syn region crystalBlock start="\<lib\>" matchgroup=crystalLib end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalBlock start="\<enum\>" matchgroup=crystalEnum end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'enum' syn region crystalBlock start="\<enum\>" matchgroup=crystalEnum end="\<end\>" contains=ALLBUT,@crystalNotTop
" modifiers " modifiers
syn match crystalConditionalModifier "\<\%(if\|unless\|ifdef\)\>" display syn match crystalConditionalModifier "\<\%(if\|unless\|ifdef\)\>" display
syn match crystalRepeatModifier "\<\%(while\|until\)\>" display syn match crystalRepeatModifier "\<\%(while\|until\)\>" display
SynFold 'do' syn region crystalDoBlock matchgroup=crystalControl start="\<do\>" end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalDoBlock matchgroup=crystalControl start="\<do\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold
" curly bracket block or hash literal " curly bracket block or hash literal
syn region crystalCurlyBlock matchgroup=crystalCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@crystalNotTop fold SynFold '{' syn region crystalCurlyBlock matchgroup=crystalCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@crystalNotTop
syn region crystalArrayLiteral matchgroup=crystalArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@crystalNotTop fold SynFold '[' syn region crystalArrayLiteral matchgroup=crystalArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@crystalNotTop
" statements without 'do' " statements without 'do'
syn region crystalBlockExpression matchgroup=crystalControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'begin' syn region crystalBlockExpression matchgroup=crystalControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalCaseExpression matchgroup=crystalConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'case' syn region crystalCaseExpression matchgroup=crystalConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'select' syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=ALLBUT,@crystalNotTop
syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop fold SynFold 'if' syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop
syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression
syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression
syn match crystalConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=crystalConditionalExpression syn match crystalConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=crystalConditionalExpression
syn match crystalExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=crystalBlockExpression syn match crystalExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=crystalBlockExpression
syn match crystalMethodExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=crystalMethodBlock syn match crystalMethodExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=crystalMethodBlock
" statements with optional 'do' " statements with optional 'do'
syn region crystalOptionalDoLine matchgroup=crystalRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@crystalNotTop syn region crystalOptionalDoLine matchgroup=crystalRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@crystalNotTop
syn region crystalRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalRepeat end="\<end\>" contains=ALLBUT,@crystalNotTop nextgroup=crystalOptionalDoLine fold
SynFold 'for' syn region crystalRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalRepeat end="\<end\>" contains=ALLBUT,@crystalNotTop nextgroup=crystalOptionalDoLine
if !exists('g:crystal_minlines') if !exists('g:crystal_minlines')
let g:crystal_minlines = 500 let g:crystal_minlines = 500
@@ -260,23 +321,24 @@ if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
exec 'syn sync minlines=' . g:crystal_minlines exec 'syn sync minlines=' . g:crystal_minlines
else else
" Non-expensive mode
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalControl "\<fun\>[?!]\@!" nextgroup=crystalFunctionDeclaration skipwhite skipnl syn match crystalControl "\<fun\>[?!]\@!" nextgroup=crystalFunctionDeclaration skipwhite skipnl
syn match crystalControl "\<class\>[?!]\@!" nextgroup=crystalClassDeclaration skipwhite skipnl syn match crystalControl "\<class\>[?!]\@!" nextgroup=crystalClassDeclaration skipwhite skipnl
syn match crystalControl "\<module\>[?!]\@!" nextgroup=crystalModuleDeclaration skipwhite skipnl syn match crystalControl "\<module\>[?!]\@!" nextgroup=crystalModuleDeclaration skipwhite skipnl
syn match crystalControl "\<struct\>[?!]\@!" nextgroup=crystalStructDeclaration skipwhite skipnl syn match crystalControl "\<struct\>[?!]\@!" nextgroup=crystalStructDeclaration skipwhite skipnl
syn match crystalControl "\<lib\>[?!]\@!" nextgroup=crystalLibDeclaration skipwhite skipnl syn match crystalControl "\<lib\>[?!]\@!" nextgroup=crystalLibDeclaration skipwhite skipnl
syn match crystalControl "\<macro\>[?!]\@!" nextgroup=crystalMacroDeclaration skipwhite skipnl syn match crystalControl "\<macro\>[?!]\@!" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalControl "\<enum\>[?!]\@!" nextgroup=crystalEnumDeclaration skipwhite skipnl syn match crystalControl "\<enum\>[?!]\@!" nextgroup=crystalEnumDeclaration skipwhite skipnl
syn match crystalControl "\<\%(case\|begin\|do\|for\|if\|ifdef\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|end\)\>[?!]\@!" syn match crystalControl "\<\%(case\|begin\|do\|for\|if\|ifdef\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|end\)\>[?!]\@!"
syn match crystalKeyword "\<\%(alias\|undef\)\>[?!]\@!" syn match crystalKeyword "\<\%(alias\|undef\)\>[?!]\@!"
endif endif
" Link attribute " Link attribute
syn region crystalLinkAttrRegion start="@\[" nextgroup=crystalLinkAttrRegionInner end="]" contains=crystalLinkAttr,crystalLinkAttrRegionInner transparent display oneline syn region crystalLinkAttrRegion start="@\[" nextgroup=crystalLinkAttrRegionInner end="]" contains=crystalLinkAttr,crystalLinkAttrRegionInner transparent display oneline
syn region crystalLinkAttrRegionInner start="\%(@\[\)\@<=" end="]\@=" contained contains=ALLBUT,@crystalNotTop transparent display oneline syn region crystalLinkAttrRegionInner start="\%(@\[\)\@<=" end="]\@=" contained contains=ALLBUT,@crystalNotTop transparent display oneline
syn match crystalLinkAttr "@\[" contained containedin=crystalLinkAttrRegion display syn match crystalLinkAttr "@\[" contained containedin=crystalLinkAttrRegion display
syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display
" Special Methods " Special Methods
if !exists('g:crystal_no_special_methods') if !exists('g:crystal_no_special_methods')
@@ -294,110 +356,112 @@ if !exists('g:crystal_no_special_methods')
endif endif
" Macro " Macro
syn region crystalMacroRegion start="{%" end="%}" contains=ALLBUT,@crystalNotTop transparent display oneline " Note: This definition must be put after crystalNestedCurlyBraces to give higher priority
syn region crystalMacroRegion start="{{" end="}}" contains=ALLBUT,@crystalNotTop transparent display oneline syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={%" end="%}" oneline display contains=ALLBUT,@crystalNotTop containedin=ALL
syn match crystalMacro "\%({%\|%}\|{{\|}}\)" nextgroup=crystalMacroRegion skipwhite display syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={{" end="}}" oneline display contains=ALLBUT,@crystalNotTop containedin=ALL
" Comments and Documentation " Comments and Documentation
syn match crystalSharpBang "\%^#!.*" display syn match crystalSharpBang "\%^#!.*" display
syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
if !exists('g:crystal_no_comment_fold')
syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent fold keepend SynFold '#' syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent keepend
endif
" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|begin\|break\|case\|class\|def\|defined\|do\|else\|select\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|begin\|break\|case\|class\|def\|defined\|do\|else\|select\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|ifdef\|in\|module\|next\|nil\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|ifdef\|in\|module\|next\|nil\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(rescue\|return\|self\|super\|previous_def\|then\|true\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(rescue\|return\|self\|super\|previous_def\|then\|true\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
hi def link crystalClass crystalDefine hi def link crystalClass crystalDefine
hi def link crystalModule crystalDefine hi def link crystalModule crystalDefine
hi def link crystalStruct crystalDefine hi def link crystalStruct crystalDefine
hi def link crystalLib crystalDefine hi def link crystalLib crystalDefine
hi def link crystalMacro crystalDefine hi def link crystalEnum crystalDefine
hi def link crystalEnum crystalDefine hi def link crystalMethodExceptional crystalDefine
hi def link crystalMethodExceptional crystalDefine hi def link crystalDefine Define
hi def link crystalDefine Define hi def link crystalFunction Function
hi def link crystalFunction Function hi def link crystalConditional Conditional
hi def link crystalConditional Conditional hi def link crystalConditionalModifier crystalConditional
hi def link crystalConditionalModifier crystalConditional hi def link crystalExceptional crystalConditional
hi def link crystalExceptional crystalConditional hi def link crystalRepeat Repeat
hi def link crystalRepeat Repeat hi def link crystalRepeatModifier crystalRepeat
hi def link crystalRepeatModifier crystalRepeat hi def link crystalOptionalDo crystalRepeat
hi def link crystalOptionalDo crystalRepeat hi def link crystalControl Statement
hi def link crystalControl Statement hi def link crystalInclude Include
hi def link crystalInclude Include hi def link crystalRecord Statement
hi def link crystalRecord Statement hi def link crystalInteger Number
hi def link crystalInteger Number hi def link crystalASCIICode Character
hi def link crystalASCIICode Character hi def link crystalFloat Float
hi def link crystalFloat Float hi def link crystalBoolean Boolean
hi def link crystalBoolean Boolean hi def link crystalException Exception
hi def link crystalException Exception
if !exists('g:crystal_no_identifiers') if !exists('g:crystal_no_identifiers')
hi def link crystalIdentifier Identifier hi def link crystalIdentifier Identifier
else else
hi def link crystalIdentifier NONE hi def link crystalIdentifier NONE
endif endif
hi def link crystalClassVariable crystalIdentifier hi def link crystalClassVariable crystalIdentifier
hi def link crystalConstant Type hi def link crystalConstant Type
hi def link crystalTypeName crystalConstant hi def link crystalTypeName crystalConstant
hi def link crystalClassName crystalConstant hi def link crystalClassName crystalConstant
hi def link crystalModuleName crystalConstant hi def link crystalModuleName crystalConstant
hi def link crystalStructName crystalConstant hi def link crystalStructName crystalConstant
hi def link crystalLibName crystalConstant hi def link crystalLibName crystalConstant
hi def link crystalEnumName crystalConstant hi def link crystalEnumName crystalConstant
hi def link crystalGlobalVariable crystalIdentifier hi def link crystalGlobalVariable crystalIdentifier
hi def link crystalBlockParameter crystalIdentifier hi def link crystalBlockParameter crystalIdentifier
hi def link crystalInstanceVariable crystalIdentifier hi def link crystalInstanceVariable crystalIdentifier
hi def link crystalFreshVariable crystalIdentifier hi def link crystalFreshVariable crystalIdentifier
hi def link crystalPredefinedIdentifier crystalIdentifier hi def link crystalPredefinedIdentifier crystalIdentifier
hi def link crystalPredefinedConstant crystalPredefinedIdentifier hi def link crystalPredefinedConstant crystalPredefinedIdentifier
hi def link crystalPredefinedVariable crystalPredefinedIdentifier hi def link crystalPredefinedVariable crystalPredefinedIdentifier
hi def link crystalSymbol Constant hi def link crystalSymbol Constant
hi def link crystalKeyword Keyword hi def link crystalKeyword Keyword
hi def link crystalOperator Operator hi def link crystalOperator Operator
hi def link crystalAccess Statement hi def link crystalAccess Statement
hi def link crystalAttribute Statement hi def link crystalAttribute Statement
hi def link crystalPseudoVariable Constant hi def link crystalPseudoVariable Constant
hi def link crystalCharLiteral Character hi def link crystalCharLiteral Character
hi def link crystalComment Comment hi def link crystalComment Comment
hi def link crystalTodo Todo hi def link crystalTodo Todo
hi def link crystalStringEscape Special hi def link crystalStringEscape Special
hi def link crystalInterpolationDelim Delimiter hi def link crystalInterpolationDelim Delimiter
hi def link crystalNoInterpolation crystalString hi def link crystalNoInterpolation crystalString
hi def link crystalSharpBang PreProc hi def link crystalSharpBang PreProc
hi def link crystalRegexpDelimiter crystalStringDelimiter hi def link crystalRegexpDelimiter crystalStringDelimiter
hi def link crystalSymbolDelimiter crystalStringDelimiter hi def link crystalSymbolDelimiter crystalStringDelimiter
hi def link crystalStringDelimiter Delimiter hi def link crystalStringDelimiter Delimiter
hi def link crystalString String hi def link crystalString String
hi def link crystalHeredoc crystalString hi def link crystalHeredoc crystalString
hi def link crystalRegexpEscape crystalRegexpSpecial hi def link crystalRegexpEscape crystalRegexpSpecial
hi def link crystalRegexpQuantifier crystalRegexpSpecial hi def link crystalRegexpQuantifier crystalRegexpSpecial
hi def link crystalRegexpAnchor crystalRegexpSpecial hi def link crystalRegexpAnchor crystalRegexpSpecial
hi def link crystalRegexpDot crystalRegexpCharClass hi def link crystalRegexpDot crystalRegexpCharClass
hi def link crystalRegexpCharClass crystalRegexpSpecial hi def link crystalRegexpCharClass crystalRegexpSpecial
hi def link crystalRegexpSpecial Special hi def link crystalRegexpSpecial Special
hi def link crystalRegexpComment Comment hi def link crystalRegexpComment Comment
hi def link crystalRegexp crystalString hi def link crystalRegexp crystalString
hi def link crystalMacro PreProc hi def link crystalMacro PreProc
hi def link crystalLinkAttr crystalMacro hi def link crystalMacroDelim crystalMacro
hi def link crystalError Error hi def link crystalLinkAttr crystalMacro
hi def link crystalInvalidVariable crystalError hi def link crystalError Error
hi def link crystalSpaceError crystalError hi def link crystalInvalidVariable crystalError
hi def link crystalSpaceError crystalError
hi def link crystalInvalidInteger crystalError
let b:current_syntax = 'crystal' let b:current_syntax = 'crystal'
" vim: nowrap sw=2 sts=2 ts=8 noet: delc SynFold
" vim: nowrap sw=2 sts=2:
endif endif

View File

@@ -20,7 +20,7 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable
syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!' syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|raise\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!'
syn keyword elixirInclude import require alias use syn keyword elixirInclude import require alias use

View File

@@ -25,24 +25,6 @@ endif
scriptencoding utf-8 scriptencoding utf-8
if !exists("b:julia_syntax_version")
let b:julia_syntax_version = get(g:, "default_julia_version", "current")
endif
if !exists("b:julia_syntax_highlight_deprecated")
let b:julia_syntax_highlight_deprecated = get(g:, "julia_syntax_highlight_deprecated", 0)
endif
if b:julia_syntax_version =~? '\<\%(curr\%(ent\)\?\|release\|7\|0\.7\|10\|1.0\)\>'
let b:julia_syntax_version = 10
elseif b:julia_syntax_version =~? '\<\%(next\|devel\|11\|1\.1\)\>'
let b:julia_syntax_version = 11
elseif b:julia_syntax_version =~? '\<\%(prev\%(ious\)\?\|legacy\|6\|0\.6\)\>'
let b:julia_syntax_version = 6
else
echohl WarningMsg | echomsg "Unrecognized or unsupported julia syntax version: " . b:julia_syntax_version | echohl None
let b:julia_syntax_version = 10
endif
let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0) let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0)
let s:julia_spellcheck_docstrings = get(g:, "julia_spellcheck_docstrings", 1) let s:julia_spellcheck_docstrings = get(g:, "julia_spellcheck_docstrings", 1)
let s:julia_spellcheck_comments = get(g:, "julia_spellcheck_comments", 1) let s:julia_spellcheck_comments = get(g:, "julia_spellcheck_comments", 1)
@@ -96,24 +78,10 @@ syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems
syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaInfixKeyword,juliaRepKeyword,juliaTypedef syntax cluster juliaKeywordItems contains=juliaKeyword,juliaInfixKeyword,juliaRepKeyword,juliaTypedef
syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock
if b:julia_syntax_version == 6 syntax cluster juliaTypesItems contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems06
else
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems06,@juliaTypesItems1011
endif
syntax cluster juliaTypesItemsAll contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
syntax cluster juliaTypesItems06 contains=juliaBaseTypeNum06,juliaBaseTypeRange06,juliaBaseTypeDict06,juliaBaseTypeSet06
syntax cluster juliaTypesItems1011 contains=juliaBaseTypeBasic1011,juliaBaseTypeNum1011,juliaBaseTypeError1011,juliaBaseTypeIter1011,juliaBaseTypeRange1011,juliaBaseTypeArray1011,juliaBaseTypeDict1011,juliaBaseTypeSet1011,juliaBaseTypeC1011,juliaBaseTypeDisplay1011,juliaBaseTypeIO1011,juliaBaseTypeString1011
syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstMMap,juliaConstC,juliaConstGeneric syntax cluster juliaConstItems contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstMMap,juliaConstC,juliaConstGeneric,juliaConstIO,juliaPossibleEuler
syntax cluster juliaConstItems06 contains=juliaConstNum06,juliaConstIO06
syntax cluster juliaConstItems1011 contains=juliaConstGeneric1011,juliaPossibleEuler,juliaConstEnv1011,juliaConstIO1011
if b:julia_syntax_version == 6
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems06
else
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems06,@juliaConstItems1011
endif
syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra
syntax cluster juliaSymbolItems contains=juliaPossibleSymbol syntax cluster juliaSymbolItems contains=juliaPossibleSymbol
@@ -124,18 +92,18 @@ syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juli
syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM
syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally
syntax cluster juliaSpellcheckStrings contains=@spell syntax cluster juliaSpellcheckStrings contains=@spell
syntax cluster juliaSpellcheckDocStrings contains=@spell syntax cluster juliaSpellcheckDocStrings contains=@spell
syntax cluster juliaSpellcheckComments contains=@spell syntax cluster juliaSpellcheckComments contains=@spell
if !s:julia_spellcheck_docstrings if !s:julia_spellcheck_docstrings
syntax cluster juliaSpellcheckDocStrings remove=@spell syntax cluster juliaSpellcheckDocStrings remove=@spell
endif endif
if !s:julia_spellcheck_strings if !s:julia_spellcheck_strings
syntax cluster juliaSpellcheckStrings remove=@spell syntax cluster juliaSpellcheckStrings remove=@spell
endif endif
if !s:julia_spellcheck_comments if !s:julia_spellcheck_comments
syntax cluster juliaSpellcheckComments remove=@spell syntax cluster juliaSpellcheckComments remove=@spell
endif endif
syntax match juliaSemicolon display ";" syntax match juliaSemicolon display ";"
@@ -172,10 +140,6 @@ exec 'syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="'.s:nodot
exec 'syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<function\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold' exec 'syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<function\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
exec 'syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<macro\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold' exec 'syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<macro\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
exec 'syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<quote\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold' exec 'syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<quote\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
if b:julia_syntax_version <= 10
exec 'syntax region juliaTypeBlock matchgroup=juliaBlKeyword06 start="'.s:nodot.'\<type\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
exec 'syntax region juliaImmutableBlock matchgroup=juliaBlKeyword06 start="'.s:nodot.'\<immutable\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
endif
exec 'syntax region juliaStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold' exec 'syntax region juliaStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
exec 'syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<mutable struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold' exec 'syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<mutable struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
exec 'syntax region juliaLetBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<let\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold' exec 'syntax region juliaLetBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<let\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
@@ -192,64 +156,43 @@ exec 'syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="'.s:no
exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\<for\>" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor' exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\<for\>" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor'
exec 'syntax match juliaComprehensionIf contained "'.s:nodot.'\<if\>"' exec 'syntax match juliaComprehensionIf contained "'.s:nodot.'\<if\>"'
exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"' exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"'
syntax match juliaBaseTypeBasic display "\<\%(Tuple\|NTuple\|Symbol\|Function\|Union\%(All\)\?\|Type\%(Name\|Var\)\?\|Any\|ANY\|Vararg\|Ptr\|Exception\|Module\|Expr\|DataType\|\%(LineNumber\|Quote\)Node\|\%(Weak\|Global\)\?Ref\|Method\|Pair\|Val\)\>" syntax match juliaBaseTypeBasic display "\<\%(\%(N\|Named\)\?Tuple\|Symbol\|Function\|Union\%(All\)\?\|Type\%(Name\|Var\)\?\|Any\|ANY\|Vararg\|Ptr\|Exception\|Module\|Expr\|DataType\|\%(LineNumber\|Quote\)Node\|\%(Weak\|Global\)\?Ref\|Method\|Pair\|Val\|Nothing\|Some\|Missing\)\>"
syntax match juliaBaseTypeBasic06 display "\<\%(Void\|\%(Label\|Goto\)Node\|Associative\|MethodTable\|Nullable\|TypeMap\%(Level\|Entry\)\|CodeInfo\)\>" syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|\%(Abstract\)\?Irrational\|Enum\|BigInt\|BigFloat\|MathConst\|ComplexF\%(16\|32\|64\)\)\>"
syntax match juliaBaseTypeBasic1011 display "\<\%(Nothing\|Some\|Missing\|NamedTuple\)\>" syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\|void\)\)\>"
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>" syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|ReadOnlyMemory\|StringIndex\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Missing\|\%(Process\|Task\)Failed\)Exception\|DimensionMismatch\|SegmentationFault\)\>"
syntax match juliaBaseTypeNum06 display "\<Complex\%(32\|64\|128\)\>" syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\|CartesianIndices\)\>"
syntax match juliaBaseTypeNum1011 display "\<\%(AbstractIrrational\|ComplexF\%(16\|32\|64\)\)\>" syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\|Substitution\)\?String\>"
syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\)\)\>" syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|\%(Sparse\|Row\)Vector\|VecElement\|Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|Broadcasted\|Adjoint\|Transpose\|LinearIndices\)\>"
syntax match juliaBaseTypeC1011 display "\<Cvoid\>" syntax match juliaBaseTypeDict display "\<\%(WeakKey\|Id\|Abstract\)\?Dict\>"
syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|Unicode\|ReadOnlyMemory\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Null\|Remote\)Exception\|DimensionMismatch\|SegmentationFault\)\>" syntax match juliaBaseTypeSet display "\<\%(\%(Abstract\|Bit\)\?Set\)\>"
syntax match juliaBaseTypeError1011 display "\<\%(StringIndexError\|MissingException\)\>" syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\|GenericIOBuffer\)\>"
syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>"
syntax match juliaBaseTypeIter1011 display "\<CartesianIndices\>"
syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\)\?String\>"
syntax match juliaBaseTypeString1011 display "\<SubstitutionString\>"
syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|SparseVector\|VecElement\|Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>"
syntax match juliaBaseTypeArray1011 display "\<\%(Broadcasted\|Adjoint\|Transpose\|LinearIndices\)\>"
syntax match juliaBaseTypeDict display "\<\%(WeakKey\)\?Dict\>"
syntax match juliaBaseTypeDict06 display "\<ObjectIdDict\>"
syntax match juliaBaseTypeDict1011 display "\<IdDict\>"
syntax match juliaBaseTypeSet display "\<\%(Set\|AbstractSet\)\>"
syntax match juliaBaseTypeSet06 display "\<IntSet\>"
syntax match juliaBaseTypeSet1011 display "\<\%(BitSet\|AbstractDict\)\>"
syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>"
syntax match juliaBaseTypeIO1011 display "\<GenericIOBuffer\>"
syntax match juliaBaseTypeProcess display "\<\%(Pipe\|Cmd\|PipeBuffer\)\>" syntax match juliaBaseTypeProcess display "\<\%(Pipe\|Cmd\|PipeBuffer\)\>"
syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\|ExponentialBackOff\|StepRangeLen\)\>" syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Abstract\|Lin\|Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\|ExponentialBackOff\|StepRangeLen\)\>"
syntax match juliaBaseTypeRange06 display "\<Range\>"
syntax match juliaBaseTypeRange1011 display "\<\(Abstract\|Lin\)Range\>"
syntax match juliaBaseTypeRegex display "\<Regex\%(Match\)\?\>" syntax match juliaBaseTypeRegex display "\<Regex\%(Match\)\?\>"
syntax match juliaBaseTypeFact display "\<\%(Factorization\|BunchKaufman\|\%(Cholesky\|QR\)\%(Pivoted\)\?\|\%(Generalized\)\?\%(Eigen\|SVD\|Schur\)\|Hessenberg\|LDLt\|LQ\|LU\)\>" syntax match juliaBaseTypeFact display "\<\%(Factorization\|BunchKaufman\|\%(Cholesky\|QR\)\%(Pivoted\)\?\|\%(Generalized\)\?\%(Eigen\|SVD\|Schur\)\|Hessenberg\|LDLt\|LQ\|LU\)\>"
syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>" syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>"
syntax match juliaBaseTypeRound display "\<Round\%(ingMode\|FromZero\|Down\|Nearest\%(Ties\%(Away\|Up\)\)\?\|ToZero\|Up\)\>" syntax match juliaBaseTypeRound display "\<Round\%(ingMode\|FromZero\|Down\|Nearest\%(Ties\%(Away\|Up\)\)\?\|ToZero\|Up\)\>"
syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>" syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>"
syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>" syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>"
syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>" syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|\%(Abstract\)\?Display\|MIME\|HTML\)\>"
syntax match juliaBaseTypeDisplay1011 display "\<AbstractDisplay\>"
syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\|DateFormat\)\>" syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\|DateFormat\)\>"
syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>" syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>"
syntax match juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)" syntax match juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)"
syntax match juliaConstNum06 display "\%(\<\%(eu\?\|eulergamma\|γ\|catalan\|φ\|golden\)\>\)"
" Note: recognition of , which Vim does not consider a valid identifier, is " Note: recognition of , which Vim does not consider a valid identifier, is
" complicated. We detect possible uses by just looking for the character (for " complicated. We detect possible uses by just looking for the character (for
" performance) and then check that it's actually used by its own. " performance) and then check that it's actually used by its own.
" (This also tries to detect preceding number constants; it does so in a crude " (This also tries to detect preceding number constants; it does so in a crude
" way.) " way.)
syntax match juliaPossibleEuler "" contains=juliaEuler syntax match juliaPossibleEuler "" contains=juliaEuler
exec 'syntax match juliaEuler contained "\%(\%(^\|[' . s:nonidS_chars . ']\|' . s:operators . '\)\%([.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=\ze\%($\|[' . s:nonidS_chars . ']\|' . s:operators . '\)"' exec 'syntax match juliaEuler contained "\%(\%(^\|[' . s:nonidS_chars . ']\|' . s:operators . '\)\%([.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=\ze\%($\|[' . s:nonidS_chars . ']\|' . s:operators . '\)"'
syntax match juliaConstBool display "\<\%(true\|false\)\>" syntax match juliaConstBool display "\<\%(true\|false\)\>"
syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|OS_NAME\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|JULIA_HOME\|PROGRAM_FILE\)\>" syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|PROGRAM_FILE\|DEPOT_PATH\)\>"
syntax match juliaConstEnv1011 display "\<DEPOT_PATH\>" syntax match juliaConstIO display "\<\%(std\%(out\|in\|err\)\|devnull\)\>"
syntax match juliaConstIO06 display "\<\%(STD\%(OUT\|IN\|ERR\)\|DevNull\)\>" syntax match juliaConstC display "\<\%(C_NULL\)\>"
syntax match juliaConstIO1011 display "\<\%(std\%(out\|in\|err\)\|devnull\)\>" syntax match juliaConstGeneric display "\<\%(nothing\|Main\|undef\|missing\)\>"
syntax match juliaConstC display "\<\%(WORD_SIZE\|C_NULL\)\>"
syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>"
syntax match juliaConstGeneric1011 display "\<\%(undef\|missing\)\>"
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
@@ -301,7 +244,7 @@ syntax match juliaComplexUnit display contained "\<im\>"
exec 'syntax match juliaOperator "' . s:operators . '"' exec 'syntax match juliaOperator "' . s:operators . '"'
syntax match juliaRangeOperator display ":" syntax match juliaRangeOperator display ":"
exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|^\s*:\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol' exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol'
let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!?]\|^\)\@'.s:d(1).'<=\$' let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!?]\|^\)\@'.s:d(1).'<=\$'
@@ -369,7 +312,7 @@ syntax match juliaPrintfFmt display contained "\\%%"hs=s+1
" this is used to restrict the search for Symbols to when colons appear at all " this is used to restrict the search for Symbols to when colons appear at all
" (for performance reasons) " (for performance reasons)
syntax match juliaPossibleSymbol transparent ":\ze[^:]" contains=juliaSymbol,juliaQuotedParBlock,juliaQuotedQMarkPar,juliaColon syntax match juliaPossibleSymbol transparent ":\ze[^:]" contains=juliaSymbol,juliaQuotedParBlock,juliaQuotedQMarkPar,juliaColon
let s:quotable = '\%(' . s:idregex . '\|?\|' . s:operators . '\|' . s:float_regex . '\|' . s:int_regex . '\)' let s:quotable = '\%(' . s:idregex . '\|?\|' . s:operators . '\|' . s:float_regex . '\|' . s:int_regex . '\)'
let s:quoting_colon = '\%(\%(^\s*\|\s\{6,\}\|[' . s:nonid_chars . s:uniop_chars . s:binop_chars . '?]\s*\)\@'.s:d(6).'<=\|\%(\<\%(return\|if\|else\%(if\)\?\|while\|try\|begin\)\s*\)\@'.s:d(9).'<=\)\zs:' let s:quoting_colon = '\%(\%(^\s*\|\s\{6,\}\|[' . s:nonid_chars . s:uniop_chars . s:binop_chars . '?]\s*\)\@'.s:d(6).'<=\|\%(\<\%(return\|if\|else\%(if\)\?\|while\|try\|begin\)\s*\)\@'.s:d(9).'<=\)\zs:'
@@ -405,7 +348,7 @@ syntax keyword juliaTodo contained TODO FIXME XXX
" :hi link juliaParDelim Delimiter " :hi link juliaParDelim Delimiter
hi def link juliaParDelim juliaNone hi def link juliaParDelim juliaNone
hi def link juliaSemicolon juliaNone hi def link juliaSemicolon juliaNone
hi def link juliaComma juliaNone hi def link juliaComma juliaNone
hi def link juliaColon juliaOperator hi def link juliaColon juliaOperator
@@ -414,12 +357,11 @@ hi def link juliaKeyword Keyword
hi def link juliaInfixKeyword Keyword hi def link juliaInfixKeyword Keyword
hi def link juliaRepKeyword Keyword hi def link juliaRepKeyword Keyword
hi def link juliaBlKeyword Keyword hi def link juliaBlKeyword Keyword
exec 'hi! def link juliaBlKeyword06 ' . (b:julia_syntax_version == 6 ? 'Keyword' : b:julia_syntax_version == 10 ? 'juliaDeprecated' : 'NONE')
hi def link juliaConditional Conditional hi def link juliaConditional Conditional
hi def link juliaRepeat Repeat hi def link juliaRepeat Repeat
hi def link juliaException Exception hi def link juliaException Exception
hi def link juliaTypedef Keyword hi def link juliaTypedef Keyword
exec 'hi! def link juliaOuter ' . (b:julia_syntax_version >= 10 ? 'Keyword' : 'NONE') hi def link juliaOuter Keyword
hi def link juliaBaseTypeBasic Type hi def link juliaBaseTypeBasic Type
hi def link juliaBaseTypeNum Type hi def link juliaBaseTypeNum Type
hi def link juliaBaseTypeC Type hi def link juliaBaseTypeC Type
@@ -441,24 +383,13 @@ hi def link juliaBaseTypeRandom Type
hi def link juliaBaseTypeDisplay Type hi def link juliaBaseTypeDisplay Type
hi def link juliaBaseTypeTime Type hi def link juliaBaseTypeTime Type
hi def link juliaBaseTypeOther Type hi def link juliaBaseTypeOther Type
for t in ["Num", "Range", "Dict", "Set"]
let h = b:julia_syntax_version == 6 ? "Type" : b:julia_syntax_version == 10 ? "juliaDeprecated" : "NONE"
exec "hi! def link juliaBaseType" . t . "06 " . h
endfor
for t in ["Range", "Dict", "Set", "Basic", "C", "Array", "Iter", "Display", "IO", "Num", "Error", "String"]
let h = b:julia_syntax_version >= 10 ? "Type" : "NONE"
exec "hi! def link juliaBaseType" . t . "1011 " . h
endfor
" NOTE: deprecated constants are not highlighted as such. For once, " NOTE: deprecated constants are not highlighted as such. For once,
" one can still legitimately use them by importing Base.MathConstants. " one can still legitimately use them by importing Base.MathConstants.
" Plus, one-letter variables like `e` and `γ` can be used with other " Plus, one-letter variables like `e` and `γ` can be used with other
" meanings. " meanings.
hi def link juliaConstNum Constant hi def link juliaConstNum Constant
let h = b:julia_syntax_version == 6 ? "Constant" : "NONE" hi def link juliaEuler Constant
exec "hi! def link juliaConstNum06 " . h
let h = b:julia_syntax_version >= 10 ? "Constant" : "NONE"
exec "hi! def link juliaEuler " . h
hi def link juliaConstEnv Constant hi def link juliaConstEnv Constant
hi def link juliaConstC Constant hi def link juliaConstC Constant
@@ -466,13 +397,7 @@ hi def link juliaConstLimits Constant
hi def link juliaConstGeneric Constant hi def link juliaConstGeneric Constant
hi def link juliaRangeEnd Constant hi def link juliaRangeEnd Constant
hi def link juliaConstBool Boolean hi def link juliaConstBool Boolean
hi def link juliaConstIO Boolean
for t in ["Generic", "IO", "Env"]
let h = b:julia_syntax_version >= 10 ? "Constant" : "NONE"
exec "hi! def link juliaConst" . t . "1011 " . h
endfor
let h = b:julia_syntax_version == 6 ? "Constant" : b:julia_syntax_version == 10 ? "juliaDeprecated" : "NONE"
exec "hi! def link juliaConstIO06 " . h
hi def link juliaComprehensionFor Keyword hi def link juliaComprehensionFor Keyword
hi def link juliaComprehensionIf Keyword hi def link juliaComprehensionIf Keyword
@@ -485,7 +410,7 @@ hi def link juliaSymbolS Identifier
hi def link juliaQParDelim Identifier hi def link juliaQParDelim Identifier
hi def link juliaQuotedQMarkPar Identifier hi def link juliaQuotedQMarkPar Identifier
hi def link juliaQuotedQMarkParS Identifier hi def link juliaQuotedQMarkParS Identifier
hi def link juliaQuotedQMark juliaOperatorHL hi def link juliaQuotedQMark juliaOperatorHL
hi def link juliaNumber Number hi def link juliaNumber Number
hi def link juliaFloat Float hi def link juliaFloat Float
@@ -521,7 +446,7 @@ hi def link juliaHexEscapeChar SpecialChar
hi def link juliaUniCharSmall SpecialChar hi def link juliaUniCharSmall SpecialChar
hi def link juliaUniCharLarge SpecialChar hi def link juliaUniCharLarge SpecialChar
hi def link juliaDoubleBackslash SpecialChar hi def link juliaDoubleBackslash SpecialChar
hi def link juliaEscapedQuote SpecialChar hi def link juliaEscapedQuote SpecialChar
hi def link juliaPrintfFmt SpecialChar hi def link juliaPrintfFmt SpecialChar
@@ -550,12 +475,6 @@ hi def link juliaErrorPrintfFmt juliaError
hi def link juliaError Error hi def link juliaError Error
if b:julia_syntax_highlight_deprecated == 1
hi! def link juliaDeprecated Todo
else
hi! def link juliaDeprecated NONE
end
syntax sync fromstart syntax sync fromstart
let b:current_syntax = "julia" let b:current_syntax = "julia"

View File

@@ -25,10 +25,10 @@ syn match llvmType /\<i\d\+\>/
" The true and false tokens can be used for comparison opcodes, but it's " The true and false tokens can be used for comparison opcodes, but it's
" much more common for these tokens to be used for boolean constants. " much more common for these tokens to be used for boolean constants.
syn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw syn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw
syn keyword llvmStatement bitcast br catchpad catchswitch catchret call syn keyword llvmStatement bitcast br catchpad catchswitch catchret call callbr
syn keyword llvmStatement cleanuppad cleanupret cmpxchg eq exact extractelement syn keyword llvmStatement cleanuppad cleanupret cmpxchg eq exact extractelement
syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext
syn keyword llvmStatement fptosi fptoui fptrunc free frem fsub getelementptr syn keyword llvmStatement fptosi fptoui fptrunc free frem fsub fneg getelementptr
syn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue syn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue
syn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min syn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min
syn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole syn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole
@@ -150,6 +150,7 @@ syn keyword llvmKeyword
\ sspstrong \ sspstrong
\ strictfp \ strictfp
\ swiftcc \ swiftcc
\ swiftself
\ tail \ tail
\ target \ target
\ thread_local \ thread_local

View File

@@ -1,18 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
" Vim syntax file "Vim syntax file
" Language: Mathematica " Language: Mathematica
" Maintainer: Voldikss <dyzplus@gmail.com> " Maintainer: R. Menon <rsmenon@icloud.com>
" Last Change: 2019 Jan 23 by Voldikss " Last Change: Feb 25, 2013
" Source: https://github.com/voldikss/vim-mma/syntax/mma.vim
" Credits:
" Arnoud Buzing: https://github.com/arnoudbuzing
" Rsmenon: https://github.com/rsmenon
" TODO:
" Box Forms
" quit when a syntax file was already loaded
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
endif endif

View File

@@ -1943,9 +1943,7 @@ syn match sqlPlpgsqlVariable ".\zs@[A-z0-9_]\+" contained
" PL/pgSQL operators " PL/pgSQL operators
syn match sqlPlpgsqlOperator ":=" contained syn match sqlPlpgsqlOperator ":=" contained
syn region plpgsql matchgroup=sqlString start=+\$pgsql\$+ end=+\$pgsql\$+ keepend syn region plpgsql matchgroup=sqlString start=+\$\z(pgsql\|body\|function\)\$+ end=+\$\z1\$+ keepend
\ contains=sqlIsKeyword,sqlIsFunction,sqlComment,sqlPlpgsqlKeyword,sqlPlpgsqlVariable,sqlPlpgsqlOperator,sqlNumber,sqlIsOperator,sqlString,sqlTodo
syn region plpgsql matchgroup=sqlString start=+\$body\$+ end=+\$body\$+ keepend
\ contains=sqlIsKeyword,sqlIsFunction,sqlComment,sqlPlpgsqlKeyword,sqlPlpgsqlVariable,sqlPlpgsqlOperator,sqlNumber,sqlIsOperator,sqlString,sqlTodo \ contains=sqlIsKeyword,sqlIsFunction,sqlComment,sqlPlpgsqlKeyword,sqlPlpgsqlVariable,sqlPlpgsqlOperator,sqlNumber,sqlIsOperator,sqlString,sqlTodo
if get(g:, 'pgsql_dollar_strings', 0) if get(g:, 'pgsql_dollar_strings', 0)
syn region sqlString start=+\$\$+ end=+\$\$+ contains=@Spell syn region sqlString start=+\$\$+ end=+\$\$+ contains=@Spell

View File

@@ -187,8 +187,17 @@ if !exists("php_phpdoc_folding")
let php_phpdoc_folding = 0 let php_phpdoc_folding = 0
endif endif
" set default global php version
if !exists('g:php_version_id')
let g:php_version_id = 70300
endif
" set default buffer level php version
if !exists('b:php_version_id')
let b:php_version_id = g:php_version_id
endif
" Folding Support {{{ " Folding Support {{{
"
if php_folding==1 && has("folding") if php_folding==1 && has("folding")
command! -nargs=+ SynFold <args> fold command! -nargs=+ SynFold <args> fold
else else
@@ -673,71 +682,142 @@ syn case match
" HereDoc " HereDoc
if version >= 704 if version >= 704
" @begin phpHereDoc if b:php_version_id >= 70300
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend " @begin phpHereDoc
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@3<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\I\i*\)$" end="^\s*\z1\>" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@3<="\z(\I\i*\)"$+ end="^\s*\z1\>" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
if (exists("php_html_in_heredoc") && php_html_in_heredoc) " including HTML,JavaScript,SQL if enabled via options
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
if (exists("php_sql_heredoc") && php_sql_heredoc) endif
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend if (exists("php_sql_heredoc") && php_sql_heredoc)
endif SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
if (exists("php_xml_heredoc") && php_xml_heredoc) endif
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend if (exists("php_xml_heredoc") && php_xml_heredoc)
endif SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpHereDoc
else
" @begin phpHereDoc
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@3<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options
if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpHereDoc " @end phpHereDoc
endif
else else
" @copy phpHereDoc strip_maximum_size if b:php_version_id >= 70300
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend " @copy phpHereDoc strip_maximum_size
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\s*\z1\>" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\s*\z1\>" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
if (exists("php_html_in_heredoc") && php_html_in_heredoc) " including HTML,JavaScript,SQL if enabled via options
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpHereDoc
else
" @copy phpHereDoc strip_maximum_size
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options
if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpHereDoc
endif endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpHereDoc
endif endif
" NowDoc " NowDoc
if version >= 704 if version >= 704
if b:php_version_id >= 70300
" @begin phpNowDoc " @begin phpNowDoc
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\I\i*\)'$+ end="^\s*\z1\>" contained keepend extend
" including HTML,JavaScript,SQL if enabled via options " including HTML,JavaScript,SQL if enabled via options
if (exists("php_html_in_nowdoc") && php_html_in_nowdoc) if (exists("php_html_in_nowdoc") && php_html_in_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\s*\z1\>" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\s*\z1\>" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif endif
if (exists("php_sql_nowdoc") && php_sql_nowdoc) if (exists("php_sql_nowdoc") && php_sql_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\s*\z1\>" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif endif
if (exists("php_xml_nowdoc") && php_xml_nowdoc) if (exists("php_xml_nowdoc") && php_xml_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)'$+ end="^\s*\z1\>" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif endif
" @end phpNowDoc " @end phpNowDoc
else
" @begin phpNowDoc
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend
" including HTML,JavaScript,SQL if enabled via options
if (exists("php_html_in_nowdoc") && php_html_in_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_nowdoc") && php_sql_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_nowdoc") && php_xml_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpNowDoc
endif
else else
" @copy phpHereDoc strip_maximum_size if b:php_version_id >= 70300
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend " @copy phpHereDoc strip_maximum_size
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\s*\z1\>" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\s*\z1\>" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
if (exists("php_html_in_heredoc") && php_html_in_heredoc) " including HTML,JavaScript,SQL if enabled via options
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\s*\z1\>" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpNowDoc
else
" @copy phpHereDoc strip_maximum_size
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options
if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpNowDoc
endif endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_xml_heredoc") && php_xml_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(xml\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@xmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" @end phpNowDoc
endif endif
syn case ignore syn case ignore

View File

@@ -59,16 +59,24 @@ syn match ps1Constant +\$^+
syn keyword ps1Keyword class define from using var syn keyword ps1Keyword class define from using var
" Function declarations " Function declarations
syn keyword ps1Keyword function nextgroup=ps1FunctionDeclaration skipwhite syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
syn keyword ps1Keyword filter nextgroup=ps1FunctionDeclaration skipwhite syn keyword ps1Keyword filter nextgroup=ps1Function skipwhite
syn keyword ps1Keyword workflow nextgroup=ps1FunctionDeclaration skipwhite syn keyword ps1Keyword workflow nextgroup=ps1Function skipwhite
syn keyword ps1Keyword configuration nextgroup=ps1FunctionDeclaration skipwhite syn keyword ps1Keyword configuration nextgroup=ps1Function skipwhite
syn keyword ps1Keyword class nextgroup=ps1FunctionDeclaration skipwhite syn keyword ps1Keyword class nextgroup=ps1Function skipwhite
syn keyword ps1Keyword enum nextgroup=ps1FunctionDeclaration skipwhite syn keyword ps1Keyword enum nextgroup=ps1Function skipwhite
syn match ps1FunctionDeclaration /\w\+\(-\w\+\)*/ contained
" Function invocations " Function declarations and invocations
syn match ps1FunctionInvocation /\w\+\(-\w\+\)\+/ syn match ps1Cmdlet /\v(add|clear|close|copy|enter|exit|find|format|get|hide|join|lock|move|new|open|optimize|pop|push|redo|remove|rename|reset|search|select|Set|show|skip|split|step|switch|undo|unlock|watch)(-\w+)+/ contained
syn match ps1Cmdlet /\v(connect|disconnect|read|receive|send|write)(-\w+)+/ contained
syn match ps1Cmdlet /\v(backup|checkpoint|compare|compress|convert|convertfrom|convertto|dismount|edit|expand|export|group|import|initialize|limit|merge|mount|out|publish|restore|save|sync|unpublish|update)(-\w+)+/ contained
syn match ps1Cmdlet /\v(debug|measure|ping|repair|resolve|test|trace)(-\w+)+/ contained
syn match ps1Cmdlet /\v(approve|assert|build|complete|confirm|deny|deploy|disable|enable|install|invoke|register|request|restart|resume|start|stop|submit|suspend|uninstall|unregister|wait)(-\w+)+/ contained
syn match ps1Cmdlet /\v(block|grant|protect|revoke|unblock|unprotect)(-\w+)+/ contained
syn match ps1Cmdlet /\v(use)(-\w+)+/ contained
" Other functions
syn match ps1Function /\w\+\(-\w\+\)\+/ contains=ps1Cmdlet
" Type declarations " Type declarations
syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/ syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/
@@ -164,8 +172,8 @@ if version >= 508 || !exists("did_ps1_syn_inits")
HiLink ps1Escape SpecialChar HiLink ps1Escape SpecialChar
HiLink ps1InterpolationDelimiter Delimiter HiLink ps1InterpolationDelimiter Delimiter
HiLink ps1Conditional Conditional HiLink ps1Conditional Conditional
HiLink ps1FunctionDeclaration Function HiLink ps1Cmdlet Function
HiLink ps1FunctionInvocation Function HiLink ps1Function Identifier
HiLink ps1Variable Identifier HiLink ps1Variable Identifier
HiLink ps1Boolean Boolean HiLink ps1Boolean Boolean
HiLink ps1Constant Constant HiLink ps1Constant Constant

View File

@@ -3,9 +3,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python') == -1
" For version 5.x: Clear all syntax items " For version 5.x: Clear all syntax items
" For versions greater than 6.x: Quit when a syntax file was already loaded " For versions greater than 6.x: Quit when a syntax file was already loaded
if v:version < 600 if v:version < 600
syntax clear syntax clear
elseif exists('b:current_syntax') elseif exists('b:current_syntax')
finish finish
endif endif
" "
@@ -16,22 +16,22 @@ command! -buffer Python3Syntax let b:python_version_2 = 0 | let &syntax=&syntax
" Enable option if it's not defined " Enable option if it's not defined
function! s:EnableByDefault(name) function! s:EnableByDefault(name)
if !exists(a:name) if !exists(a:name)
let {a:name} = 1 let {a:name} = 1
endif endif
endfunction endfunction
" Check if option is enabled " Check if option is enabled
function! s:Enabled(name) function! s:Enabled(name)
return exists(a:name) && {a:name} return exists(a:name) && {a:name}
endfunction endfunction
" Is it Python 2 syntax? " Is it Python 2 syntax?
function! s:Python2Syntax() function! s:Python2Syntax()
if exists('b:python_version_2') if exists('b:python_version_2')
return b:python_version_2 return b:python_version_2
endif endif
return s:Enabled('g:python_version_2') return s:Enabled('g:python_version_2')
endfunction endfunction
" "
@@ -42,22 +42,31 @@ call s:EnableByDefault('g:python_slow_sync')
call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg') call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
if s:Enabled('g:python_highlight_all') if s:Enabled('g:python_highlight_all')
call s:EnableByDefault('g:python_highlight_builtins') call s:EnableByDefault('g:python_highlight_builtins')
if s:Enabled('g:python_highlight_builtins') if s:Enabled('g:python_highlight_builtins')
call s:EnableByDefault('g:python_highlight_builtin_objs') call s:EnableByDefault('g:python_highlight_builtin_objs')
call s:EnableByDefault('g:python_highlight_builtin_funcs') call s:EnableByDefault('g:python_highlight_builtin_funcs')
call s:EnableByDefault('g:python_highlight_builtin_types') call s:EnableByDefault('g:python_highlight_builtin_types')
endif endif
call s:EnableByDefault('g:python_highlight_exceptions') call s:EnableByDefault('g:python_highlight_exceptions')
call s:EnableByDefault('g:python_highlight_string_formatting') call s:EnableByDefault('g:python_highlight_string_formatting')
call s:EnableByDefault('g:python_highlight_string_format') call s:EnableByDefault('g:python_highlight_string_format')
call s:EnableByDefault('g:python_highlight_string_templates') call s:EnableByDefault('g:python_highlight_string_templates')
call s:EnableByDefault('g:python_highlight_indent_errors') call s:EnableByDefault('g:python_highlight_indent_errors')
call s:EnableByDefault('g:python_highlight_space_errors') call s:EnableByDefault('g:python_highlight_space_errors')
call s:EnableByDefault('g:python_highlight_doctests') call s:EnableByDefault('g:python_highlight_doctests')
call s:EnableByDefault('g:python_print_as_function') call s:EnableByDefault('g:python_print_as_function')
call s:EnableByDefault('g:python_highlight_class_vars') call s:EnableByDefault('g:python_highlight_func_calls')
call s:EnableByDefault('g:python_highlight_operators') call s:EnableByDefault('g:python_highlight_class_vars')
call s:EnableByDefault('g:python_highlight_operators')
endif
"
" Function calls
"
if s:Enabled('g:python_highlight_func_calls')
syn match pythonFunctionCall '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\ze\%(\s*(\)'
endif endif
" "
@@ -68,7 +77,7 @@ syn keyword pythonStatement break continue del return pass yield global asse
syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
if s:Enabled('g:python_highlight_class_vars') if s:Enabled('g:python_highlight_class_vars')
syn keyword pythonClassVar self cls syn keyword pythonClassVar self cls
endif endif
syn keyword pythonRepeat for while syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else syn keyword pythonConditional if elif else
@@ -82,20 +91,20 @@ syn match pythonImport '^\s*\zsfrom\>'
if s:Python2Syntax() if s:Python2Syntax()
if !s:Enabled('g:python_print_as_function') if !s:Enabled('g:python_print_as_function')
syn keyword pythonStatement print syn keyword pythonStatement print
endif endif
syn keyword pythonStatement exec syn keyword pythonStatement exec
syn keyword pythonImport as syn keyword pythonImport as
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained
else else
syn keyword pythonStatement as nonlocal syn keyword pythonStatement as nonlocal
syn match pythonStatement '\v\.@<!<await>' syn match pythonStatement '\v\.@<!<await>'
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
syn match pythonStatement '\<async\s\+with\>' syn match pythonStatement '\<async\s\+with\>'
syn match pythonStatement '\<async\s\+for\>' syn match pythonStatement '\<async\s\+for\>'
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType
endif endif
@@ -114,9 +123,9 @@ syn match pythonError '[$?]\|\([-+@%&|^~]\)\1\{1,}\|\([=*/<>]\)\2\{2,}
syn match pythonDecorator '^\s*\zs@' display nextgroup=pythonDottedName skipwhite syn match pythonDecorator '^\s*\zs@' display nextgroup=pythonDottedName skipwhite
if s:Python2Syntax() if s:Python2Syntax()
syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained
else else
syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained
endif endif
syn match pythonDot '\.' display containedin=pythonDottedName syn match pythonDot '\.' display containedin=pythonDottedName
@@ -126,8 +135,8 @@ syn match pythonDot '\.' display containedin=pythonDottedName
syn match pythonComment '#.*$' display contains=pythonTodo,@Spell syn match pythonComment '#.*$' display contains=pythonTodo,@Spell
if !s:Enabled('g:python_highlight_file_headers_as_comments') if !s:Enabled('g:python_highlight_file_headers_as_comments')
syn match pythonRun '\%^#!.*$' syn match pythonRun '\%^#!.*$'
syn match pythonCoding '\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$' syn match pythonCoding '\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$'
endif endif
syn keyword pythonTodo TODO FIXME XXX contained syn keyword pythonTodo TODO FIXME XXX contained
@@ -140,12 +149,12 @@ syn match pythonError '\<\d\+[^0-9[:space:]]\+\>' display
" Mixing spaces and tabs also may be used for pretty formatting multiline " Mixing spaces and tabs also may be used for pretty formatting multiline
" statements " statements
if s:Enabled('g:python_highlight_indent_errors') if s:Enabled('g:python_highlight_indent_errors')
syn match pythonIndentError '^\s*\%( \t\|\t \)\s*\S'me=e-1 display syn match pythonIndentError '^\s*\%( \t\|\t \)\s*\S'me=e-1 display
endif endif
" Trailing space errors " Trailing space errors
if s:Enabled('g:python_highlight_space_errors') if s:Enabled('g:python_highlight_space_errors')
syn match pythonSpaceError '\s\+$' display syn match pythonSpaceError '\s\+$' display
endif endif
" "
@@ -153,20 +162,20 @@ endif
" "
if s:Python2Syntax() if s:Python2Syntax()
" Python 2 strings " Python 2 strings
syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+[bB]\="""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell syn region pythonString start=+[bB]\="""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonString start=+[bB]\='''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell syn region pythonString start=+[bB]\='''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
else else
" Python 3 byte strings " Python 3 byte strings
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
syn region pythonBytes start=+[bB]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell syn region pythonBytes start=+[bB]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
syn region pythonBytes start=+[bB]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell syn region pythonBytes start=+[bB]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
syn match pythonBytesError '.\+' display contained syn match pythonBytesError '.\+' display contained
syn match pythonBytesContent '[\u0000-\u00ff]\+' display contained contains=pythonBytesEscape,pythonBytesEscapeError syn match pythonBytesContent '[\u0000-\u00ff]\+' display contained contains=pythonBytesEscape,pythonBytesEscapeError
endif endif
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
@@ -184,100 +193,100 @@ syn match pythonUniEscape '\\N{[A-Z ]\+}' display contained
syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained
if s:Python2Syntax() if s:Python2Syntax()
" Python 2 Unicode strings " Python 2 Unicode strings
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell syn region pythonUniString start=+[uU]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonUniString start=+[uU]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell syn region pythonUniString start=+[uU]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
else else
" Python 3 strings " Python 3 strings
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell syn region pythonString start=+'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonString start=+"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell syn region pythonString start=+"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonFString start=+[fF]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonFString start=+[fF]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonFString start=+[fF]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonFString start=+[fF]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonFString start=+[fF]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell syn region pythonFString start=+[fF]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonFString start=+[fF]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell syn region pythonFString start=+[fF]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
endif endif
if s:Python2Syntax() if s:Python2Syntax()
" Python 2 Unicode raw strings " Python 2 Unicode raw strings
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell syn region pythonUniRawString start=+[uU][rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonUniRawString start=+[uU][rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell syn region pythonUniRawString start=+[uU][rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn match pythonUniRawEscape '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{4}' display contained syn match pythonUniRawEscape '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{4}' display contained
syn match pythonUniRawEscapeError '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{,3}\X' display contained syn match pythonUniRawEscapeError '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{,3}\X' display contained
endif endif
" Python 2/3 raw strings " Python 2/3 raw strings
if s:Python2Syntax() if s:Python2Syntax()
syn region pythonRawString start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawString start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawString start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[bB]\=[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell syn region pythonRawString start=+[bB]\=[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawString start=+[bB]\=[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell syn region pythonRawString start=+[bB]\=[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
else else
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell syn region pythonRawString start=+[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawString start=+[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell syn region pythonRawString start=+[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest,pythonSpaceError,@Spell syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
endif endif
syn match pythonRawEscape +\\['"]+ display contained syn match pythonRawEscape +\\['"]+ display contained
if s:Enabled('g:python_highlight_string_formatting') if s:Enabled('g:python_highlight_string_formatting')
" % operator string formatting " % operator string formatting
if s:Python2Syntax() if s:Python2Syntax()
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
else else
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
endif endif
endif endif
if s:Enabled('g:python_highlight_string_format') if s:Enabled('g:python_highlight_string_format')
" str.format syntax " str.format syntax
if s:Python2Syntax() if s:Python2Syntax()
syn match pythonStrFormat '{{\|}}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString syn match pythonStrFormat '{{\|}}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrFormat '{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString syn match pythonStrFormat '{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else else
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
syn region pythonStrInterpRegion start="{"he=e+1,rs=e+1 end="\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}"hs=s-1,re=s-1 extend contained containedin=pythonFString,pythonRawFString contains=pythonStrInterpRegion,@pythonExpression syn region pythonStrInterpRegion start="{"he=e+1,rs=e+1 end="\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}"hs=s-1,re=s-1 extend contained containedin=pythonFString,pythonRawFString contains=pythonStrInterpRegion,@pythonExpression
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString,pythonFString,pythonRawFString syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString,pythonFString,pythonRawFString
endif endif
endif endif
if s:Enabled('g:python_highlight_string_templates') if s:Enabled('g:python_highlight_string_templates')
" string.Template format " string.Template format
if s:Python2Syntax() if s:Python2Syntax()
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else else
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonRawString syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonRawString
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonRawString syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonRawString
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonRawString syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonRawString
endif endif
endif endif
if s:Enabled('g:python_highlight_doctests') if s:Enabled('g:python_highlight_doctests')
" DocTests " DocTests
syn region pythonDocTest start='^\s*>>>' skip=+\\'+ end=+'''+he=s-1 end='^\s*$' contained syn region pythonDocTest start='^\s*>>>' skip=+\\'+ end=+'''+he=s-1 end='^\s*$' contained
syn region pythonDocTest2 start='^\s*>>>' skip=+\\"+ end=+"""+he=s-1 end='^\s*$' contained syn region pythonDocTest2 start='^\s*>>>' skip=+\\"+ end=+"""+he=s-1 end='^\s*$' contained
endif endif
" "
@@ -285,51 +294,51 @@ endif
" "
if s:Python2Syntax() if s:Python2Syntax()
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>' display syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>' display
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*[lL]\=\>' display syn match pythonOctError '\<0[oO]\=\o*\D\+\d*[lL]\=\>' display
syn match pythonBinError '\<0[bB][01]*\D\+\d*[lL]\=\>' display syn match pythonBinError '\<0[bB][01]*\D\+\d*[lL]\=\>' display
syn match pythonHexNumber '\<0[xX]\x\+[lL]\=\>' display syn match pythonHexNumber '\<0[xX]\x\+[lL]\=\>' display
syn match pythonOctNumber '\<0[oO]\o\+[lL]\=\>' display syn match pythonOctNumber '\<0[oO]\o\+[lL]\=\>' display
syn match pythonBinNumber '\<0[bB][01]\+[lL]\=\>' display syn match pythonBinNumber '\<0[bB][01]\+[lL]\=\>' display
syn match pythonNumberError '\<\d\+\D[lL]\=\>' display syn match pythonNumberError '\<\d\+\D[lL]\=\>' display
syn match pythonNumber '\<\d[lL]\=\>' display syn match pythonNumber '\<\d[lL]\=\>' display
syn match pythonNumber '\<[0-9]\d\+[lL]\=\>' display syn match pythonNumber '\<[0-9]\d\+[lL]\=\>' display
syn match pythonNumber '\<\d\+[lLjJ]\>' display syn match pythonNumber '\<\d\+[lLjJ]\>' display
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*[lL]\=\>' display syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*[lL]\=\>' display
syn match pythonBinError '\<0[bB][01]*[2-9]\d*[lL]\=\>' display syn match pythonBinError '\<0[bB][01]*[2-9]\d*[lL]\=\>' display
syn match pythonFloat '\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>' display syn match pythonFloat '\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>' display
syn match pythonFloat '\<\d\+[eE][+-]\=\d\+[jJ]\=\>' display syn match pythonFloat '\<\d\+[eE][+-]\=\d\+[jJ]\=\>' display
syn match pythonFloat '\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=' display syn match pythonFloat '\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=' display
else else
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*\>' display syn match pythonOctError '\<0[oO]\=\o*\D\+\d*\>' display
" pythonHexError comes after pythonOctError so that 0xffffl is pythonHexError " pythonHexError comes after pythonOctError so that 0xffffl is pythonHexError
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\x*\>' display syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\x*\>' display
syn match pythonBinError '\<0[bB][01]*\D\+\d*\>' display syn match pythonBinError '\<0[bB][01]*\D\+\d*\>' display
syn match pythonHexNumber '\<0[xX][_0-9a-fA-F]*\x\>' display syn match pythonHexNumber '\<0[xX][_0-9a-fA-F]*\x\>' display
syn match pythonOctNumber '\<0[oO][_0-7]*\o\>' display syn match pythonOctNumber '\<0[oO][_0-7]*\o\>' display
syn match pythonBinNumber '\<0[bB][_01]*[01]\>' display syn match pythonBinNumber '\<0[bB][_01]*[01]\>' display
syn match pythonNumberError '\<\d[_0-9]*\D\>' display syn match pythonNumberError '\<\d[_0-9]*\D\>' display
syn match pythonNumberError '\<0[_0-9]\+\>' display syn match pythonNumberError '\<0[_0-9]\+\>' display
syn match pythonNumberError '\<0_x\S*\>' display syn match pythonNumberError '\<0_x\S*\>' display
syn match pythonNumberError '\<0[bBxXoO][_0-9a-fA-F]*_\>' display syn match pythonNumberError '\<0[bBxXoO][_0-9a-fA-F]*_\>' display
syn match pythonNumberError '\<\d[_0-9]*_\>' display syn match pythonNumberError '\<\d[_0-9]*_\>' display
syn match pythonNumber '\<\d\>' display syn match pythonNumber '\<\d\>' display
syn match pythonNumber '\<[1-9][_0-9]*\d\>' display syn match pythonNumber '\<[1-9][_0-9]*\d\>' display
syn match pythonNumber '\<\d[jJ]\>' display syn match pythonNumber '\<\d[jJ]\>' display
syn match pythonNumber '\<[1-9][_0-9]*\d[jJ]\>' display syn match pythonNumber '\<[1-9][_0-9]*\d[jJ]\>' display
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*\>' display syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*\>' display
syn match pythonBinError '\<0[bB][01]*[2-9]\d*\>' display syn match pythonBinError '\<0[bB][01]*[2-9]\d*\>' display
syn match pythonFloat '\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>' display syn match pythonFloat '\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>' display
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>' display syn match pythonFloat '\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>' display
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=\.\d\=\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display syn match pythonFloat '\<\d\%([_0-9]*\d\)\=\.\d\=\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display
endif endif
" "
@@ -337,11 +346,11 @@ endif
" "
if s:Enabled('g:python_highlight_builtin_objs') if s:Enabled('g:python_highlight_builtin_objs')
syn keyword pythonNone None syn keyword pythonNone None
syn keyword pythonBoolean True False syn keyword pythonBoolean True False
syn keyword pythonSingleton Ellipsis NotImplemented syn keyword pythonSingleton Ellipsis NotImplemented
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__ syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__ syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__
endif endif
" "
@@ -349,25 +358,25 @@ endif
" "
if s:Enabled('g:python_highlight_builtin_funcs') if s:Enabled('g:python_highlight_builtin_funcs')
let s:funcs_re = '__import__|abs|all|any|bin|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip' let s:funcs_re = '__import__|abs|all|any|bin|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip'
if s:Python2Syntax() if s:Python2Syntax()
let s:funcs_re .= '|apply|basestring|buffer|cmp|coerce|execfile|file|intern|long|raw_input|reduce|reload|unichr|unicode|xrange' let s:funcs_re .= '|apply|basestring|buffer|cmp|coerce|execfile|file|intern|long|raw_input|reduce|reload|unichr|unicode|xrange'
if s:Enabled('g:python_print_as_function') if s:Enabled('g:python_print_as_function')
let s:funcs_re .= '|print' let s:funcs_re .= '|print'
endif
else
let s:funcs_re .= '|ascii|breakpoint|exec|print'
endif endif
else
let s:funcs_re .= '|ascii|breakpoint|exec|print'
endif
let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>' let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'
if !s:Enabled('g:python_highlight_builtin_funcs_kwarg') if !s:Enabled('g:python_highlight_builtin_funcs_kwarg')
let s:funcs_re .= '\=@!' let s:funcs_re .= '\=@!'
endif endif
execute s:funcs_re . '''' execute s:funcs_re . ''''
unlet s:funcs_re unlet s:funcs_re
endif endif
" "
@@ -375,7 +384,7 @@ endif
" "
if s:Enabled('g:python_highlight_builtin_types') if s:Enabled('g:python_highlight_builtin_types')
syn match pythonBuiltinType '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>' syn match pythonBuiltinType '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
endif endif
@@ -386,110 +395,115 @@ endif
if s:Enabled('g:python_highlight_exceptions') if s:Enabled('g:python_highlight_exceptions')
let s:exs_re = 'BaseException|Exception|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|BufferError|EOFError|FloatingPointError|GeneratorExit|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|VMSError|WindowsError|ZeroDivisionError|Warning|UserWarning|BytesWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning' let s:exs_re = 'BaseException|Exception|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|BufferError|EOFError|FloatingPointError|GeneratorExit|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|VMSError|WindowsError|ZeroDivisionError|Warning|UserWarning|BytesWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning'
if s:Python2Syntax() if s:Python2Syntax()
let s:exs_re .= '|StandardError' let s:exs_re .= '|StandardError'
else else
let s:exs_re .= '|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning' let s:exs_re .= '|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
endif endif
execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>''' execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>'''
unlet s:exs_re unlet s:exs_re
endif endif
"
" Misc
"
if s:Enabled('g:python_slow_sync') if s:Enabled('g:python_slow_sync')
syn sync minlines=2000 syn sync minlines=2000
else else
" This is fast but code inside triple quoted strings screws it up. It " This is fast but code inside triple quoted strings screws it up. It
" is impossible to fix because the only way to know if you are inside a " is impossible to fix because the only way to know if you are inside a
" triple quoted string is to start from the beginning of the file. " triple quoted string is to start from the beginning of the file.
syn sync match pythonSync grouphere NONE '):$' syn sync match pythonSync grouphere NONE '):$'
syn sync maxlines=200 syn sync maxlines=200
endif endif
if v:version >= 508 || !exists('did_python_syn_inits') if v:version >= 508 || !exists('did_python_syn_inits')
if v:version <= 508 if v:version <= 508
let did_python_syn_inits = 1 let did_python_syn_inits = 1
command -nargs=+ HiLink hi link <args> command -nargs=+ HiLink hi link <args>
else else
command -nargs=+ HiLink hi def link <args> command -nargs=+ HiLink hi def link <args>
endif endif
HiLink pythonStatement Statement HiLink pythonStatement Statement
HiLink pythonRaiseFromStatement Statement HiLink pythonRaiseFromStatement Statement
HiLink pythonImport Include HiLink pythonImport Include
HiLink pythonFunction Function HiLink pythonFunction Function
HiLink pythonConditional Conditional HiLink pythonFunctionCall Function
HiLink pythonRepeat Repeat HiLink pythonConditional Conditional
HiLink pythonException Exception HiLink pythonRepeat Repeat
HiLink pythonOperator Operator HiLink pythonException Exception
HiLink pythonOperator Operator
HiLink pythonDecorator Define HiLink pythonDecorator Define
HiLink pythonDottedName Function HiLink pythonDottedName Function
HiLink pythonComment Comment HiLink pythonComment Comment
if !s:Enabled('g:python_highlight_file_headers_as_comments') if !s:Enabled('g:python_highlight_file_headers_as_comments')
HiLink pythonCoding Special HiLink pythonCoding Special
HiLink pythonRun Special HiLink pythonRun Special
endif endif
HiLink pythonTodo Todo HiLink pythonTodo Todo
HiLink pythonError Error HiLink pythonError Error
HiLink pythonIndentError Error HiLink pythonIndentError Error
HiLink pythonSpaceError Error HiLink pythonSpaceError Error
HiLink pythonString String HiLink pythonString String
HiLink pythonRawString String HiLink pythonRawString String
HiLink pythonRawEscape Special HiLink pythonRawEscape Special
HiLink pythonUniEscape Special HiLink pythonUniEscape Special
HiLink pythonUniEscapeError Error HiLink pythonUniEscapeError Error
if s:Python2Syntax() if s:Python2Syntax()
HiLink pythonUniString String HiLink pythonUniString String
HiLink pythonUniRawString String HiLink pythonUniRawString String
HiLink pythonUniRawEscape Special HiLink pythonUniRawEscape Special
HiLink pythonUniRawEscapeError Error HiLink pythonUniRawEscapeError Error
else else
HiLink pythonBytes String HiLink pythonBytes String
HiLink pythonRawBytes String HiLink pythonRawBytes String
HiLink pythonBytesContent String HiLink pythonBytesContent String
HiLink pythonBytesError Error HiLink pythonBytesError Error
HiLink pythonBytesEscape Special HiLink pythonBytesEscape Special
HiLink pythonBytesEscapeError Error HiLink pythonBytesEscapeError Error
HiLink pythonFString String HiLink pythonFString String
HiLink pythonRawFString String HiLink pythonRawFString String
HiLink pythonStrInterpRegion Special HiLink pythonStrInterpRegion Special
endif endif
HiLink pythonStrFormatting Special HiLink pythonStrFormatting Special
HiLink pythonStrFormat Special HiLink pythonStrFormat Special
HiLink pythonStrTemplate Special HiLink pythonStrTemplate Special
HiLink pythonDocTest Special HiLink pythonDocTest Special
HiLink pythonDocTest2 Special HiLink pythonDocTest2 Special
HiLink pythonNumber Number HiLink pythonNumber Number
HiLink pythonHexNumber Number HiLink pythonHexNumber Number
HiLink pythonOctNumber Number HiLink pythonOctNumber Number
HiLink pythonBinNumber Number HiLink pythonBinNumber Number
HiLink pythonFloat Float HiLink pythonFloat Float
HiLink pythonNumberError Error HiLink pythonNumberError Error
HiLink pythonOctError Error HiLink pythonOctError Error
HiLink pythonHexError Error HiLink pythonHexError Error
HiLink pythonBinError Error HiLink pythonBinError Error
HiLink pythonBoolean Boolean HiLink pythonBoolean Boolean
HiLink pythonNone Constant HiLink pythonNone Constant
HiLink pythonSingleton Constant HiLink pythonSingleton Constant
HiLink pythonBuiltinObj Identifier HiLink pythonBuiltinObj Identifier
HiLink pythonBuiltinFunc Function HiLink pythonBuiltinFunc Function
HiLink pythonBuiltinType Structure HiLink pythonBuiltinType Structure
HiLink pythonExClass Structure HiLink pythonExClass Structure
HiLink pythonClassVar Identifier HiLink pythonClassVar Identifier
delcommand HiLink delcommand HiLink
endif endif
let b:current_syntax = 'python' let b:current_syntax = 'python'

View File

@@ -16,154 +16,154 @@ endif
" Syntax definitions {{{1 " Syntax definitions {{{1
" Basic keywords {{{2 " Basic keywords {{{2
syn keyword rustConditional switch match if else for in when fun syn keyword reasonConditional switch match if else for in when fun
syn keyword rustOperator as syn keyword reasonOperator as
syn match rustAssert "\<assert\(\w\)*!" contained syn match reasonAssert "\<assert\(\w\)*!" contained
syn match rustPanic "\<panic\(\w\)*!" contained syn match reasonPanic "\<panic\(\w\)*!" contained
syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty syn keyword reasonKeyword box nextgroup=reasonBoxPlacement skipwhite skipempty
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty syn keyword reasonKeyword extern nextgroup=reasonExternCrate,reasonObsoleteExternMod skipwhite skipempty
" syn keyword rustKeyword fun nextgroup=rustFuncName skipwhite skipempty " syn keyword reasonKeyword fun nextgroup=reasonFuncName skipwhite skipempty
syn keyword rustKeyword unsafe where while lazy syn keyword reasonKeyword unsafe where while lazy
syn keyword rustStorage and class constraint exception external include inherit let method module nonrec open private rec type val with syn keyword reasonStorage and class constraint exception external include inherit let method module nonrec open private rec type val with
" FIXME: Scoped impl's name is also fallen in this category " FIXME: Scoped impl's name is also fallen in this category
" syn keyword rustStorageIdent let and module type nextgroup=rustIdentifier skipwhite skipempty " syn keyword reasonStorageIdent let and module type nextgroup=reasonIdentifier skipwhite skipempty
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier,rustExternCrateString skipwhite skipempty syn keyword reasonExternCrate crate contained nextgroup=reasonIdentifier,reasonExternCrateString skipwhite skipempty
" This is to get the `bar` part of `extern crate "foo" as bar;` highlighting. " This is to get the `bar` part of `extern crate "foo" as bar;` highlighting.
syn match rustExternCrateString /".*"\_s*as/ contained nextgroup=rustIdentifier skipwhite transparent skipempty contains=rustString,rustOperator syn match reasonExternCrateString /".*"\_s*as/ contained nextgroup=reasonIdentifier skipwhite transparent skipempty contains=reasonString,reasonOperator
syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite skipempty syn keyword reasonObsoleteExternMod mod contained nextgroup=reasonIdentifier skipwhite skipempty
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match reasonIdentifier contains=reasonIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match reasonFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
" "
syn match labelArgument "\(\l\|_\)\(\w\|'\)*::\(?\)\?"lc=0 "Allows any space between label name and :: syn match labelArgument "\(\l\|_\)\(\w\|'\)*::\(?\)\?"lc=0 "Allows any space between label name and ::
syn match labelArgumentPunned "::\(?\)\?\(\l\|_\)\(\w\|'\)*"lc=0 "Allows any space between label name and :: syn match labelArgumentPunned "::\(?\)\?\(\l\|_\)\(\w\|'\)*"lc=0 "Allows any space between label name and ::
syn match rustEnumVariant "\<\u\(\w\|'\)*\>[^\.]"me=e-1 syn match reasonEnumVariant "\<\u\(\w\|'\)*\>[^\.]"me=e-1
" Polymorphic variants " Polymorphic variants
syn match rustEnumVariant "`\w\(\w\|'\)*\>" syn match reasonEnumVariant "`\w\(\w\|'\)*\>"
syn match rustModPath "\<\u\w*\." syn match reasonModPath "\<\u\w*\."
syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained syn region reasonBoxPlacement matchgroup=reasonBoxPlacementParens start="(" end=")" contains=TOP contained
" Ideally we'd have syntax rules set up to match arbitrary expressions. Since " Ideally we'd have syntax rules set up to match arbitrary expressions. Since
" we don't, we'll just define temporary contained rules to handle balancing " we don't, we'll just define temporary contained rules to handle balancing
" delimiters. " delimiters.
syn region rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlacement transparent syn region reasonBoxPlacementBalance start="(" end=")" containedin=reasonBoxPlacement transparent
syn region rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent syn region reasonBoxPlacementBalance start="\[" end="\]" containedin=reasonBoxPlacement transparent
" {} are handled by rustFoldBraces " {} are handled by reasonFoldBraces
syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount syn region reasonMacroRepeat matchgroup=reasonMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=reasonMacroRepeatCount
syn match rustMacroRepeatCount ".\?[*+]" contained syn match reasonMacroRepeatCount ".\?[*+]" contained
syn match rustMacroVariable "$\w\+" syn match reasonMacroVariable "$\w\+"
" Reserved (but not yet used) keywords {{{2 " Reserved (but not yet used) keywords {{{2
syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro syn keyword reasonReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro
" Built-in types {{{2 " Built-in types {{{2
syn keyword rustType int float option list array unit ref bool string syn keyword reasonType int float option list array unit ref bool string
" Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2 " Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2
" This section is just straight transformation of the contents of the prelude, " This section is just straight transformation of the contents of the prelude,
" to make it easy to update. " to make it easy to update.
" Reexported core operators {{{3 " Reexported core operators {{{3
syn keyword rustTrait Copy Send Sized Sync syn keyword reasonTrait Copy Send Sized Sync
syn keyword rustTrait Drop Fn FnMut FnOnce syn keyword reasonTrait Drop Fn FnMut FnOnce
" Reexported functions {{{3 " Reexported functions {{{3
" Theres no point in highlighting these; when one writes drop( or drop::< it " Theres no point in highlighting these; when one writes drop( or drop::< it
" gets the same highlighting anyway, and if someone writes `let drop = …;` we " gets the same highlighting anyway, and if someone writes `let drop = …;` we
" dont really want *that* drop to be highlighted. " dont really want *that* drop to be highlighted.
"syn keyword rustFunction drop "syn keyword reasonFunction drop
" Reexported types and traits {{{3 " Reexported types and traits {{{3
syn keyword rustTrait Box syn keyword reasonTrait Box
syn keyword rustTrait ToOwned syn keyword reasonTrait ToOwned
syn keyword rustTrait Clone syn keyword reasonTrait Clone
syn keyword rustTrait PartialEq PartialOrd Eq Ord syn keyword reasonTrait PartialEq PartialOrd Eq Ord
syn keyword rustTrait AsRef AsMut Into From syn keyword reasonTrait AsRef AsMut Into From
syn keyword rustTrait Default syn keyword reasonTrait Default
syn keyword rustTrait Iterator Extend IntoIterator syn keyword reasonTrait Iterator Extend IntoIterator
syn keyword rustTrait DoubleEndedIterator ExactSizeIterator syn keyword reasonTrait DoubleEndedIterator ExactSizeIterator
syn keyword rustEnum Option syn keyword reasonEnum Option
syn keyword rustEnumVariant Some None syn keyword reasonEnumVariant Some None
syn keyword rustEnum Result syn keyword reasonEnum Result
syn keyword rustEnumVariant Ok Err syn keyword reasonEnumVariant Ok Err
syn keyword rustTrait SliceConcatExt syn keyword reasonTrait SliceConcatExt
syn keyword rustTrait String ToString syn keyword reasonTrait String ToString
syn keyword rustTrait Vec syn keyword reasonTrait Vec
" Other syntax {{{2 " Other syntax {{{2
syn keyword rustSelf self syn keyword reasonSelf self
syn keyword rustBoolean true false syn keyword reasonBoolean true false
" This is merely a convention; note also the use of [A-Z], restricting it to " This is merely a convention; note also the use of [A-Z], restricting it to
" latin identifiers rather than the full Unicode uppercase. I have not used " latin identifiers rather than the full Unicode uppercase. I have not used
" [:upper:] as it depends upon 'noignorecase' " [:upper:] as it depends upon 'noignorecase'
"syn match rustCapsIdent display "[A-Z]\w\(\w\)*" "syn match reasonCapsIdent display "[A-Z]\w\(\w\)*"
syn match rustOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?" syn match reasonOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?"
" This one isn't *quite* right, as we could have binary-& with a reference " This one isn't *quite* right, as we could have binary-& with a reference
" This isn't actually correct; a closure with no arguments can be `|| { }`. " This isn't actually correct; a closure with no arguments can be `|| { }`.
" Last, because the & in && isn't a sigil " Last, because the & in && isn't a sigil
syn match rustOperator display "&&\|||" syn match reasonOperator display "&&\|||"
" This is rustArrowCharacter rather than rustArrow for the sake of matchparen, " This is reasonArrowCharacter rather than reasonArrow for the sake of matchparen,
" so it skips the ->; see http://stackoverflow.com/a/30309949 for details. " so it skips the ->; see http://stackoverflow.com/a/30309949 for details.
syn match rustArrowCharacter display "=>" syn match reasonArrowCharacter display "=>"
syn match rustEscapeError display contained /\\./ syn match reasonEscapeError display contained /\\./
syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ syn match reasonEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/
syn match rustEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{8}\)/ syn match reasonEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{8}\)/
syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/ syn match reasonEscapeUnicode display contained /\\u{\x\{1,6}}/
syn match rustStringContinuation display contained /\\\n\s*/ syn match reasonStringContinuation display contained /\\\n\s*/
syn region rustString start='{j|' end='|j}' contains=rustMacroVariable,@Spell syn region reasonString start='{j|' end='|j}' contains=reasonMacroVariable,@Spell
syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation syn region reasonString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=reasonEscape,reasonEscapeError,reasonStringContinuation
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell syn region reasonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=reasonEscape,reasonEscapeUnicode,reasonEscapeError,reasonStringContinuation,@Spell
syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell syn region reasonString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell
syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive syn region reasonAttribute start="#!\?\[" end="\]" contains=reasonString,reasonDerive
syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait syn region reasonDerive start="derive(" end=")" contained contains=reasonDeriveTrait
" This list comes from src/libsyntax/ext/deriving/mod.rs " This list comes from src/libsyntax/ext/deriving/mod.rs
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). " Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).
syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy syn keyword reasonDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy
" Number literals " Number literals
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\=" syn match reasonDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\="
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\=" syn match reasonHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\=" syn match reasonOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\=" syn match reasonBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
" Special case for numbers of the form "1." which are float literals, unless followed by " Special case for numbers of the form "1." which are float literals, unless followed by
" an identifier, which makes them integer literals with a method call or field access, " an identifier, which makes them integer literals with a method call or field access,
" or by another ".", which makes them integer literals followed by the ".." token. " or by another ".", which makes them integer literals followed by the ".." token.
" (This must go first so the others take precedence.) " (This must go first so the others take precedence.)
syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\|\.\)\@!" syn match reasonFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\|\.\)\@!"
" To mark a number as a normal float, it must have at least one of the three things integral values don't have: " To mark a number as a normal float, it must have at least one of the three things integral values don't have:
" a decimal point and more numbers; an exponent; and a type suffix. " a decimal point and more numbers; an exponent; and a type suffix.
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\=" syn match reasonFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\="
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\=" syn match reasonFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\="
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)" syn match reasonFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"
" For the benefit of delimitMate " For the benefit of delimitMate
syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ syn match reasonCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/
" The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII). " The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII).
syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ syn match reasonCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/
syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode syn match reasonCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=reasonEscape,reasonEscapeError,reasonCharacterInvalid,reasonCharacterInvalidUnicode
syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid syn match reasonCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|u{\x\{1,6}}\)\)'/ contains=reasonEscape,reasonEscapeUnicode,reasonEscapeError,reasonCharacterInvalid
syn match rustShebang /\%^#![^[].*/ syn match reasonShebang /\%^#![^[].*/
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell syn region reasonCommentLine start="//" end="$" contains=reasonTodo,@Spell
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell syn region reasonCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=reasonTodo,@Spell
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell syn region reasonCommentBlock matchgroup=reasonCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=reasonTodo,reasonCommentBlockNest,@Spell
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell syn region reasonCommentBlockDoc matchgroup=reasonCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=reasonTodo,reasonCommentBlockDocNest,@Spell
syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent syn region reasonCommentBlockNest matchgroup=reasonCommentBlock start="/\*" end="\*/" contains=reasonTodo,reasonCommentBlockNest,@Spell contained transparent
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent syn region reasonCommentBlockDocNest matchgroup=reasonCommentBlockDoc start="/\*" end="\*/" contains=reasonTodo,reasonCommentBlockDocNest,@Spell contained transparent
" FIXME: this is a really ugly and not fully correct implementation. Most " FIXME: this is a really ugly and not fully correct implementation. Most
" importantly, a case like ``/* */*`` should have the final ``*`` not being in " importantly, a case like ``/* */*`` should have the final ``*`` not being in
" a comment, but in practice at present it leaves comments open two levels " a comment, but in practice at present it leaves comments open two levels
@@ -176,79 +176,79 @@ syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*"
" then you must deal with cases like ``/*/**/*/``. And don't try making it " then you must deal with cases like ``/*/**/*/``. And don't try making it
" worse with ``\%(/\@<!\*\)\@<!``, either... " worse with ``\%(/\@<!\*\)\@<!``, either...
syn keyword rustTodo contained TODO FIXME XXX NB NOTE syn keyword reasonTodo contained TODO FIXME XXX NB NOTE
" Folding rules {{{2 " Folding rules {{{2
" Trivial folding rules to begin with. " Trivial folding rules to begin with.
" FIXME: use the AST to make really good folding " FIXME: use the AST to make really good folding
syn region rustFoldBraces start="{" end="}" transparent fold syn region reasonFoldBraces start="{" end="}" transparent fold
" Default highlighting {{{1 " Default highlighting {{{1
hi def link labelArgument Special hi def link labelArgument Special
hi def link labelArgumentPunned Special hi def link labelArgumentPunned Special
hi def link rustDecNumber rustNumber hi def link reasonDecNumber reasonNumber
hi def link rustHexNumber rustNumber hi def link reasonHexNumber reasonNumber
hi def link rustOctNumber rustNumber hi def link reasonOctNumber reasonNumber
hi def link rustBinNumber rustNumber hi def link reasonBinNumber reasonNumber
hi def link rustIdentifierPrime rustIdentifier hi def link reasonIdentifierPrime reasonIdentifier
hi def link rustTrait rustType hi def link reasonTrait reasonType
hi def link rustDeriveTrait rustTrait hi def link reasonDeriveTrait reasonTrait
hi def link rustMacroRepeatCount rustMacroRepeatDelimiters hi def link reasonMacroRepeatCount reasonMacroRepeatDelimiters
hi def link rustMacroRepeatDelimiters Macro hi def link reasonMacroRepeatDelimiters Macro
hi def link rustMacroVariable Define hi def link reasonMacroVariable Define
hi def link rustEscape Special hi def link reasonEscape Special
hi def link rustEscapeUnicode rustEscape hi def link reasonEscapeUnicode reasonEscape
hi def link rustEscapeError Error hi def link reasonEscapeError Error
hi def link rustStringContinuation Special hi def link reasonStringContinuation Special
hi def link rustString String hi def link reasonString String
hi def link rustCharacterInvalid Error hi def link reasonCharacterInvalid Error
hi def link rustCharacterInvalidUnicode rustCharacterInvalid hi def link reasonCharacterInvalidUnicode reasonCharacterInvalid
hi def link rustCharacter Character hi def link reasonCharacter Character
hi def link rustNumber Number hi def link reasonNumber Number
hi def link rustBoolean Boolean hi def link reasonBoolean Boolean
hi def link rustEnum rustType hi def link reasonEnum reasonType
hi def link rustEnumVariant Function hi def link reasonEnumVariant Function
hi def link rustModPath Macro hi def link reasonModPath Macro
hi def link rustConstant Constant hi def link reasonConstant Constant
hi def link rustSelf Constant hi def link reasonSelf Constant
hi def link rustFloat Float hi def link reasonFloat Float
hi def link rustArrowCharacter rustOperator hi def link reasonArrowCharacter reasonOperator
hi def link rustOperator Keyword hi def link reasonOperator Keyword
hi def link rustKeyword Keyword hi def link reasonKeyword Keyword
hi def link rustReservedKeyword Error hi def link reasonReservedKeyword Error
hi def link rustConditional StorageClass hi def link reasonConditional StorageClass
hi def link rustIdentifier Identifier hi def link reasonIdentifier Identifier
hi def link rustCapsIdent rustIdentifier hi def link reasonCapsIdent reasonIdentifier
hi def link rustFunction Function hi def link reasonFunction Function
hi def link rustFuncName Function hi def link reasonFuncName Function
hi def link rustShebang Comment hi def link reasonShebang Comment
hi def link rustCommentLine Comment hi def link reasonCommentLine Comment
hi def link rustCommentLineDoc Comment hi def link reasonCommentLineDoc Comment
hi def link rustCommentBlock rustCommentLine hi def link reasonCommentBlock reasonCommentLine
hi def link rustCommentBlockDoc rustCommentLineDoc hi def link reasonCommentBlockDoc reasonCommentLineDoc
hi def link rustAssert PreCondit hi def link reasonAssert PreCondit
hi def link rustPanic PreCondit hi def link reasonPanic PreCondit
hi def link rustType Type hi def link reasonType Type
hi def link rustTodo Todo hi def link reasonTodo Todo
hi def link rustAttribute PreProc hi def link reasonAttribute PreProc
hi def link rustDerive PreProc hi def link reasonDerive PreProc
hi def link rustStorage Conditional hi def link reasonStorage Conditional
hi def link rustStorageIdent StorageClass hi def link reasonStorageIdent StorageClass
hi def link rustObsoleteStorage Error hi def link reasonObsoleteStorage Error
hi def link rustExternCrate rustKeyword hi def link reasonExternCrate reasonKeyword
hi def link rustObsoleteExternMod Error hi def link reasonObsoleteExternMod Error
hi def link rustBoxPlacementParens Delimiter hi def link reasonBoxPlacementParens Delimiter
" Other Suggestions: " Other Suggestions:
" hi rustAttribute ctermfg=cyan " hi reasonAttribute ctermfg=cyan
" hi rustDerive ctermfg=cyan " hi reasonDerive ctermfg=cyan
" hi rustAssert ctermfg=yellow " hi reasonAssert ctermfg=yellow
" hi rustPanic ctermfg=red " hi reasonPanic ctermfg=red
syn sync minlines=200 syn sync minlines=200
syn sync maxlines=500 syn sync maxlines=500
let b:current_syntax = "rust" let b:current_syntax = "reason"
endif endif

View File

@@ -93,7 +93,7 @@ if exists("ruby_operators") || exists("ruby_pseudo_operators")
syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1<!!\|&&\|||" syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1<!!\|&&\|||"
syn match rubyRangeOperator "\.\.\.\=" syn match rubyRangeOperator "\.\.\.\="
syn match rubyAssignmentOperator "=>\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^=" syn match rubyAssignmentOperator "=>\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^="
syn match rubyAssignmentOperator "=>\@!" containedin=rubyBlockParameterList " TODO: this is inelegant syn match rubyAssignmentOperator "=>\@!" contained containedin=rubyBlockParameterList " TODO: this is inelegant
syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~" syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~"
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop
@@ -194,7 +194,7 @@ SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':
syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@=" syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@="
syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop containedin=rubyBlockParameterList syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop contained containedin=rubyBlockParameterList
syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator
if exists('ruby_global_variable_error') if exists('ruby_global_variable_error')

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,9 @@ syn keyword valaConstant false null true
" Exceptions " Exceptions
syn keyword valaException try catch finally throw syn keyword valaException try catch finally throw
" Unspecified Statements " Unspecified Statements
syn keyword valaUnspecifiedStatement as base construct delete get in is lock new out params ref sizeof set this throws typeof using value var yield syn keyword valaUnspecifiedStatement as base construct delete get in is lock new out params ref sizeof set this throws typeof value var yield
" Includes
syn match valaInclude "^\s*\zs\<using\>\ze\s\w"
" Arrays and Lists " Arrays and Lists
syn match valaArray "\(\w\(\w\)*\(\s\+\)\?<\)\+\(\(\s\+\)\?\w\(\w\)*\(?\|\*\)\?\(\,\)\?\)\+>\+" syn match valaArray "\(\w\(\w\)*\(\s\+\)\?<\)\+\(\(\s\+\)\?\w\(\w\)*\(?\|\*\)\?\(\,\)\?\)\+>\+"
" Methods " Methods
@@ -141,6 +143,10 @@ syn match valaNumber display "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fF
syn match valaNumber display "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" syn match valaNumber display "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
syn match valaNumber display "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" syn match valaNumber display "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
" Lambda definitions (ported from java.vim)
" needs to be defined after the parenthesis error catcher to work
syn match valaLambdaDef "([a-zA-Z0-9_<>\[\], \t]*)\s*=>"
" when wanted, highlight trailing white space " when wanted, highlight trailing white space
if exists("vala_space_errors") if exists("vala_space_errors")
if !exists("vala_no_trail_space_error") if !exists("vala_no_trail_space_error")
@@ -172,10 +178,12 @@ hi def link valaModifier StorageClass
hi def link valaConstant Constant hi def link valaConstant Constant
hi def link valaException Exception hi def link valaException Exception
hi def link valaUnspecifiedStatement Statement hi def link valaUnspecifiedStatement Statement
hi def link valaInclude Include
hi def link valaUnspecifiedKeyword Keyword hi def link valaUnspecifiedKeyword Keyword
hi def link valaContextualStatement Statement hi def link valaContextualStatement Statement
hi def link valaArray StorageClass hi def link valaArray StorageClass
hi def link valaMethod Function hi def link valaMethod Function
hi def link valaLambdaDef Function
hi def link valaOperator Operator hi def link valaOperator Operator
hi def link valaDelimiter Delimiter hi def link valaDelimiter Delimiter
hi def link valaEnumField Constant hi def link valaEnumField Constant

View File

@@ -36,8 +36,8 @@ syn match zigBuiltinFn "\v\@(compileLog|ctz|popCount|divExact|divFloor|divTrunc)
syn match zigBuiltinFn "\v\@(embedFile|export|tagName|TagType|errorName|call)>" syn match zigBuiltinFn "\v\@(embedFile|export|tagName|TagType|errorName|call)>"
syn match zigBuiltinFn "\v\@(errorReturnTrace|fence|fieldParentPtr|field|unionInit)>" syn match zigBuiltinFn "\v\@(errorReturnTrace|fence|fieldParentPtr|field|unionInit)>"
syn match zigBuiltinFn "\v\@(frameAddress|import|newStackCall|asyncCall|intToPtr|IntType)>" syn match zigBuiltinFn "\v\@(frameAddress|import|newStackCall|asyncCall|intToPtr|IntType)>"
syn match zigBuiltinFn "\v\@(maxValue|memberCount|memberName|memberType|as)>" syn match zigBuiltinFn "\v\@(memberCount|memberName|memberType|as)>"
syn match zigBuiltinFn "\v\@(memcpy|memset|minValue|mod|mulWithOverflow|splat)>" syn match zigBuiltinFn "\v\@(memcpy|memset|mod|mulWithOverflow|splat)>"
syn match zigBuiltinFn "\v\@(bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)>" syn match zigBuiltinFn "\v\@(bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)>"
syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold|Type|shuffle)>" syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold|Type|shuffle)>"
syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>" syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>"