diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index e33f89e771..62fd4cc8d4 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -705,12 +705,31 @@ Raising SystemExit exception in python isn't endorsed way to quit vim, use: > You can test what Python version is available with: > if has('python') echo 'there is Python 2.x' - elseif has('python3') + endif + if has('python3') echo 'there is Python 3.x' endif Note however, that if Python 2 and 3 are both available, but not loaded, these has() calls will try to load them. +To avoid loading the dynamic library, only check if Vim was compiled with +python support: > + if has('python_compiled') + echo 'compiled with Python 2.x support' + if has('python_dynamic + echo 'Python 2.x dynamically loaded + endif + endif + if has('python3_compiled') + echo 'compiled with Python 3.x support' + if has('python3_dynamic + echo 'Python 3.x dynamically loaded + endif + endif + +This also tells you whether Python is dynamically loaded, which will fail if +the runtime library cannot be found. + ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index ef4e211d16..06284fb849 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -410,7 +410,7 @@ An example for using CTRL-G U: > inoremap ( ()U This makes it possible to use the cursor keys in Insert mode, without breaking -the undo sequence and therefore using |.| (redo) will work as expected. +the undo sequence and therefore using |.| (redo) will work as expected. Also entering a text like (with the "(" mapping from above): > Lorem ipsum (dolor @@ -1508,15 +1508,15 @@ that begin with the filetype, "php", in this case. For example these syntax groups are included by default with the PHP: phpEnvVar, phpIntVar, phpFunctions. -If you wish non-filetype syntax items to also be included, you can use a -regular expression syntax (added in version 13.0 of autoload\syntaxcomplete.vim) -to add items. Looking at the output from ":syntax list" while editing a PHP file -I can see some of these entries: > +If you wish non-filetype syntax items to also be included, you can use a +regular expression syntax (added in version 13.0 of +autoload\syntaxcomplete.vim) to add items. Looking at the output from +":syntax list" while editing a PHP file I can see some of these entries: > htmlArg,htmlTag,htmlTagName,javaScriptStatement,javaScriptGlobalObjects To pick up any JavaScript and HTML keyword syntax groups while editing a PHP -file, you can use 3 different regexs, one for each language. Or you can -simply restrict the include groups to a particular value, without using +file, you can use 3 different regexs, one for each language. Or you can +simply restrict the include groups to a particular value, without using a regex string: > let g:omni_syntax_group_include_php = 'php\w\+,javaScript\w\+,html\w\+' let g:omni_syntax_group_include_php = 'phpFunctions,phpMethods' @@ -1529,9 +1529,9 @@ highlight. These items will be available within the omni completion list. Some people may find this list unwieldy or are only interested in certain items. There are two ways to prune this list (if necessary). If you find -certain syntax groups you do not wish displayed you can use two different -methods to identify these groups. The first specifically lists the syntax -groups by name. The second uses a regular expression to identify both +certain syntax groups you do not wish displayed you can use two different +methods to identify these groups. The first specifically lists the syntax +groups by name. The second uses a regular expression to identify both syntax groups. Simply add one the following to your vimrc: > let g:omni_syntax_group_exclude_php = 'phpCoreConstant,phpConstant' let g:omni_syntax_group_exclude_php = 'php\w*Constant' @@ -1554,22 +1554,22 @@ vimrc: > For plugin developers, the plugin exposes a public function OmniSyntaxList. This function can be used to request a List of syntax items. When editing a -SQL file (:e syntax.sql) you can use the ":syntax list" command to see the +SQL file (:e syntax.sql) you can use the ":syntax list" command to see the various groups and syntax items. For example: > - syntax list + syntax list -Yields data similar to this: > - sqlOperator xxx some prior all like and any escape exists in is not - or intersect minus between distinct - links to Operator - sqlType xxx varbit varchar nvarchar bigint int uniqueidentifier - date money long tinyint unsigned xml text smalldate - double datetime nchar smallint numeric time bit char - varbinary binary smallmoney - image float integer timestamp real decimal +Yields data similar to this: + sqlOperator xxx some prior all like and any escape exists in is not ~ + or intersect minus between distinct ~ + links to Operator ~ + sqlType xxx varbit varchar nvarchar bigint int uniqueidentifier ~ + date money long tinyint unsigned xml text smalldate ~ + double datetime nchar smallint numeric time bit char ~ + varbinary binary smallmoney ~ + image float integer timestamp real decimal ~ There are two syntax groups listed here: sqlOperator and sqlType. To retrieve -a List of syntax items you can call OmniSyntaxList a number of different +a List of syntax items you can call OmniSyntaxList a number of different ways. To retrieve all syntax items regardless of syntax group: > echo OmniSyntaxList( [] ) @@ -1586,7 +1586,6 @@ From within a plugin, you would typically assign the output to a List: > let myKeywords = [] let myKeywords = OmniSyntaxList( ['sqlKeyword'] ) - SQL *ft-sql-omni* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index c3664ece18..6e768f599f 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4947,6 +4947,11 @@ StatusLine status line of current window StatusLineNC status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + *hl-StatusLineTerm* +StatusLineTerm status line of current window, if it is a |terminal| window. + *hl-StatusLineTermNC* +StatusLineTermNC status lines of not-current windows that is a |terminal| + window. *hl-TabLine* TabLine tab pages line, not active tab page label *hl-TabLineFill* diff --git a/runtime/doc/usr_27.txt b/runtime/doc/usr_27.txt index afea67bd0b..d4d48af47e 100644 --- a/runtime/doc/usr_27.txt +++ b/runtime/doc/usr_27.txt @@ -225,9 +225,9 @@ specify a line offset, this can cause trouble. For example: > /const/-2 This finds the next word "const" and then moves two lines up. If you -use "n" to search again, Vim could start at the current position and find the same -"const" match. Then using the offset again, you would be back where you started. -You would be stuck! +use "n" to search again, Vim could start at the current position and find the +same "const" match. Then using the offset again, you would be back where you +started. You would be stuck! It could be worse: Suppose there is another match with "const" in the next line. Then repeating the forward search would find this match and move two lines up. Thus you would actually move the cursor back! diff --git a/runtime/filetype.vim b/runtime/filetype.vim index bb8d210539..84123aca95 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -235,6 +235,7 @@ endif " C or lpc au BufNewFile,BufRead *.c call dist#ft#FTlpc() +au BufNewFile,BufRead *.lpc,*.ulpc setf lpc " Calendar au BufNewFile,BufRead calendar setf calendar @@ -374,7 +375,7 @@ au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf au BufNewFile,BufRead configure.in,configure.ac setf config " CUDA Cumpute Unified Device Architecture -au BufNewFile,BufRead *.cu setf cuda +au BufNewFile,BufRead *.cu,*.cuh setf cuda " Dockerfile au BufNewFile,BufRead Dockerfile,*.Dockerfile setf dockerfile @@ -1148,8 +1149,9 @@ au BufNewFile,BufRead *.pod6 setf pod6 " Also .ctp for Cake template file au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php -" Pike -au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike +" Pike and Cmod +au BufNewFile,BufRead *.pike,*.pmod setf pike +au BufNewFile,BufRead *.cmod setf cmod " Pinfo config au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo diff --git a/runtime/ftplugin/nsis.vim b/runtime/ftplugin/nsis.vim index 949691bf6e..1a35127c86 100644 --- a/runtime/ftplugin/nsis.vim +++ b/runtime/ftplugin/nsis.vim @@ -1,22 +1,43 @@ " Vim ftplugin file -" Language: NSIS script -" Previous Maintainer: Nikolai Weibull -" Latest Revision: 2008-07-09 - -let s:cpo_save = &cpo -set cpo&vim +" Language: NSIS script +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-nsis +" Previous Maintainer: Nikolai Weibull +" Last Change: 2018-01-26 if exists("b:did_ftplugin") finish endif + +let s:cpo_save = &cpo +set cpo&vim + let b:did_ftplugin = 1 let b:undo_ftplugin = "setl com< cms< fo< def< inc<" + \ " | unlet! b:match_ignorecase b:match_words" setlocal comments=s1:/*,mb:*,ex:*/,b:#,:; commentstring=;\ %s setlocal formatoptions-=t formatoptions+=croql setlocal define=^\\s*!define\\%(\\%(utc\\)\\=date\\|math\\)\\= setlocal include=^\\s*!include\\%(/NONFATAL\\)\\= +if exists("loaded_matchit") + let b:match_ignorecase = 1 + let b:match_words = + \ '\${\%(If\|IfNot\|Unless\)}:\${\%(Else\|ElseIf\|ElseIfNot\|ElseUnless\)}:\${\%(EndIf\|EndUnless\)},' . + \ '\${Select}:\${EndSelect},' . + \ '\${Switch}:\${EndSwitch},' . + \ '\${\%(Do\|DoWhile\|DoUntil\)}:\${\%(Loop\|LoopWhile\|LoopUntil\)},' . + \ '\${\%(For\|ForEach\)}:\${Next},' . + \ '\:\,' . + \ '\:\,' . + \ '\:\,' . + \ '\:\,' . + \ '\${MementoSection}:\${MementoSectionEnd},' . + \ '!if\%(\%(macro\)\?n\?def\)\?\>:!else\>:!endif\>,' . + \ '!macro\>:!macroend\>' +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 54926418de..56f19cb323 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -3,7 +3,7 @@ " Maintainer: Tom Picton " Previous Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Thur, 09 November 2017 +" Last Change: Wed, 20 December 2017 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -20,6 +20,9 @@ setlocal comments=b:#,fb:- setlocal commentstring=#\ %s setlocal omnifunc=pythoncomplete#Complete +if has('python3') + setlocal omnifunc=python3complete#Complete +endif set wildignore+=*.pyc diff --git a/runtime/indent/nsis.vim b/runtime/indent/nsis.vim new file mode 100644 index 0000000000..223f4fa28e --- /dev/null +++ b/runtime/indent/nsis.vim @@ -0,0 +1,91 @@ +" Vim indent file +" Language: NSIS script +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-nsis +" Last Change: 2018-01-21 +" Filenames: *.nsi +" License: VIM License + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal nosmartindent +setlocal noautoindent +setlocal indentexpr=GetNsisIndent(v:lnum) +setlocal indentkeys=!^F,o,O +setlocal indentkeys+==~${Else,=~${EndIf,=~${EndUnless,=~${AndIf,=~${AndUnless,=~${OrIf,=~${OrUnless,=~${Case,=~${Default,=~${EndSelect,=~${EndSwith,=~${Loop,=~${Next,=~${MementoSectionEnd,=~FunctionEnd,=~SectionEnd,=~SectionGroupEnd,=~PageExEnd,0=~!macroend,0=~!if,0=~!else,0=~!endif + +if exists("*GetNsisIndent") + finish +endif + +function! GetNsisIndent(lnum) + " If this line is explicitly joined: If the previous line was also joined, + " line it up with that one, otherwise add two 'shiftwidth' + if getline(a:lnum - 1) =~ '\\$' + if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' + return indent(a:lnum - 1) + endif + return indent(a:lnum - 1) + shiftwidth() * 2 + endif + + " Grab the current line, stripping comments. + let l:thisl = substitute(getline(a:lnum), '[;#].*$', '', '') + " Check if this line is a conditional preprocessor line. + let l:preproc = l:thisl =~? '^\s*!\%(if\|else\|endif\)' + + " Grab the previous line, stripping comments. + " Skip preprocessor lines and continued lines. + let l:prevlnum = a:lnum + while 1 + let l:prevlnum = prevnonblank(l:prevlnum - 1) + if l:prevlnum == 0 + " top of file + return 0 + endif + let l:prevl = substitute(getline(l:prevlnum), '[;#].*$', '', '') + let l:prevpreproc = l:prevl =~? '^\s*!\%(if\|else\|endif\)' + if l:preproc == l:prevpreproc && getline(l:prevlnum - 1) !~? '\\$' + break + endif + endwhile + let l:previ = indent(l:prevlnum) + let l:ind = l:previ + + if l:preproc + " conditional preprocessor + if l:prevl =~? '^\s*!\%(if\%(\%(macro\)\?n\?def\)\?\|else\)\>' + let l:ind += shiftwidth() + endif + if l:thisl =~? '^\s*!\%(else\|endif\)\?\>' + let l:ind -= shiftwidth() + endif + return l:ind + endif + + if l:prevl =~? '^\s*\%(\${\%(If\|IfNot\|Unless\|ElseIf\|ElseIfNot\|ElseUnless\|Else\|AndIf\|AndIfNot\|AndUnless\|OrIf\|OrIfNot\|OrUnless\|Select\|Case\|Case[2-5]\|CaseElse\|Default\|Switch\|Do\|DoWhile\|DoUntil\|For\|ForEach\|MementoSection\)}\|Function\>\|Section\>\|SectionGroup\|PageEx\>\|!macro\>\)' + " previous line opened a block + let l:ind += shiftwidth() + endif + if l:thisl =~? '^\s*\%(\${\%(ElseIf\|ElseIfNot\|ElseUnless\|Else\|EndIf\|EndUnless\|AndIf\|AndIfNot\|AndUnless\|OrIf\|OrIfNot\|OrUnless\|Loop\|LoopWhile\|LoopUntil\|Next\|MementoSectionEnd\)\>}\?\|FunctionEnd\>\|SectionEnd\>\|SectionGroupEnd\|PageExEnd\>\|!macroend\>\)' + " this line closed a block + let l:ind -= shiftwidth() + elseif l:thisl =~? '^\s*\${\%(Case\|Case[2-5]\|CaseElse\|Default\)\>}\?' + if l:prevl !~? '^\s*\${\%(Select\|Switch\)}' + let l:ind -= shiftwidth() + endif + elseif l:thisl =~? '^\s*\${\%(EndSelect\|EndSwitch\)\>}\?' + " this line closed a block + if l:prevl =~? '^\s*\${\%(Select\|Switch\)}' + let l:ind -= shiftwidth() + else + let l:ind -= shiftwidth() * 2 + endif + endif + + return l:ind +endfunction + +" vim: ts=8 sw=2 sts=2 diff --git a/runtime/scripts.vim b/runtime/scripts.vim index 18263e2842..71e3f48bdf 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -100,6 +100,10 @@ if s:line1 =~# "^#!" elseif s:name =~# 'make\>' set ft=make + " Pike + elseif s:name =~# '^pike\%(\>\|[0-9]\)' + set ft=pike + " Lua elseif s:name =~# 'lua' set ft=lua diff --git a/runtime/syntax/autodoc.vim b/runtime/syntax/autodoc.vim new file mode 100644 index 0000000000..67a627e46c --- /dev/null +++ b/runtime/syntax/autodoc.vim @@ -0,0 +1,101 @@ +" Vim syntax file +" Language: Autodoc +" Maintainer: Stephen R. van den Berg +" Last Change: 2018 Jan 23 +" Version: 2.9 +" Remark: Included by pike.vim, cmod.vim and optionally c.vim +" Remark: In order to make c.vim use it, set: c_autodoc + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn case match + +" A bunch of useful autodoc keywords +syn keyword autodocStatement contained appears belongs global +syn keyword autodocStatement contained decl directive inherit +syn keyword autodocStatement contained deprecated obsolete bugs +syn keyword autodocStatement contained copyright example fixme note param returns +syn keyword autodocStatement contained seealso thanks throws constant +syn keyword autodocStatement contained member index elem +syn keyword autodocStatement contained value type item + +syn keyword autodocRegion contained enum mapping code multiset array +syn keyword autodocRegion contained int string section mixed ol ul dl +syn keyword autodocRegion contained class module namespace +syn keyword autodocRegion contained endenum endmapping endcode endmultiset +syn keyword autodocRegion contained endarray endint endstring endsection +syn keyword autodocRegion contained endmixed endol endul enddl +syn keyword autodocRegion contained endclass endmodule endnamespace + +syn keyword autodocIgnore contained ignore endignore + +syn keyword autodocStatAcc contained b i u tt url pre sub sup +syn keyword autodocStatAcc contained ref rfc xml dl expr image + +syn keyword autodocTodo contained TODO FIXME XXX + +syn match autodocLineStart display "\(//\|/\?\*\)\@2<=!" +syn match autodocWords "[^!@{}[\]]\+" display contains=@Spell + +syn match autodocLink "@\[[^[\]]\+]"hs=s+2,he=e-1 display contains=autodocLead +syn match autodocAtStmt "@[a-z]\+\%(\s\|$\)\@="hs=s+1 display contains=autodocStatement,autodocIgnore,autodocLead,autodocRegion + +" Due to limitations of the matching algorithm, we cannot highlight +" nested autodocNStmtAcc structures correctly +syn region autodocNStmtAcc start="@[a-z]\+{" end="@}" contains=autodocStatAcc,autodocLead keepend + +syn match autodocUrl contained display ".\+" +syn region autodocAtUrlAcc start="{"ms=s+1 end="@}"he=e-1,me=e-2 contained display contains=autodocUrl,autodocLead keepend +syn region autodocNUrlAcc start="@url{" end="@}" contains=autodocStatAcc,autodocAtUrlAcc,autodocLead transparent + +syn match autodocSpecial "@@" display +syn match autodocLead "@" display contained + +"when wanted, highlight trailing white space +if exists("c_space_errors") + if !exists("c_no_trail_space_error") + syn match autodocSpaceError display excludenl "\s\+$" + endif + if !exists("c_no_tab_space_error") + syn match autodocSpaceError display " \+\t"me=e-1 + endif +endif + +if exists("c_minlines") + let b:c_minlines = c_minlines +else + if !exists("c_no_if0") + let b:c_minlines = 50 " #if 0 constructs can be long + else + let b:c_minlines = 15 " mostly for () constructs + endif +endif +exec "syn sync ccomment autodocComment minlines=" . b:c_minlines + +" Define the default highlighting. +" Only used when an item doesn't have highlighting yet +hi def link autodocStatement Statement +hi def link autodocStatAcc Statement +hi def link autodocRegion Structure +hi def link autodocAtStmt Error +hi def link autodocNStmtAcc Identifier +hi def link autodocLink Type +hi def link autodocTodo Todo +hi def link autodocSpaceError Error +hi def link autodocLineStart SpecialComment +hi def link autodocSpecial SpecialChar +hi def link autodocUrl Underlined +hi def link autodocLead Statement +hi def link autodocIgnore Delimiter + +let b:current_syntax = "autodoc" + +let &cpo = s:cpo_save +unlet s:cpo_save +" vim: ts=8 diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index f659a87b71..1143ca7dd7 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -13,6 +13,14 @@ set cpo&vim let s:ft = matchstr(&ft, '^\([^.]\)\+') +" Optional embedded Autodoc parsing +" To enable it add: let g:c_autodoc = 1 +" to your .vimrc +if exists("c_autodoc") + syn include @cAutodoc :p:h/autodoc.vim + unlet b:current_syntax +endif + " A bunch of useful C keywords syn keyword cStatement goto break return continue asm syn keyword cLabel case default @@ -377,6 +385,13 @@ syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInP syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell +" Optional embedded Autodoc parsing +if exists("c_autodoc") + syn match cAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@cAutodoc containedin=cComment,cCommentL + syn cluster cCommentGroup add=cAutodocReal + syn cluster cPreProcGroup add=cAutodocReal +endif + " Highlight User Labels syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString if s:ft ==# 'c' || exists("cpp_no_cpp11") diff --git a/runtime/syntax/cmod.vim b/runtime/syntax/cmod.vim new file mode 100644 index 0000000000..ea37682ff6 --- /dev/null +++ b/runtime/syntax/cmod.vim @@ -0,0 +1,144 @@ +" Vim syntax file +" Language: Cmod +" Current Maintainer: Stephen R. van den Berg +" Last Change: 2018 Jan 23 +" Version: 2.9 +" Remark: Is used to edit Cmod files for Pike development. +" Remark: Includes a highlighter for any embedded Autodoc format. + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Read the C syntax to start with +runtime! syntax/c.vim +unlet b:current_syntax + +if !exists("c_autodoc") + " For embedded Autodoc documentation + syn include @cmodAutodoc :p:h/autodoc.vim + unlet b:current_syntax +endif + +" Supports rotating amongst several same-level preprocessor conditionals +packadd! matchit +let b:match_words = "({:}\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>" + +" Cmod extensions +syn keyword cmodStatement __INIT INIT EXIT GC_RECURSE GC_CHECK +syn keyword cmodStatement EXTRA OPTIMIZE RETURN +syn keyword cmodStatement ADD_EFUN ADD_EFUN2 ADD_FUNCTION +syn keyword cmodStatement MK_STRING MK_STRING_SVALUE CONSTANT_STRLEN + +syn keyword cmodStatement SET_SVAL pop_n_elems pop_stack +syn keyword cmodStatement SIMPLE_ARG_TYPE_ERROR Pike_sp Pike_fp MKPCHARP +syn keyword cmodStatement SET_SVAL_TYPE REF_MAKE_CONST_STRING INC_PCHARP +syn keyword cmodStatement PTR_FROM_INT INHERIT_FROM_PTR +syn keyword cmodStatement DECLARE_CYCLIC BEGIN_CYCLIC END_CYCLIC +syn keyword cmodStatement UPDATE_LOCATION UNSAFE_IS_ZERO SAFE_IS_ZERO +syn keyword cmodStatement MKPCHARP_STR APPLY_MASTER current_storage +syn keyword cmodStatement PIKE_MAP_VARIABLE size_shift +syn keyword cmodStatement THREADS_ALLOW THREADS_DISALLOW + +syn keyword cmodStatement add_integer_constant ref_push_object +syn keyword cmodStatement push_string apply_svalue free_svalue +syn keyword cmodStatement get_inherit_storage get_storage +syn keyword cmodStatement make_shared_binary_string push_int64 +syn keyword cmodStatement begin_shared_string end_shared_string +syn keyword cmodStatement add_ref fast_clone_object clone_object +syn keyword cmodStatement push_undefined push_int ref_push_string +syn keyword cmodStatement free_string push_ulongest free_object +syn keyword cmodStatement convert_stack_top_to_bignum push_array +syn keyword cmodStatement push_object reduce_stack_top_bignum +syn keyword cmodStatement push_static_text apply_current +syn keyword cmodStatement assign_svalue free_program destruct_object +syn keyword cmodStatement start_new_program low_inherit stack_swap +syn keyword cmodStatement generic_error_program end_program +syn keyword cmodStatement free_array apply_external copy_mapping +syn keyword cmodStatement push_constant_text ref_push_mapping +syn keyword cmodStatement mapping_insert mapping_string_insert_string +syn keyword cmodStatement f_aggregate_mapping f_aggregate apply +syn keyword cmodStatement push_mapping push_svalue low_mapping_lookup +syn keyword cmodStatement assign_svalues_no_free f_add +syn keyword cmodStatement push_empty_string stack_dup assign_lvalue +syn keyword cmodStatement low_mapping_string_lookup allocate_mapping +syn keyword cmodStatement copy_shared_string make_shared_binary_string0 +syn keyword cmodStatement f_call_function f_index f_utf8_to_string +syn keyword cmodStatement finish_string_builder init_string_builder +syn keyword cmodStatement reset_string_builder free_string_builder +syn keyword cmodStatement string_builder_putchar get_all_args +syn keyword cmodStatement add_shared_strings check_all_args +syn keyword cmodStatement do_inherit add_string_constant +syn keyword cmodStatement add_program_constant set_init_callback +syn keyword cmodStatement simple_mapping_string_lookup +syn keyword cmodStatement f_sprintf push_text string_has_null +syn keyword cmodStatement end_and_resize_shared_string + +syn keyword cmodStatement args sp + +syn keyword cmodStatement free + +syn keyword cmodConstant ID_PROTECTED ID_FINAL PIKE_DEBUG +syn keyword cmodConstant NUMBER_NUMBER +syn keyword cmodConstant PIKE_T_INT PIKE_T_STRING PIKE_T_ARRAY +syn keyword cmodConstant PIKE_T_MULTISET PIKE_T_OBJECT PIKE_T_MAPPING +syn keyword cmodConstant NUMBER_UNDEFINED PIKE_T_PROGRAM PIKE_T_FUNCTION +syn keyword cmodConstant T_OBJECT T_STRING T_ARRAY T_MAPPING + +syn keyword cmodException SET_ONERROR UNSET_ONERROR ONERROR +syn keyword cmodException CALL_AND_UNSET_ONERROR + +syn keyword cmodDebug Pike_fatal Pike_error check_stack + +syn keyword cmodAccess public protected private INHERIT +syn keyword cmodAccess CTYPE CVAR PIKEVAR PIKEFUN + +syn keyword cmodModifier efun export flags optflags optfunc +syn keyword cmodModifier type rawtype errname name c_name prototype +syn keyword cmodModifier program_flags gc_trivial PMOD_EXPORT +syn keyword cmodModifier ATTRIBUTE noclone noinline +syn keyword cmodModifier tOr tFuncV tInt tMix tVoid tStr tMap tPrg +syn keyword cmodModifier tSetvar tArr tMult tMultiset +syn keyword cmodModifier tArray tMapping tString tSetvar tVar + +syn keyword cmodType bool mapping string multiset array mixed +syn keyword cmodType object function program auto svalue +syn keyword cmodType bignum longest zero pike_string +syn keyword cmodType this this_program THIS INT_TYPE INT64 INT32 +syn keyword cmodType p_wchar2 PCHARP p_wchar1 p_wchar0 MP_INT + +syn keyword cmodOperator _destruct create __hash _sizeof _indices _values +syn keyword cmodOperator _is_type _sprintf _equal _m_delete _get_iterator +syn keyword cmodOperator _search _types _serialize _deserialize +syn keyword cmodOperator _size_object _random _sqrt TYPEOF SUBTYPEOF +syn keyword cmodOperator LIKELY UNLIKELY + +syn keyword cmodStructure DECLARATIONS PIKECLASS DECLARE_STORAGE + +if !exists("c_autodoc") + syn match cmodAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@cmodAutodoc containedin=cComment,cCommentL + syn cluster cCommentGroup add=cmodAutodocReal + syn cluster cPreProcGroup add=cmodAutodocReal +endif + +" Default highlighting +hi def link cmodAccess Statement +hi def link cmodOperator Operator +hi def link cmodStatement Statement +hi def link cmodConstant Constant +hi def link cmodModifier Type +hi def link cmodType Type +hi def link cmodStorageClass StorageClass +hi def link cmodStructure Structure +hi def link cmodException Exception +hi def link cmodDebug Debug + +let b:current_syntax = "cmod" + +let &cpo = s:cpo_save +unlet s:cpo_save +" vim: ts=8 diff --git a/runtime/syntax/nsis.vim b/runtime/syntax/nsis.vim index 3a343dd430..461ffb41fd 100644 --- a/runtime/syntax/nsis.vim +++ b/runtime/syntax/nsis.vim @@ -1,52 +1,72 @@ " Vim syntax file -" Language: NSIS script, for version of NSIS 1.91 and later -" Maintainer: Alex Jakushev -" Last Change: 2004 May 12 +" Language: NSIS script, for version of NSIS 3.02 and later +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-nsis +" Previous Maintainer: Alex Jakushev +" Last Change: 2018-01-26 " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif +let s:cpo_save = &cpo +set cpo&vim + syn case ignore -"COMMENTS +"Pseudo definitions +syn match nsisLine nextgroup=@nsisPseudoStatement skipwhite "^" +syn cluster nsisPseudoStatement contains=nsisFirstComment,nsisLocalLabel,nsisGlobalLabel +syn cluster nsisPseudoStatement add=nsisDefine,nsisPreCondit,nsisMacro,nsisInclude,nsisSystem +syn cluster nsisPseudoStatement add=nsisAttribute,nsisCompiler,nsisVersionInfo,nsisInstruction,nsisStatement + +"COMMENTS (4.1) syn keyword nsisTodo todo attention note fixme readme -syn region nsisComment start=";" end="$" contains=nsisTodo -syn region nsisComment start="#" end="$" contains=nsisTodo +syn region nsisComment start="[;#]" end="$" contains=nsisTodo,nsisLineContinuation,@Spell oneline +syn region nsisComment start=".\@1<=/\*" end="\*/" contains=nsisTodo,@Spell +syn region nsisFirstComment start="/\*" end="\*/" contained contains=nsisTodo,@Spell skipwhite + \ nextgroup=@nsisPseudoStatement -"LABELS -syn match nsisLocalLabel "\a\S\{-}:" -syn match nsisGlobalLabel "\.\S\{-1,}:" +syn match nsisLineContinuation "\\$" -"PREPROCESSOR -syn match nsisPreprocSubst "${.\{-}}" -syn match nsisDefine "!define\>" -syn match nsisDefine "!undef\>" -syn match nsisPreCondit "!ifdef\>" -syn match nsisPreCondit "!ifndef\>" -syn match nsisPreCondit "!endif\>" -syn match nsisPreCondit "!else\>" -syn match nsisMacro "!macro\>" -syn match nsisMacro "!macroend\>" -syn match nsisMacro "!insertmacro\>" +"STRINGS (4.1) +syn region nsisString start=/"/ end=/"/ contains=@nsisStringItems,@Spell +syn region nsisString start=/'/ end=/'/ contains=@nsisStringItems,@Spell +syn region nsisString start=/`/ end=/`/ contains=@nsisStringItems,@Spell -"COMPILER UTILITY -syn match nsisInclude "!include\>" -syn match nsisSystem "!cd\>" -syn match nsisSystem "!system\>" -syn match nsisSystem "!packhdr\>" +syn cluster nsisStringItems contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar,nsisUserVar,nsisSysVar,nsisRegistry,nsisLineContinuation -"VARIABLES +"NUMBERS (4.1) +syn match nsisNumber "\<[1-9]\d*\>" +syn match nsisNumber "\<0x\x\+\>" +syn match nsisNumber "\<0\o*\>" + +"STRING REPLACEMENT (5.4, 4.9.15.2, 5.3.1) +syn region nsisPreprocSubst start="\${" end="}" contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar +syn region nsisPreprocLangStr start="\$(" end=")" contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar +syn region nsisPreprocEnvVar start="\$%" end="%" contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar + +"VARIABLES (4.2.2) syn match nsisUserVar "$\d" syn match nsisUserVar "$R\d" syn match nsisSysVar "$INSTDIR" syn match nsisSysVar "$OUTDIR" syn match nsisSysVar "$CMDLINE" +syn match nsisSysVar "$LANGUAGE" +"CONSTANTS (4.2.3) syn match nsisSysVar "$PROGRAMFILES" +syn match nsisSysVar "$PROGRAMFILES32" +syn match nsisSysVar "$PROGRAMFILES64" +syn match nsisSysVar "$COMMONFILES" +syn match nsisSysVar "$COMMONFILES32" +syn match nsisSysVar "$COMMONFILES64" syn match nsisSysVar "$DESKTOP" syn match nsisSysVar "$EXEDIR" +syn match nsisSysVar "$EXEFILE" +syn match nsisSysVar "$EXEPATH" +syn match nsisSysVar "${NSISDIR}" syn match nsisSysVar "$WINDIR" syn match nsisSysVar "$SYSDIR" syn match nsisSysVar "$TEMP" @@ -54,170 +74,513 @@ syn match nsisSysVar "$STARTMENU" syn match nsisSysVar "$SMPROGRAMS" syn match nsisSysVar "$SMSTARTUP" syn match nsisSysVar "$QUICKLAUNCH" +syn match nsisSysVar "$DOCUMENTS" +syn match nsisSysVar "$SENDTO" +syn match nsisSysVar "$RECENT" +syn match nsisSysVar "$FAVORITES" +syn match nsisSysVar "$MUSIC" +syn match nsisSysVar "$PICTURES" +syn match nsisSysVar "$VIDEOS" +syn match nsisSysVar "$NETHOOD" +syn match nsisSysVar "$FONTS" +syn match nsisSysVar "$TEMPLATES" +syn match nsisSysVar "$APPDATA" +syn match nsisSysVar "$LOCALAPPDATA" +syn match nsisSysVar "$PRINTHOOD" +syn match nsisSysVar "$INTERNET_CACHE" +syn match nsisSysVar "$COOKIES" +syn match nsisSysVar "$HISTORY" +syn match nsisSysVar "$PROFILE" +syn match nsisSysVar "$ADMINTOOLS" +syn match nsisSysVar "$RESOURCES" +syn match nsisSysVar "$RESOURCES_LOCALIZED" +syn match nsisSysVar "$CDBURN_AREA" syn match nsisSysVar "$HWNDPARENT" +syn match nsisSysVar "$PLUGINSDIR" syn match nsisSysVar "$\\r" syn match nsisSysVar "$\\n" +syn match nsisSysVar "$\\t" syn match nsisSysVar "$\$" +syn match nsisSysVar "$\\["'`]" -"STRINGS -syn region nsisString start=/"/ skip=/'\|`/ end=/"/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry -syn region nsisString start=/'/ skip=/"\|`/ end=/'/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry -syn region nsisString start=/`/ skip=/"\|'/ end=/`/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry +"LABELS (4.3) +syn match nsisLocalLabel contained "[^-+!$0-9;#. \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)" +syn match nsisGlobalLabel contained "\.[^-+!$0-9;# \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)" "CONSTANTS -syn keyword nsisBoolean true false on off +syn keyword nsisBoolean contained true false +syn keyword nsisOnOff contained on off -syn keyword nsisAttribOptions hide show nevershow auto force try ifnewer normal silent silentlog -syn keyword nsisAttribOptions smooth colored SET CUR END RO none listonly textonly both current all -syn keyword nsisAttribOptions zlib bzip2 lzma - -syn match nsisAttribOptions '\/NOCUSTOM' -syn match nsisAttribOptions '\/CUSTOMSTRING' -syn match nsisAttribOptions '\/COMPONENTSONLYONCUSTOM' -syn match nsisAttribOptions '\/windows' -syn match nsisAttribOptions '\/r' -syn match nsisAttribOptions '\/oname' -syn match nsisAttribOptions '\/REBOOTOK' -syn match nsisAttribOptions '\/SILENT' -syn match nsisAttribOptions '\/FILESONLY' -syn match nsisAttribOptions '\/SHORT' - -syn keyword nsisExecShell SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED - -syn keyword nsisRegistry HKCR HKLM HKCU HKU HKCC HKDD HKPD -syn keyword nsisRegistry HKEY_CLASSES_ROOT HKEY_LOCAL_MACHINE HKEY_CURRENT_USER HKEY_USERS -syn keyword nsisRegistry HKEY_CURRENT_CONFIG HKEY_DYN_DATA HKEY_PERFORMANCE_DATA - -syn keyword nsisFileAttrib NORMAL ARCHIVE HIDDEN OFFLINE READONLY SYSTEM TEMPORARY -syn keyword nsisFileAttrib FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN -syn keyword nsisFileAttrib FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM -syn keyword nsisFileAttrib FILE_ATTRIBUTE_TEMPORARY - -syn keyword nsisMessageBox MB_OK MB_OKCANCEL MB_ABORTRETRYIGNORE MB_RETRYCANCEL MB_YESNO MB_YESNOCANCEL -syn keyword nsisMessageBox MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP -syn keyword nsisMessageBox MB_TOPMOST MB_SETFOREGROUND MB_RIGHT -syn keyword nsisMessageBox MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4 -syn keyword nsisMessageBox IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES - -syn match nsisNumber "\<[^0]\d*\>" -syn match nsisNumber "\<0x\x\+\>" -syn match nsisNumber "\<0\o*\>" +syn keyword nsisRegistry contained HKCR HKLM HKCU HKU HKCC HKDD HKPD SHCTX +syn keyword nsisRegistry contained HKCR32 HKCR64 HKCU32 HKCU64 HKLM32 HKLM64 +syn keyword nsisRegistry contained HKEY_CLASSES_ROOT HKEY_LOCAL_MACHINE HKEY_CURRENT_USER HKEY_USERS +syn keyword nsisRegistry contained HKEY_CLASSES_ROOT32 HKEY_CLASSES_ROOT64 +syn keyword nsisRegistry contained HKEY_CURRENT_USER32 HKEY_CURRENT_USER64 +syn keyword nsisRegistry contained HKEY_LOCAL_MACHINE32 HKEY_LOCAL_MACHINE64 +syn keyword nsisRegistry contained HKEY_CURRENT_CONFIG HKEY_DYN_DATA HKEY_PERFORMANCE_DATA +syn keyword nsisRegistry contained SHELL_CONTEXT -"INSTALLER ATTRIBUTES - General installer configuration -syn keyword nsisAttribute OutFile Name Caption SubCaption BrandingText Icon -syn keyword nsisAttribute WindowIcon BGGradient SilentInstall SilentUnInstall -syn keyword nsisAttribute CRCCheck MiscButtonText InstallButtonText FileErrorText +" common options +syn cluster nsisAnyOpt contains=nsisComment,nsisLineContinuation,nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar,nsisUserVar,nsisSysVar,nsisString,nsisNumber +syn region nsisBooleanOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisBoolean +syn region nsisOnOffOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisOnOff +syn region nsisLangOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLangKwd +syn match nsisLangKwd contained "/LANG\>" +syn region nsisFontOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFontKwd +syn match nsisFontKwd contained "/\%(ITALIC\|UNDERLINE\|STRIKE\)\>" -"INSTALLER ATTRIBUTES - Install directory configuration -syn keyword nsisAttribute InstallDir InstallDirRegKey +"STATEMENTS - pages (4.5) +syn keyword nsisStatement contained Page UninstPage nextgroup=nsisPageOpt skipwhite +syn region nsisPageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPageKwd +syn keyword nsisPageKwd contained custom license components directory instfiles uninstConfirm +syn match nsisPageKwd contained "/ENABLECANCEL\>" -"INSTALLER ATTRIBUTES - License page configuration -syn keyword nsisAttribute LicenseText LicenseData +syn keyword nsisStatement contained PageEx nextgroup=nsisPageExOpt skipwhite +syn region nsisPageExOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPageExKwd +syn match nsisPageExKwd contained "\<\%(un\.\)\?\%(custom\|license\|components\|directory\|instfiles\|uninstConfirm\)\>" -"INSTALLER ATTRIBUTES - Component page configuration -syn keyword nsisAttribute ComponentText InstType EnabledBitmap DisabledBitmap SpaceTexts +syn keyword nsisStatement contained PageExEnd PageCallbacks -"INSTALLER ATTRIBUTES - Directory page configuration -syn keyword nsisAttribute DirShow DirText AllowRootDirInstall +"STATEMENTS - sections (4.6.1) +syn keyword nsisStatement contained AddSize SectionEnd SectionGroupEnd -"INSTALLER ATTRIBUTES - Install page configuration -syn keyword nsisAttribute InstallColors InstProgressFlags AutoCloseWindow -syn keyword nsisAttribute ShowInstDetails DetailsButtonText CompletedText +syn keyword nsisStatement contained Section nextgroup=nsisSectionOpt skipwhite +syn region nsisSectionOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionKwd +syn match nsisSectionKwd contained "/o\>" -"INSTALLER ATTRIBUTES - Uninstall configuration -syn keyword nsisAttribute UninstallText UninstallIcon UninstallCaption -syn keyword nsisAttribute UninstallSubCaption ShowUninstDetails UninstallButtonText +syn keyword nsisStatement contained SectionIn nextgroup=nsisSectionInOpt skipwhite +syn region nsisSectionInOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionInKwd +syn keyword nsisSectionInKwd contained RO -"COMPILER ATTRIBUTES -syn keyword nsisCompiler SetOverwrite SetCompress SetCompressor SetDatablockOptimize SetDateSave +syn keyword nsisStatement contained SectionGroup nextgroup=nsisSectionGroupOpt skipwhite +syn region nsisSectionGroupOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionGroupKwd +syn match nsisSectionGroupKwd contained "/e\>" + +"STATEMENTS - functions (4.7.1) +syn keyword nsisStatement contained Function FunctionEnd -"FUNCTIONS - general purpose -syn keyword nsisInstruction SetOutPath File Exec ExecWait ExecShell -syn keyword nsisInstruction Rename Delete RMDir - -"FUNCTIONS - registry & ini -syn keyword nsisInstruction WriteRegStr WriteRegExpandStr WriteRegDWORD WriteRegBin -syn keyword nsisInstruction WriteINIStr ReadRegStr ReadRegDWORD ReadINIStr ReadEnvStr -syn keyword nsisInstruction ExpandEnvStrings DeleteRegValue DeleteRegKey EnumRegKey -syn keyword nsisInstruction EnumRegValue DeleteINISec DeleteINIStr - -"FUNCTIONS - general purpose, advanced -syn keyword nsisInstruction CreateDirectory CopyFiles SetFileAttributes CreateShortCut -syn keyword nsisInstruction GetFullPathName SearchPath GetTempFileName CallInstDLL -syn keyword nsisInstruction RegDLL UnRegDLL GetDLLVersion GetDLLVersionLocal -syn keyword nsisInstruction GetFileTime GetFileTimeLocal - -"FUNCTIONS - Branching, flow control, error checking, user interaction, etc instructions -syn keyword nsisInstruction Goto Call Return IfErrors ClearErrors SetErrors FindWindow -syn keyword nsisInstruction SendMessage IsWindow IfFileExists MessageBox StrCmp -syn keyword nsisInstruction IntCmp IntCmpU Abort Quit GetFunctionAddress GetLabelAddress -syn keyword nsisInstruction GetCurrentAddress - -"FUNCTIONS - File and directory i/o instructions -syn keyword nsisInstruction FindFirst FindNext FindClose FileOpen FileClose FileRead -syn keyword nsisInstruction FileWrite FileReadByte FileWriteByte FileSeek - -"FUNCTIONS - Misc instructions -syn keyword nsisInstruction SetDetailsView SetDetailsPrint SetAutoClose DetailPrint -syn keyword nsisInstruction Sleep BringToFront HideWindow SetShellVarContext - -"FUNCTIONS - String manipulation support -syn keyword nsisInstruction StrCpy StrLen - -"FUNCTIONS - Stack support -syn keyword nsisInstruction Push Pop Exch - -"FUNCTIONS - Integer manipulation support -syn keyword nsisInstruction IntOp IntFmt - -"FUNCTIONS - Rebooting support -syn keyword nsisInstruction Reboot IfRebootFlag SetRebootFlag - -"FUNCTIONS - Uninstaller instructions -syn keyword nsisInstruction WriteUninstaller - -"FUNCTIONS - Install logging instructions -syn keyword nsisInstruction LogSet LogText - -"FUNCTIONS - Section management instructions -syn keyword nsisInstruction SectionSetFlags SectionGetFlags SectionSetText -syn keyword nsisInstruction SectionGetText +"STATEMENTS - LogicLib.nsh +syn match nsisStatement "${If}" +syn match nsisStatement "${IfNot}" +syn match nsisStatement "${Unless}" +syn match nsisStatement "${ElseIf}" +syn match nsisStatement "${ElseIfNot}" +syn match nsisStatement "${ElseUnless}" +syn match nsisStatement "${Else}" +syn match nsisStatement "${EndIf}" +syn match nsisStatement "${EndUnless}" +syn match nsisStatement "${AndIf}" +syn match nsisStatement "${AndIfNot}" +syn match nsisStatement "${AndUnless}" +syn match nsisStatement "${OrIf}" +syn match nsisStatement "${OrIfNot}" +syn match nsisStatement "${OrUnless}" +syn match nsisStatement "${IfThen}" +syn match nsisStatement "${IfNotThen}" +syn match nsisStatement "${||\?}" nextgroup=@nsisPseudoStatement skipwhite +syn match nsisStatement "${IfCmd}" nextgroup=@nsisPseudoStatement skipwhite +syn match nsisStatement "${Select}" +syn match nsisStatement "${Case}" +syn match nsisStatement "${Case[2-5]}" +syn match nsisStatement "${CaseElse}" +syn match nsisStatement "${Default}" +syn match nsisStatement "${EndSelect}" +syn match nsisStatement "${Switch}" +syn match nsisStatement "${EndSwitch}" +syn match nsisStatement "${Break}" +syn match nsisStatement "${Do}" +syn match nsisStatement "${DoWhile}" +syn match nsisStatement "${DoUntil}" +syn match nsisStatement "${ExitDo}" +syn match nsisStatement "${Continue}" +syn match nsisStatement "${Loop}" +syn match nsisStatement "${LoopWhile}" +syn match nsisStatement "${LoopUntil}" +syn match nsisStatement "${For}" +syn match nsisStatement "${ForEach}" +syn match nsisStatement "${ExitFor}" +syn match nsisStatement "${Next}" +"STATEMENTS - Memento.nsh +syn match nsisStatement "${MementoSection}" +syn match nsisStatement "${MementoSectionEnd}" -"SPECIAL FUNCTIONS - install +"USER VARIABLES (4.2.1) +syn keyword nsisInstruction contained Var nextgroup=nsisVarOpt skipwhite +syn region nsisVarOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisVarKwd +syn match nsisVarKwd contained "/GLOBAL\>" + +"INSTALLER ATTRIBUTES (4.8.1) +syn keyword nsisAttribute contained Caption ChangeUI CheckBitmap CompletedText ComponentText +syn keyword nsisAttribute contained DetailsButtonText DirText DirVar +syn keyword nsisAttribute contained FileErrorText Icon InstallButtonText +syn keyword nsisAttribute contained InstallDir InstProgressFlags +syn keyword nsisAttribute contained LicenseData LicenseText +syn keyword nsisAttribute contained MiscButtonText Name OutFile +syn keyword nsisAttribute contained SpaceTexts SubCaption UninstallButtonText UninstallCaption +syn keyword nsisAttribute contained UninstallIcon UninstallSubCaption UninstallText + +syn keyword nsisAttribute contained AddBrandingImage nextgroup=nsisAddBrandingImageOpt skipwhite +syn region nsisAddBrandingImageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisAddBrandingImageKwd +syn keyword nsisAddBrandingImageKwd contained left right top bottom width height + +syn keyword nsisAttribute contained nextgroup=nsisBooleanOpt skipwhite + \ AllowRootDirInstall AutoCloseWindow + +syn keyword nsisAttribute contained BGFont nextgroup=nsisFontOpt skipwhite + +syn keyword nsisAttribute contained BGGradient nextgroup=nsisBGGradientOpt skipwhite +syn region nsisBGGradientOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisBGGradientKwd +syn keyword nsisBGGradientKwd contained off + +syn keyword nsisAttribute contained BrandingText nextgroup=nsisBrandingTextOpt skipwhite +syn region nsisBrandingTextOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisBrandingTextKwd +syn match nsisBrandingTextKwd contained "/TRIM\%(LEFT\|RIGHT\|CENTER\)\>" + +syn keyword nsisAttribute contained CRCCheck nextgroup=nsisCRCCheckOpt skipwhite +syn region nsisCRCCheckOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCRCCheckKwd +syn keyword nsisCRCCheckKwd contained on off force + +syn keyword nsisAttribute contained DirVerify nextgroup=nsisDirVerifyOpt skipwhite +syn region nsisDirVerifyOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDirVerifyKwd +syn keyword nsisDirVerifyKwd contained auto leave + +syn keyword nsisAttribute contained InstallColors nextgroup=nsisInstallColorsOpt skipwhite +syn region nsisInstallColorsOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisInstallColorsKwd +syn match nsisInstallColorsKwd contained "/windows\>" + +syn keyword nsisAttribute contained InstallDirRegKey nextgroup=nsisRegistryOpt skipwhite + +syn keyword nsisAttribute contained InstType nextgroup=nsisInstTypeOpt skipwhite +syn region nsisInstTypeOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisInstTypeKwd +syn match nsisInstTypeKwd contained "/\%(NOCUSTOM\|CUSTOMSTRING\|COMPONENTSONLYONCUSTOM\)\>" + +syn keyword nsisAttribute contained LicenseBkColor nextgroup=nsisLicenseBkColorOpt skipwhite +syn region nsisLicenseBkColorOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLicenseBkColorKwd +syn match nsisLicenseBkColorKwd contained "/\%(gray\|windows\)\>" + +syn keyword nsisAttribute contained LicenseForceSelection nextgroup=nsisLicenseForceSelectionOpt skipwhite +syn region nsisLicenseForceSelectionOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLicenseForceSelectionKwd +syn keyword nsisLicenseForceSelectionKwd contained checkbox radiobuttons off + +syn keyword nsisAttribute contained ManifestDPIAware nextgroup=nsisManifestDPIAwareOpt skipwhite +syn region nsisManifestDPIAwareOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestDPIAwareKwd +syn keyword nsisManifestDPIAwareKwd contained notset true false + +syn keyword nsisAttribute contained ManifestSupportedOS nextgroup=nsisManifestSupportedOSOpt skipwhite +syn region nsisManifestSupportedOSOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestSupportedOSKwd +syn match nsisManifestSupportedOSKwd contained "\<\%(none\|all\|WinVista\|Win7\|Win8\|Win8\.1\|Win10\)\>" + +syn keyword nsisAttribute contained RequestExecutionLevel nextgroup=nsisRequestExecutionLevelOpt skipwhite +syn region nsisRequestExecutionLevelOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRequestExecutionLevelKwd +syn keyword nsisRequestExecutionLevelKwd contained none user highest admin + +syn keyword nsisAttribute contained SetFont nextgroup=nsisLangOpt skipwhite + +syn keyword nsisAttribute contained nextgroup=nsisShowInstDetailsOpt skipwhite + \ ShowInstDetails ShowUninstDetails +syn region nsisShowInstDetailsOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisShowInstDetailsKwd +syn keyword nsisShowInstDetailsKwd contained hide show nevershow + +syn keyword nsisAttribute contained SilentInstall nextgroup=nsisSilentInstallOpt skipwhite +syn region nsisSilentInstallOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSilentInstallKwd +syn keyword nsisSilentInstallKwd contained normal silent silentlog + +syn keyword nsisAttribute contained SilentUnInstall nextgroup=nsisSilentUnInstallOpt skipwhite +syn region nsisSilentUnInstallOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSilentUnInstallKwd +syn keyword nsisSilentUnInstallKwd contained normal silent + +syn keyword nsisAttribute contained nextgroup=nsisOnOffOpt skipwhite + \ WindowIcon XPStyle + +"COMPILER FLAGS (4.8.2) +syn keyword nsisCompiler contained nextgroup=nsisOnOffOpt skipwhite + \ AllowSkipFiles SetDatablockOptimize SetDateSave + +syn keyword nsisCompiler contained FileBufSize SetCompressorDictSize + +syn keyword nsisCompiler contained SetCompress nextgroup=nsisSetCompressOpt skipwhite +syn region nsisSetCompressOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetCompressKwd +syn keyword nsisSetCompressKwd contained auto force off + +syn keyword nsisCompiler contained SetCompressor nextgroup=nsisSetCompressorOpt skipwhite +syn region nsisSetCompressorOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetCompressorKwd +syn keyword nsisSetCompressorKwd contained zlib bzip2 lzma +syn match nsisSetCompressorKwd contained "/\%(SOLID\|FINAL\)" + +syn keyword nsisCompiler contained SetOverwrite nextgroup=nsisSetOverwriteOpt skipwhite +syn region nsisSetOverwriteOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetOverwriteKwd +syn keyword nsisSetOverwriteKwd contained on off try ifnewer ifdiff lastused + +syn keyword nsisCompiler contained Unicode nextgroup=nsisBooleanOpt skipwhite + +"VERSION INFORMATION (4.8.3) +syn keyword nsisVersionInfo contained VIAddVersionKey nextgroup=nsisLangOpt skipwhite + +syn keyword nsisVersionInfo contained VIProductVersion VIFileVersion + + +"FUNCTIONS - basic (4.9.1) +syn keyword nsisInstruction contained Delete Rename nextgroup=nsisDeleteOpt skipwhite +syn region nsisDeleteOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDeleteKwd +syn match nsisDeleteKwd contained "/REBOOTOK\>" + +syn keyword nsisInstruction contained Exec ExecWait SetOutPath + +syn keyword nsisInstruction contained ExecShell ExecShellWait nextgroup=nsisExecShellOpt skipwhite +syn region nsisExecShellOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisExecShellKwd +syn keyword nsisExecShellKwd contained SW_SHOWDEFAULT SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_HIDE +syn match nsisExecShellKwd contained "/INVOKEIDLIST\>" + +syn keyword nsisInstruction contained File nextgroup=nsisFileOpt skipwhite +syn region nsisFileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFileKwd +syn match nsisFileKwd contained "/\%(nonfatal\|[arx]\|oname\)\>" + +syn keyword nsisInstruction contained ReserveFile nextgroup=nsisReserveFileOpt skipwhite +syn region nsisReserveFileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisReserveFileKwd +syn match nsisReserveFileKwd contained "/\%(nonfatal\|[rx]\|plugin\)\>" + +syn keyword nsisInstruction contained RMDir nextgroup=nsisRMDirOpt skipwhite +syn region nsisRMDirOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRMDirKwd +syn match nsisRMDirKwd contained "/\%(REBOOTOK\|r\)\>" + + +"FUNCTIONS - registry & ini (4.9.2) +syn keyword nsisInstruction contained DeleteINISec DeleteINIStr FlushINI ReadINIStr WriteINIStr +syn keyword nsisInstruction contained ExpandEnvStrings ReadEnvStr + +syn keyword nsisInstruction contained DeleteRegKey nextgroup=nsisDeleteRegKeyOpt skipwhite +syn region nsisDeleteRegKeyOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDeleteRegKeyKwd,nsisRegistry +syn match nsisDeleteRegKeyKwd contained "/ifempty\>" + +syn keyword nsisInstruction contained nextgroup=nsisRegistryOpt skipwhite + \ DeleteRegValue EnumRegKey EnumRegValue ReadRegDWORD ReadRegStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr +syn region nsisRegistryOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRegistry + +syn keyword nsisInstruction contained WriteRegMultiStr nextgroup=nsisWriteRegMultiStrOpt skipwhite +syn region nsisWriteRegMultiStrOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRegistry,nsisWriteRegMultiStrKwd +syn match nsisWriteRegMultiStrKwd contained "/REGEDIT5\>" + +syn keyword nsisInstruction contained SetRegView nextgroup=nsisSetRegViewOpt skipwhite +syn region nsisSetRegViewOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetRegViewKwd +syn keyword nsisSetRegViewKwd contained default lastused + +"FUNCTIONS - general purpose (4.9.3) +syn keyword nsisInstruction contained CallInstDLL CreateDirectory GetDLLVersion +syn keyword nsisInstruction contained GetDLLVersionLocal GetFileTime GetFileTimeLocal +syn keyword nsisInstruction contained GetTempFileName SearchPath RegDLL UnRegDLL + +syn keyword nsisInstruction contained CopyFiles nextgroup=nsisCopyFilesOpt skipwhite +syn region nsisCopyFilesOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCopyFilesKwd +syn match nsisCopyFilesKwd contained "/\%(SILENT\|FILESONLY\)\>" + +syn keyword nsisInstruction contained CreateShortcut nextgroup=nsisCreateShortcutOpt skipwhite +syn region nsisCreateShortcutOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCreateShortcutKwd +syn match nsisCreateShortcutKwd contained "/NoWorkingDir\>" + +syn keyword nsisInstruction contained GetFullPathName nextgroup=nsisGetFullPathNameOpt skipwhite +syn region nsisGetFullPathNameOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisGetFullPathNameKwd +syn match nsisGetFullPathNameKwd contained "/SHORT\>" + +syn keyword nsisInstruction contained SetFileAttributes nextgroup=nsisSetFileAttributesOpt skipwhite +syn region nsisSetFileAttributesOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFileAttrib +syn keyword nsisFileAttrib contained NORMAL ARCHIVE HIDDEN OFFLINE READONLY SYSTEM TEMPORARY +syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN +syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM +syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_TEMPORARY + +"FUNCTIONS - Flow Control (4.9.4) +syn keyword nsisInstruction contained Abort Call ClearErrors GetCurrentAddress +syn keyword nsisInstruction contained GetFunctionAddress GetLabelAddress Goto +syn keyword nsisInstruction contained IfAbort IfErrors IfFileExists IfRebootFlag IfSilent +syn keyword nsisInstruction contained IntCmp IntCmpU Return Quit SetErrors StrCmp StrCmpS + +syn keyword nsisInstruction contained MessageBox nextgroup=nsisMessageBoxOpt skipwhite +syn region nsisMessageBoxOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisMessageBox +syn keyword nsisMessageBox contained MB_OK MB_OKCANCEL MB_ABORTRETRYIGNORE MB_RETRYCANCEL MB_YESNO MB_YESNOCANCEL +syn keyword nsisMessageBox contained MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP MB_USERICON +syn keyword nsisMessageBox contained MB_TOPMOST MB_SETFOREGROUND MB_RIGHT MB_RTLREADING +syn keyword nsisMessageBox contained MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4 +syn keyword nsisMessageBox contained IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES +syn match nsisMessageBox contained "/SD\>" + +"FUNCTIONS - File and directory i/o instructions (4.9.5) +syn keyword nsisInstruction contained FileClose FileOpen FileRead FileReadUTF16LE +syn keyword nsisInstruction contained FileReadByte FileReadWord FileSeek FileWrite +syn keyword nsisInstruction contained FileWriteByte FileWriteWord +syn keyword nsisInstruction contained FindClose FindFirst FindNext + +syn keyword nsisInstruction contained FileWriteUTF16LE nextgroup=nsisFileWriteUTF16LEOpt skipwhite +syn region nsisFileWriteUTF16LEOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFileWriteUTF16LEKwd +syn match nsisFileWriteUTF16LEKwd contained "/BOM\>" + +"FUNCTIONS - Uninstaller instructions (4.9.6) +syn keyword nsisInstruction contained WriteUninstaller + +"FUNCTIONS - Misc instructions (4.9.7) +syn keyword nsisInstruction contained GetErrorLevel GetInstDirError InitPluginsDir Nop +syn keyword nsisInstruction contained SetErrorLevel Sleep + +syn keyword nsisInstruction contained SetShellVarContext nextgroup=nsisSetShellVarContextOpt skipwhite +syn region nsisSetShellVarContextOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetShellVarContextKwd +syn keyword nsisSetShellVarContextKwd contained current all + +"FUNCTIONS - String manipulation support (4.9.8) +syn keyword nsisInstruction contained StrCpy StrLen + +"FUNCTIONS - Stack support (4.9.9) +syn keyword nsisInstruction contained Exch Push Pop + +"FUNCTIONS - Integer manipulation support (4.9.10) +syn keyword nsisInstruction contained IntOp IntFmt + +"FUNCTIONS - Rebooting support (4.9.11) +syn keyword nsisInstruction contained Reboot SetRebootFlag + +"FUNCTIONS - Install logging instructions (4.9.12) +syn keyword nsisInstruction contained LogSet nextgroup=nsisOnOffOpt skipwhite +syn keyword nsisInstruction contained LogText + +"FUNCTIONS - Section management instructions (4.9.13) +syn keyword nsisInstruction contained SectionSetFlags SectionGetFlags SectionSetText +syn keyword nsisInstruction contained SectionGetText SectionSetInstTypes SectionGetInstTypes +syn keyword nsisInstruction contained SectionSetSize SectionGetSize SetCurInstType GetCurInstType +syn keyword nsisInstruction contained InstTypeSetText InstTypeGetText + +"FUNCTIONS - User Interface Instructions (4.9.14) +syn keyword nsisInstruction contained BringToFront DetailPrint EnableWindow +syn keyword nsisInstruction contained FindWindow GetDlgItem HideWindow IsWindow +syn keyword nsisInstruction contained ShowWindow + +syn keyword nsisInstruction contained CreateFont nextgroup=nsisFontOpt skipwhite + +syn keyword nsisInstruction contained nextgroup=nsisBooleanOpt skipwhite + \ LockWindow SetAutoClose + +syn keyword nsisInstruction contained SendMessage nextgroup=nsisSendMessageOpt skipwhite +syn region nsisSendMessageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSendMessageKwd +syn match nsisSendMessageKwd contained "/TIMEOUT\>" + +syn keyword nsisInstruction contained SetBrandingImage nextgroup=nsisSetBrandingImageOpt skipwhite +syn region nsisSetBrandingImageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetBrandingImageKwd +syn match nsisSetBrandingImageKwd contained "/\%(IMGID\|RESIZETOFIT\)\>" + +syn keyword nsisInstruction contained SetDetailsView nextgroup=nsisSetDetailsViewOpt skipwhite +syn region nsisSetDetailsViewOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetDetailsViewKwd +syn keyword nsisSetDetailsViewKwd contained show hide + +syn keyword nsisInstruction contained SetDetailsPrint nextgroup=nsisSetDetailsPrintOpt skipwhite +syn region nsisSetDetailsPrintOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetDetailsPrintKwd +syn keyword nsisSetDetailsPrintKwd contained none listonly textonly both lastused + +syn keyword nsisInstruction contained SetCtlColors nextgroup=nsisSetCtlColorsOpt skipwhite +syn region nsisSetCtlColorsOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetCtlColorsKwd +syn match nsisSetCtlColorsKwd contained "/BRANDING\>" + +syn keyword nsisInstruction contained SetSilent nextgroup=nsisSetSilentOpt skipwhite +syn region nsisSetSilentOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetSilentKwd +syn keyword nsisSetSilentKwd contained silent normal + + +"FUNCTIONS - Multiple Languages Instructions (4.9.15) +syn keyword nsisInstruction contained LoadLanguageFile LangString LicenseLangString + + +"SPECIAL FUNCTIONS - install (4.7.2.1) +syn match nsisCallback "\.onGUIInit" syn match nsisCallback "\.onInit" -syn match nsisCallback "\.onUserAbort" -syn match nsisCallback "\.onInstSuccess" syn match nsisCallback "\.onInstFailed" -syn match nsisCallback "\.onVerifyInstDir" -syn match nsisCallback "\.onNextPage" -syn match nsisCallback "\.onPrevPage" +syn match nsisCallback "\.onInstSuccess" +syn match nsisCallback "\.onGUIEnd" +syn match nsisCallback "\.onMouseOverSection" +syn match nsisCallback "\.onRebootFailed" syn match nsisCallback "\.onSelChange" +syn match nsisCallback "\.onUserAbort" +syn match nsisCallback "\.onVerifyInstDir" -"SPECIAL FUNCTIONS - uninstall +"SPECIAL FUNCTIONS - uninstall (4.7.2.2) +syn match nsisCallback "un\.onGUIInit" syn match nsisCallback "un\.onInit" +syn match nsisCallback "un\.onUninstFailed" +syn match nsisCallback "un\.onUninstSuccess" +syn match nsisCallback "un\.onGUIEnd" +syn match nsisCallback "un\.onRebootFailed" +syn match nsisCallback "un\.onSelChange" syn match nsisCallback "un\.onUserAbort" -syn match nsisCallback "un\.onInstSuccess" -syn match nsisCallback "un\.onInstFailed" -syn match nsisCallback "un\.onVerifyInstDir" -syn match nsisCallback "un\.onNextPage" -"STATEMENTS - sections -syn keyword nsisStatement Section SectionIn SectionEnd SectionDivider -syn keyword nsisStatement AddSize +"COMPILER UTILITY (5.1) +syn match nsisInclude contained "!include\>" nextgroup=nsisIncludeOpt skipwhite +syn region nsisIncludeOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisIncludeKwd +syn match nsisIncludeKwd contained "/\%(NONFATAL\|CHARSET\)\>" -"STATEMENTS - functions -syn keyword nsisStatement Function FunctionEnd +syn match nsisSystem contained "!addincludedir\>" -"STATEMENTS - pages -syn keyword nsisStatement Page UninstPage PageEx PageExEnc PageCallbacks +syn match nsisSystem contained "!addplugindir\>" nextgroup=nsisAddplugindirOpt skipwhite +syn region nsisAddplugindirOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisAddplugindirKwd +syn match nsisAddplugindirKwd contained "/\%(x86-ansi\|x86-unicode\)\>" +syn match nsisSystem contained "!appendfile\>" nextgroup=nsisAppendfileOpt skipwhite +syn region nsisAppendfileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisAppendfileKwd +syn match nsisAppendfileKwd contained "/\%(CHARSET\|RawNL\)\>" + +syn match nsisSystem contained "!cd\>" + +syn match nsisSystem contained "!delfile\>" nextgroup=nsisDelfileOpt skipwhite +syn region nsisDelfileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDelfileKwd +syn match nsisDelfileKwd contained "/nonfatal\>" + +syn match nsisSystem contained "!echo\>" +syn match nsisSystem contained "!error\>" +syn match nsisSystem contained "!execute\>" +syn match nsisSystem contained "!makensis\>" +syn match nsisSystem contained "!packhdr\>" +syn match nsisSystem contained "!finalize\>" +syn match nsisSystem contained "!system\>" +syn match nsisSystem contained "!tempfile\>" +syn match nsisSystem contained "!getdllversion\>" +syn match nsisSystem contained "!warning\>" + +syn match nsisSystem contained "!pragma\>" nextgroup=nsisPragmaOpt skipwhite +syn region nsisPragmaOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPragmaKwd +syn keyword nsisPragmaKwd contained enable disable default push pop + +syn match nsisSystem contained "!verbose\>" nextgroup=nsisVerboseOpt skipwhite +syn region nsisVerboseOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisVerboseKwd +syn keyword nsisVerboseKwd contained push pop + +"PREPROCESSOR (5.4) +syn match nsisDefine contained "!define\>" nextgroup=nsisDefineOpt skipwhite +syn region nsisDefineOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDefineKwd +syn match nsisDefineKwd contained "/\%(ifndef\|redef\|date\|utcdate\|math\|file\)\>" + +syn match nsisDefine contained "!undef\>" +syn match nsisPreCondit contained "!ifdef\>" +syn match nsisPreCondit contained "!ifndef\>" + +syn match nsisPreCondit contained "!if\>" nextgroup=nsisIfOpt skipwhite +syn region nsisIfOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisIfKwd +syn match nsisIfKwd contained "/FileExists\>" + +syn match nsisPreCondit contained "!ifmacrodef\>" +syn match nsisPreCondit contained "!ifmacrondef\>" +syn match nsisPreCondit contained "!else\>" +syn match nsisPreCondit contained "!endif\>" +syn match nsisMacro contained "!insertmacro\>" +syn match nsisMacro contained "!macro\>" +syn match nsisMacro contained "!macroend\>" +syn match nsisMacro contained "!macroundef\>" + +syn match nsisMacro contained "!searchparse\>" nextgroup=nsisSearchparseOpt skipwhite +syn region nsisSearchparseOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSearchparseKwd +syn match nsisSearchparseKwd contained "/\%(ignorecase\|noerrors\|file\)\>" + +syn match nsisMacro contained "!searchreplace\>" nextgroup=nsisSearchreplaceOpt skipwhite +syn region nsisSearchreplaceOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSearchreplaceKwd +syn match nsisSearchreplaceKwd contained "/ignorecase\>" -"ERROR -syn keyword nsisError UninstallExeName " Define the default highlighting. @@ -225,32 +588,93 @@ syn keyword nsisError UninstallExeName hi def link nsisInstruction Function hi def link nsisComment Comment -hi def link nsisLocalLabel Label +hi def link nsisFirstComment Comment +hi def link nsisLocalLabel Label hi def link nsisGlobalLabel Label -hi def link nsisStatement Statement +hi def link nsisStatement Statement hi def link nsisString String hi def link nsisBoolean Boolean -hi def link nsisAttribOptions Constant -hi def link nsisExecShell Constant -hi def link nsisFileAttrib Constant -hi def link nsisMessageBox Constant -hi def link nsisRegistry Identifier +hi def link nsisOnOff Boolean +hi def link nsisFontKwd Constant +hi def link nsisLangKwd Constant +hi def link nsisPageKwd Constant +hi def link nsisPageExKwd Constant +hi def link nsisSectionKwd Constant +hi def link nsisSectionInKwd Constant +hi def link nsisSectionGroupKwd Constant +hi def link nsisVarKwd Constant +hi def link nsisAddBrandingImageKwd Constant +hi def link nsisBGGradientKwd Constant +hi def link nsisBrandingTextKwd Constant +hi def link nsisCRCCheckKwd Constant +hi def link nsisDirVerifyKwd Constant +hi def link nsisInstallColorsKwd Constant +hi def link nsisInstTypeKwd Constant +hi def link nsisLicenseBkColorKwd Constant +hi def link nsisLicenseForceSelectionKwd Constant +hi def link nsisManifestDPIAwareKwd Constant +hi def link nsisManifestSupportedOSKwd Constant +hi def link nsisRequestExecutionLevelKwd Constant +hi def link nsisShowInstDetailsKwd Constant +hi def link nsisSilentInstallKwd Constant +hi def link nsisSilentUnInstallKwd Constant +hi def link nsisSetCompressKwd Constant +hi def link nsisSetCompressorKwd Constant +hi def link nsisSetOverwriteKwd Constant +hi def link nsisDeleteKwd Constant +hi def link nsisExecShellKwd Constant +hi def link nsisFileKwd Constant +hi def link nsisReserveFileKwd Constant +hi def link nsisRMDirKwd Constant +hi def link nsisDeleteRegKeyKwd Constant +hi def link nsisWriteRegMultiStrKwd Constant +hi def link nsisSetRegViewKwd Constant +hi def link nsisCopyFilesKwd Constant +hi def link nsisCreateShortcutKwd Constant +hi def link nsisGetFullPathNameKwd Constant +hi def link nsisFileAttrib Constant +hi def link nsisMessageBox Constant +hi def link nsisFileWriteUTF16LEKwd Constant +hi def link nsisSetShellVarContextKwd Constant +hi def link nsisSendMessageKwd Constant +hi def link nsisSetBrandingImageKwd Constant +hi def link nsisSetDetailsViewKwd Constant +hi def link nsisSetDetailsPrintKwd Constant +hi def link nsisSetCtlColorsKwd Constant +hi def link nsisSetSilentKwd Constant +hi def link nsisRegistry Identifier hi def link nsisNumber Number hi def link nsisError Error hi def link nsisUserVar Identifier hi def link nsisSysVar Identifier -hi def link nsisAttribute Type -hi def link nsisCompiler Type +hi def link nsisAttribute Type +hi def link nsisCompiler Type +hi def link nsisVersionInfo Type hi def link nsisTodo Todo -hi def link nsisCallback Operator +hi def link nsisCallback Identifier " preprocessor commands hi def link nsisPreprocSubst PreProc +hi def link nsisPreprocLangStr PreProc +hi def link nsisPreprocEnvVar PreProc hi def link nsisDefine Define hi def link nsisMacro Macro -hi def link nsisPreCondit PreCondit +hi def link nsisPreCondit PreCondit hi def link nsisInclude Include hi def link nsisSystem PreProc +hi def link nsisLineContinuation Special +hi def link nsisIncludeKwd Constant +hi def link nsisAddplugindirKwd Constant +hi def link nsisAppendfileKwd Constant +hi def link nsisDelfileKwd Constant +hi def link nsisPragmaKwd Constant +hi def link nsisVerboseKwd Constant +hi def link nsisDefineKwd Constant +hi def link nsisIfKwd Constant +hi def link nsisSearchparseKwd Constant +hi def link nsisSearchreplaceKwd Constant let b:current_syntax = "nsis" +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/pike.vim b/runtime/syntax/pike.vim index ccd122c46c..2c34cb4f38 100644 --- a/runtime/syntax/pike.vim +++ b/runtime/syntax/pike.vim @@ -1,59 +1,184 @@ " Vim syntax file -" Language: Pike -" Maintainer: Francesco Chemolli -" Last Change: 2001 May 10 +" Language: Pike +" Maintainer: Stephen R. van den Berg +" Maintainer of previous implementation: Francesco Chemolli +" Last Change: 2018 Jan 28 +" Version: 2.9 +" Remark: Derived from the C-syntax; fixed several bugs in the C-syntax +" Remark: and extended it with the Pike syntax. +" Remark: Includes a highlighter for all Pike types of parenthesis errors. +" Remark: Includes a highlighter for SQL on multiline strings. +" Remark: Includes a highlighter for any embedded Autodoc format. -" quit when a syntax file was already loaded +" Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") finish endif -" A bunch of useful C keywords -syn keyword pikeStatement goto break return continue -syn keyword pikeLabel case default -syn keyword pikeConditional if else switch -syn keyword pikeRepeat while for foreach do -syn keyword pikeStatement gauge destruct lambda inherit import typeof -syn keyword pikeException catch -syn keyword pikeType inline nomask private protected public static +let s:cpo_save = &cpo +set cpo&vim +" For multiline strings, try formatting them as SQL +syn include @pikeSQL :p:h/sqloracle.vim +unlet b:current_syntax -syn keyword pikeTodo contained TODO FIXME XXX +" For embedded Autodoc documentation (WIP) +syn include @pikeAutodoc :p:h/autodoc.vim +unlet b:current_syntax + +syn case match + +" Supports array, multiset, mapping multi-character delimiter matching +" Supports rotating amongst several same-level preprocessor conditionals +packadd! matchit +let b:match_words = "({:}\\@1<=),(\\[:]\\@1<=),(<:>\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>" + +" A bunch of useful Pike keywords +syn keyword pikeDebug gauge backtrace describe_backtrace werror _Static_assert static_assert +syn keyword pikeException error catch throw +syn keyword pikeLabel case default break return continue +syn keyword pikeConditional if else switch +syn keyword pikeRepeat while for foreach do + +syn keyword pikePredef RegGetKeyNames RegGetValue RegGetValues +syn keyword pikePredef __automap__ __empty_program +syn keyword pikePredef __handle_sprintf_format __parse_pike_type _disable_threads +syn keyword pikePredef _do_call_outs _exit _gdb_breakpoint +syn keyword pikePredef abs access acos acosh add_constant alarm all_constants +syn keyword pikePredef array_sscanf asin asinh atan atan2 atanh atexit +syn keyword pikePredef basetype call_function call_out call_out_info cd ceil +syn keyword pikePredef combine_path combine_path_nt +syn keyword pikePredef combine_path_unix compile copy_value cos cosh cpp crypt +syn keyword pikePredef ctime decode_value delay encode_value encode_value_canonic +syn keyword pikePredef enumerate errno exece exit exp file_stat file_truncate +syn keyword pikePredef filesystem_stat find_call_out floor fork function_name +syn keyword pikePredef function_object function_program gc +syn keyword pikePredef get_active_compilation_handler get_active_error_handler +syn keyword pikePredef get_all_groups get_all_users get_dir get_groups_for_user +syn keyword pikePredef get_iterator get_profiling_info get_weak_flag getcwd +syn keyword pikePredef getgrgid getgrnam gethrdtime gethrtime gethrvtime getpid +syn keyword pikePredef getpwnam getpwuid getxattr glob gmtime has_index has_prefix +syn keyword pikePredef has_suffix has_value hash hash_7_0 hash_7_4 hash_8_0 +syn keyword pikePredef hash_value kill limit listxattr load_module localtime +syn keyword pikePredef log lower_case master max min mkdir mktime mv +syn keyword pikePredef object_program pow query_num_arg random_seed +syn keyword pikePredef remove_call_out removexattr replace_master rm round +syn keyword pikePredef set_priority set_weak_flag setxattr sgn signal signame +syn keyword pikePredef signum sin sinh sleep sort sprintf sqrt sscanf strerror +syn keyword pikePredef string_filter_non_unicode string_to_unicode string_to_utf8 +syn keyword pikePredef tan tanh time trace types ualarm unicode_to_string +syn keyword pikePredef upper_case utf8_to_string version + +syn keyword pikePredef write lock try_lock +syn keyword pikePredef MutexKey Timestamp Date Time TimeTZ Interval Inet Range +syn keyword pikePredef Null null inf nan + +syn keyword pikeTodo contained TODO FIXME XXX + +" Match parengroups: allows for highlighting indices of mappings and +" highlighting semicolons that are out of place due to a paren imbalance +syn cluster pikePreShort contains=pikeDefine,pikePreProc,pikeCppOutWrapper,pikeCppInWrapper,pikePreCondit,pikePreConditMatch +syn cluster pikeExprGroup contains=pikeMappIndex,@pikeStmt,pikeNest,@pikeBadGroup,pikeSoftCast +syn match pikeWord transparent contained /[^()'"[\]{},;:]\+/ contains=ALLBUT,@pikePreProcGroup,@pikeExprGroup +syn match pikeFirstWord transparent display contained /^\s*#[^()'"[\]{},;:]\+/ contains=@pikePreShort +syn cluster pikeMappElm contains=pikeMappIndex,@pikeStmt +syn cluster pikeStmt contains=pikeFirstWord,pikeCharacter,pikeString,pikeMlString,pikeWord,pikeNest +syn cluster pikeBadGroup contains=pikeBadPClose,pikeBadAClose,pikeBadBClose,pikeBadSPClose,pikeBadSAClose,pikeBadSBClose,pikeBadSClose,pikeBadSPAClose,pikeBadSBAClose +syn match pikeBadPClose display contained "[}\]]" +syn match pikeBadAClose display contained "[)\]]" +syn match pikeBadBClose display contained "[)}]" +syn match pikeBadSPClose display contained "[;}\]]" +syn match pikeBadSAClose display contained "[;)\]]" +syn match pikeBadSPAClose display contained "[;\]]" +syn match pikeBadSBAClose display contained "[;}]" +syn match pikeBadSClose display contained "[;)}\]]" +syn region pikeNest transparent start="(\@1)" contains=@pikeStmt,pikeBadSPClose keepend + +" It's easy to accidentally add a space after a backslash that was intended +" for line continuation. Some compilers allow it, which makes it +" unpredictable and should be avoided. +syn match pikeBadContinuation contained "\\\s\+$" + +" pikeCommentGroup allows adding matches for special things in comments +syn cluster pikeCommentGroup contains=pikeTodo,pikeBadContinuation " String and Character constants " Highlight special characters (those which have a backslash) differently -syn match pikeSpecial contained "\\[0-7][0-7][0-7]\=\|\\." -syn region pikeString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial -syn match pikeCharacter "'[^\\]'" -syn match pikeSpecialCharacter "'\\.'" -syn match pikeSpecialCharacter "'\\[0-7][0-7]'" -syn match pikeSpecialCharacter "'\\[0-7][0-7][0-7]'" +syn match pikeSpecial display contained "\\\%(x\x*\|d\d*\|\o\+\|u\x\{4}\|U\x\{8}\|[abefnrtv]\|$\)" -" Compound data types -syn region pikeCompoundType start='({' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='})' -syn region pikeCompoundType start='(\[' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='\])' -syn region pikeCompoundType start='(<' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='>)' +" ISO C11 or ISO C++ 11 +if !exists("c_no_cformat") + " Highlight % items in strings. + syn match pikeFormat display "%\%(\d\+\$\)\=[-+' #0*]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjzt]\|ll\|hh\)\=\%([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained + syn match pikeFormat display "%%" contained + syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,pikeFormat,@Spell keepend + syn region pikeMlString start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeFormat,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend +else + syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,@Spell + syn region pikeMlString transparent start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend +endif -"catch errors caused by wrong parenthesis -syn region pikeParen transparent start='([^{[<(]' end=')' contains=ALLBUT,pikeParenError,pikeIncluded,pikeSpecial,pikeTodo,pikeUserLabel,pikeBitField -syn match pikeParenError ")" -syn match pikeInParen contained "[^(][{}][^)]" +" Use SQL-syntax highlighting in multiline string if it starts with +" a standard SQL keyword +syn case ignore +" FIXME Use explicit newline match to cover up a bug in the regexp engine +" If the kludge is not used, the match will only start unless at least a space +" follows the initial doublequote on the first line (or the keyword is on +" the first line). +syn region pikeEmbeddedString contained start=+\%(#"\n\?\)\@2<=\_s*\%(SELECT\|INSERT\|UPDATE\|DELETE\|WITH\|CREATE\|DROP\|ALTER\)\>+ skip=+\\\\\|\\"+ end=+[\\#]\@1" -"floating point number, with dot, optional exponent -syn match pikeFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" -"floating point number, starting with a dot, optional exponent -syn match pikeFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" -"floating point number, without dot, with exponent -syn match pikeFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" +syn match pikeNumbers display transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctalError,pikeOctal +" Same, but without octal error (for comments) +syn match pikeNumbersCom display contained transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctal +syn match pikeNumber display contained "\<\d\+\%(u\=l\{0,2}\|ll\=u\)\>" "hex number -syn match pikeNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>" -"syn match pikeIdentifier "\<[a-z_][a-z0-9_]*\>" -syn case match +syn match pikeNumber display contained "\<0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>" +" Flag the first zero of an octal number as something special +syn match pikeOctal display contained "\<0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=pikeOctalZero +syn match pikeOctalZero display contained "\<0" +"floating point number, with dot, optional exponent +syn match pikeFloat display contained "\<\d\+\%(f\|\.[0-9.]\@!\d*\%(e[-+]\=\d\+\)\=[fl]\=\)" +"floating point number, starting with a dot, optional exponent +syn match pikeFloat display contained "[0-9.]\@1" +"floating point number, without dot, with exponent +syn match pikeFloat display contained "\<\d\+e[-+]\=\d\+[fl]\=\>" + +"hexadecimal floating point number, two variants, with exponent +syn match pikeFloat display contained "\<0x\%(\x\+\.\?\|\x*\.\x\+\)p[-+]\=\d\+[fl]\=\>" + " flag an octal number with wrong digits -syn match pikeOctalError "\<0[0-7]*[89]" +syn match pikeOctalError display contained "\<0\o*[89]\d*" +syn case match if exists("c_comment_strings") " A comment can contain pikeString, pikeCharacter and pikeNumber. @@ -61,82 +186,201 @@ if exists("c_comment_strings") " need to use a special type of pikeString: pikeCommentString, which also ends on " "*/", and sees a "*" at the start of the line as comment again. " Unfortunately this doesn't very well work for // type of comments :-( - syntax match pikeCommentSkip contained "^\s*\*\($\|\s\+\)" - syntax region pikeCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=pikeSpecial,pikeCommentSkip - syntax region pikeComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=pikeSpecial - syntax region pikeComment start="/\*" end="\*/" contains=pikeTodo,pikeCommentString,pikeCharacter,pikeNumber,pikeFloat - syntax match pikeComment "//.*" contains=pikeTodo,pikeComment2String,pikeCharacter,pikeNumber - syntax match pikeComment "#\!.*" contains=pikeTodo,pikeComment2String,pikeCharacter,pikeNumber + syn match pikeCommentSkip contained "^\s*\*\%($\|\s\+\)" + syn region pikeCommentString contained start=+\\\@\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=pikeComment,pikeString,pikeCharacter,pikeNumber,pikeCommentError -syn region pikeIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn match pikeIncluded contained "<[^>]*>" -syn match pikeInclude "^\s*#\s*include\>\s*["<]" contains=pikeIncluded -"syn match pikeLineSkip "\\$" -syn region pikeDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,pikePreCondit,pikeIncluded,pikeInclude,pikeDefine,pikeInParen -syn region pikePreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,pikePreCondit,pikeIncluded,pikeInclude,pikeDefine,pikeInParen +syn keyword pikeType int void +syn keyword pikeType float +syn keyword pikeType bool string array mapping multiset mixed +syn keyword pikeType object function program auto + +syn keyword pikeType this this_object this_program +syn keyword pikeType sprintf_args sprintf_format sprintf_result +syn keyword pikeType strict_sprintf_format + +syn keyword pikeStructure class enum typedef inherit import +syn keyword pikeTypedef typedef +syn keyword pikeStorageClass private protected public constant final variant +syn keyword pikeStorageClass optional inline extern static __deprecated__ lambda + +syn keyword pikeConstant __LINE__ __FILE__ __DIR__ __DATE__ __TIME__ +syn keyword pikeConstant __AUTO_BIGNUM__ __NT__ +syn keyword pikeConstant __BUILD__ __COUNTER__ _MAJOR__ __MINOR__ __VERSION__ +syn keyword pikeConstant __REAL_BUILD__ _REAL_MAJOR__ __REAL_MINOR__ +syn keyword pikeConstant __REAL_VERSION__ __PIKE__ UNDEFINED + +" These should actually only be parsed in preprocessor conditionals +syn keyword pikeCppOperator contained defined constant efun _Pragma + +syn keyword pikeBoolean true false + +syn match pikeCppPrefix display "^\s*\zs#\s*[a-z]\+" contained +syn region pikePreCondit start="^\s*#\s*\%(if\%(n\?def\)\?\|el\%(se\)\?if\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix +syn match pikePreConditMatch display "^\s*\zs#\s*\%(else\|endif\)\>" +if !exists("c_no_if0") + syn cluster pikeCppOutInGroup contains=pikeCppInIf,pikeCppInElse,pikeCppInElse2,pikeCppOutIf,pikeCppOutIf2,pikeCppOutElse,pikeCppInSkip,pikeCppOutSkip + syn region pikeCppOutWrapper start="^\s*\zs#\s*if\s\+0\+\s*\%($\|//\|/\*\|&\)" end=".\@=\|$" contains=pikeCppOutIf,pikeCppOutElse,@NoSpell fold + syn region pikeCppOutIf contained start="0\+" matchgroup=pikeCppOutWrapper end="^\s*#\s*endif\>" contains=pikeCppOutIf2,pikeCppOutElse + if !exists("c_no_if0_fold") + syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell fold + else + syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell + endif + syn region pikeCppOutElse contained matchgroup=pikeCppOutWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit + syn region pikeCppInWrapper start="^\s*\zs#\s*if\s\+0*[1-9]\d*\s*\%($\|//\|/\*\||\)" end=".\@=\|$" contains=pikeCppInIf,pikeCppInElse fold + syn region pikeCppInIf contained matchgroup=pikeCppInWrapper start="\d\+" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit + if !exists("c_no_if0_fold") + syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 fold + else + syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 + endif + syn region pikeCppInElse2 contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)\%([^/]\|/[^/*]\)*" end="^\ze\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip,@Spell + syn region pikeCppOutSkip contained start="^\s*#\s*if\%(n\?def\)\?\>" skip="\\$" end="^\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip + syn region pikeCppInSkip contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(if\s\+\%(\d\+\s*\%($\|//\|/\*\||\|&\)\)\@!\|ifn\?def\>\)" skip="\\$" end="^\s*#\s*endif\>" containedin=pikeCppOutElse,pikeCppInIf,pikeCppInSkip contains=TOP,pikePreProc +endif +syn region pikeIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeDelimiterDQ keepend +syn match pikeIncluded display contained "<[^>]*>" +syn match pikeInclude display "^\s*\zs#\s*include\>\s*["<]" contains=pikeIncluded +syn cluster pikePreProcGroup contains=pikeIncluded,pikeInclude,pikeEmbeddedString,pikeCppOutWrapper,pikeCppInWrapper,@pikeCppOutInGroup,pikeFormat,pikeMlString,pikeCommentStartError,@pikeBadGroup,pikeWord +syn region pikeDefine start="^\s*\zs#\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend contains=@pikeStmt,@pikeBadGroup +syn region pikePreProc start="^\s*\zs#\s*\%(pragma\|charset\|pike\|require\|string\|line\|warning\|error\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix,@Spell,pikeConstant + +syn match pikeAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@pikeAutodoc containedin=pikeComment,pikeCommentL +syn cluster pikeCommentGroup add=pikeAutodocReal +syn cluster pikePreProcGroup add=pikeAutodocReal " Highlight User Labels -syn region pikeMulti transparent start='?' end=':' contains=ALLBUT,pikeIncluded,pikeSpecial,pikeTodo,pikeUserLabel,pikeBitField " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' -syn match pikeUserLabel "^\s*\I\i*\s*:$" -syn match pikeUserLabel ";\s*\I\i*\s*:$"ms=s+1 -syn match pikeUserLabel "^\s*\I\i*\s*:[^:]"me=e-1 -syn match pikeUserLabel ";\s*\I\i*\s*:[^:]"ms=s+1,me=e-1 +syn match pikeUserLabel display "\%(^\|[{};]\)\zs\I\i*\s*\ze:\%([^:]\|$\)" contained contains=NONE +syn match pikeUserLabel display "\%(\<\%(break\|continue\)\_s\+\)\@10<=\I\i*" contained contains=NONE +syn match pikeUserLabel display "\%(\ " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2017-06-25 +" Latest Revision: 2017-12-25 " readline_has_bash - if defined add support for bash specific " settings/functions @@ -152,6 +153,9 @@ syn keyword readlineVariable contained \ skipwhite \ comment-begin \ isearch-terminators + \ vi-cmd-mode-string + \ vi-ins-mode-string + \ emacs-mode-string syn keyword readlineVariable contained \ nextgroup=readlineNumber diff --git a/runtime/syntax/snobol4.vim b/runtime/syntax/snobol4.vim index a14f15eef4..11ce2e0059 100644 --- a/runtime/syntax/snobol4.vim +++ b/runtime/syntax/snobol4.vim @@ -2,15 +2,16 @@ " Language: SNOBOL4 " Maintainer: Rafal Sulejman " Site: http://rms.republika.pl/vim/syntax/snobol4.vim -" Last change: 2006 may 10 +" Last change: : Thu, 25 Jan 2018 14:21:24 +0100 " Changes: +" - system variables updated for SNOBOL4 2.0+ " - strict snobol4 mode (set snobol4_strict_mode to activate) " - incorrect HL of dots in strings corrected " - incorrect HL of dot-variables in parens corrected " - one character labels weren't displayed correctly. " - nonexistent Snobol4 keywords displayed as errors. -" quit when a syntax file was already loaded +" Quit when a syntax file was already loaded if exists("b:current_syntax") finish endif @@ -59,7 +60,7 @@ syn match snobol4Constant /"[^a-z"']\.[a-z][a-z0-9\-]*"/hs=s+1 syn region snobol4Goto start=":[sf]\{0,1}(" end=")\|$\|;" contains=ALLBUT,snobol4ParenError syn match snobol4Number "\<\d*\(\.\d\d*\)*\>" syn match snobol4BogusSysVar "&\w\{1,}" -syn match snobol4SysVar "&\(abort\|alphabet\|anchor\|arb\|bal\|case\|code\|dump\|errlimit\|errtext\|errtype\|fail\|fence\|fnclevel\|ftrace\|fullscan\|input\|lastno\|lcase\|maxlngth\|output\|parm\|rem\|rtntype\|stcount\|stfcount\|stlimit\|stno\|succeed\|trace\|trim\|ucase\)" +syn match snobol4SysVar "&\<\(abort\|alphabet\|anchor\|arb\|bal\|case\|code\|digits\|dump\|errlimit\|errtext\|errtype\|fail\|fence\|fnclevel\|ftrace\|fullscan\|input\|lastno\|lcase\|maxlngth\|output\|parm\|rem\|rtntype\|stcount\|stfcount\|stlimit\|stno\|succeed\|trace\|trim\|ucase\)\>" syn match snobol4ExtSysVar "&\(gtrace\|line\|file\|lastline\|lastfile\)" syn match snobol4Label "\(^\|;\)[^-\.\+ \t\*\.]\{1,}[^ \t\*\;]*" syn match snobol4Comment "\(^\|;\)\([\*\|!;#].*$\)" @@ -100,11 +101,11 @@ hi def link snobol4ErrInBracket snobol4Error hi def link snobol4SysVar Keyword hi def link snobol4BogusSysVar snobol4Error if exists("snobol4_strict_mode") -hi def link snobol4ExtSysVar WarningMsg -hi def link snobol4ExtKeyword WarningMsg + hi def link snobol4ExtSysVar WarningMsg + hi def link snobol4ExtKeyword WarningMsg else -hi def link snobol4ExtSysVar snobol4SysVar -hi def link snobol4ExtKeyword snobol4Keyword + hi def link snobol4ExtSysVar snobol4SysVar + hi def link snobol4ExtKeyword snobol4Keyword endif