Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:haxe
vim-ocaml
_service:obs_scm:vim-ocaml-20240102T125911.c11d...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:vim-ocaml-20240102T125911.c11dfa3.obscpio of Package vim-ocaml
07070100000000000081A400000000000000000000000165945CFF0000000A000000000000000000000000000000000000002D00000000vim-ocaml-20240102T125911.c11dfa3/.gitignore/doc/tags 07070100000001000081A400000000000000000000000165945CFF000002E9000000000000000000000000000000000000002C00000000vim-ocaml-20240102T125911.c11dfa3/README.md# vim-ocaml Vim runtime files for OCaml. These are synced periodically with the builtin support that comes with Vim. Users are recommended to use this repository directly however as it's more up to date. ## Installation Depending on your plugin manager: ```vim Plugin 'ocaml/vim-ocaml' ``` ```vim NeoBundleInstall ocaml/vim-ocaml' " or use NeoBundleLazy NeoBundleLazy 'rgrinberg/vim-ocaml', {'autoload' : {'filetypes' : \ ['ocaml', 'dune', 'opam', 'oasis', 'omake', 'ocamlbuild_tags', 'sexplib']}} ``` ## History This repo started out by @rgrinberg extracting Markus Mottl's improvements to the builtin OCaml support in Vim. Later, support for more OCaml related tools was added: dune, opam etc. Nowadays, it's maintained by a team. 07070100000002000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002B00000000vim-ocaml-20240102T125911.c11dfa3/compiler07070100000003000081A400000000000000000000000165945CFF0000096E000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/compiler/ocaml.vim" Vim Compiler File " Compiler: ocaml " Maintainer: Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2023 Nov 24 - Improved error format (Samuel Hym) " 2021 Nov 03 - Improved error format (Jules Aguillon) " 2020 Mar 28 - Improved error format (Thomas Leonard) " 2017 Nov 26 - Improved error format (Markus Mottl) " 2013 Aug 27 - Added a new OCaml error format (Markus Mottl) " " Marc Weber's comments: " Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt, " ocamake and whatnot. So which one to use? if exists("current_compiler") finish endif let current_compiler = "ocaml" let s:cpo_save = &cpo set cpo&vim " Patch 8.2.4329 introduces %e and %k as end line and end column positions if has('patch-8.2.4329') CompilerSet errorformat = \%EFile\ \"%f\"\\,\ lines\ %l-%e\\,\ characters\ %c-%k:, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%k:, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%k\ %.%#, else CompilerSet errorformat = \%EFile\ \"%f\"\\,\ lines\ %l-%*\\d\\,\ characters\ %c-%*\\d:, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#, endif CompilerSet errorformat += \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, \%EFile\ \"%f\"\\,\ line\ %l:, \%+EReference\ to\ unbound\ regexp\ name\ %m, \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m, \%Wocamlyacc:\ w\ -\ %m, \%-Zmake%.%# if get(g:, "ocaml_compiler_compact_messages", v:true) CompilerSet errorformat += \%C%*\\d\ \|%.%#, \%C%p^%#, \%C%m endif CompilerSet errorformat += \%Z, \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%D%*\\a:\ Entering\ directory\ `%f', \%X%*\\a:\ Leaving\ directory\ `%f', \%D%*\\a[%*\\d]:\ Entering\ directory\ '%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ '%f', \%D%*\\a:\ Entering\ directory\ '%f', \%X%*\\a:\ Leaving\ directory\ '%f', \%DEntering\ directory\ '%f', \%XLeaving\ directory\ '%f', \%DMaking\ %*\\a\ in\ %f if get(g:, "ocaml_compiler_compact_messages", v:true) CompilerSet errorformat += \%+G%m endif let &cpo = s:cpo_save unlet s:cpo_save 07070100000004000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002600000000vim-ocaml-20240102T125911.c11dfa3/doc07070100000005000081A400000000000000000000000165945CFF000002DD000000000000000000000000000000000000003000000000vim-ocaml-20240102T125911.c11dfa3/doc/ocaml.txt*ocaml.txt* Filetype plugin for OCaml CONFIGURATION *ocaml-configuration* *g:ocaml_highlight_operators* By default operators are not linked to the Operator group and thus not highlighted. You can turn on highlighting of operators by defining: let g:ocaml_highlight_operators = 1 *g:ocaml_compiler_compact_messages* By default the output of the OCaml compiler is filtered to keep only the location and message by the compiler plugin. You can keep the full multi-line messages as displayed by the compiler by defining: let g:ocaml_compiler_compact_messages = 0 vim:tw=78:et:ft=help:norl: 07070100000006000081A400000000000000000000000165945CFF000005C1000000000000000000000000000000000000002F00000000vim-ocaml-20240102T125911.c11dfa3/doc/opam.txt*opam.txt* Switch OCaml versions from inside Vim using opam Author: Rudi Grinberg <http://rgrinberg.com> License: Same terms as Vim itself (see |license|) This plugin is only available if 'compatible' is not set. COMMANDS *:opam* :Opam With no argument. Refresh the environment using |opam env|. :Opam {version} Set the current switch to {version}. CONFIGURATION *opam-configuration* *g:opam_set_switch* If this variable is set to a non-zero value, |:Opam| will set the |$OPAMSWITCH| environment variable. This variable will make sure that every |opam| commands run from inside Vim will continue to act on the same switch even if the selected switch is changed. This also mean that selecting a different switch without using the |:Opam| command will not take effect in this instance of Vim. Defaults to |0|. let g:opam_set_switch = 1 *g:opam_init_env* If this variable is set to a non-zero value, Opam's environment will be refreshed when the plugin is loaded for the first time. This is equivalent to calling |:Opam| when first opening an OCaml file. let g:opam_init_env = 1 ABOUT *opam-about* Grab the latest version or report a bug on GitHub: https://github.com/ocaml/vim-ocaml vim:tw=78:et:ft=help:norl: 07070100000007000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002B00000000vim-ocaml-20240102T125911.c11dfa3/ftdetect07070100000008000081A400000000000000000000000165945CFF00000048000000000000000000000000000000000000003400000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/dune.vimau BufNewFile,BufRead jbuild,dune,dune-project,dune-workspace setf dune 07070100000009000081A400000000000000000000000165945CFF00000028000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/oasis.vimau BufNewFile,BufRead _oasis setf oasis 0707010000000A000081A400000000000000000000000165945CFF0000006B000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/ocaml.vimau BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly,.ocamlinit,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo setf ocaml 0707010000000B000081A400000000000000000000000165945CFF00000031000000000000000000000000000000000000003F00000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/ocamlbuild_tags.vimau BufNewFile,BufRead _tags setf ocamlbuild_tags 0707010000000C000081A400000000000000000000000165945CFF0000002A000000000000000000000000000000000000003800000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/ocpbuild.vimau BufNewFile,BufRead *.ocp setf ocpbuild 0707010000000D000081A400000000000000000000000165945CFF0000002F000000000000000000000000000000000000003C00000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/ocpbuildroot.vimau BufNewFile,BufRead *.root setf ocpbuildroot 0707010000000E000081A400000000000000000000000165945CFF00000048000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/omake.vimau! BufNewFile,BufRead OMakefile,OMakeroot,*.om,OMakeroot.in setf omake 0707010000000F000081A400000000000000000000000165945CFF00000056000000000000000000000000000000000000003400000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/opam.vimau BufNewFile,BufRead opam,*.opam,*.opam.template,opam.locked,*.opam.locked setf opam 07070100000010000081A400000000000000000000000165945CFF0000002A000000000000000000000000000000000000003700000000vim-ocaml-20240102T125911.c11dfa3/ftdetect/sexplib.vimau BufNewFile,BufRead *.sexp setf sexplib 07070100000011000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002B00000000vim-ocaml-20240102T125911.c11dfa3/ftplugin07070100000012000081A400000000000000000000000165945CFF0000022F000000000000000000000000000000000000003400000000vim-ocaml-20240102T125911.c11dfa3/ftplugin/dune.vim" Language: Dune buildsystem " Maintainer: Markus Mottl <markus.mottl@gmail.com> " Anton Kochkov <anton.kochkov@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2018 Nov 3 - Added commentstring (Markus Mottl) " 2017 Sep 6 - Initial version (Etienne Millon) if exists("b:did_ftplugin") finish endif let b:did_ftplugin=1 setl lisp " Comment string setl commentstring=;\ %s setl comments=n:; setl iskeyword+=#,?,.,/ let b:undo_ftplugin = "setlocal lisp< cms< com< isk<" 07070100000013000081A400000000000000000000000165945CFF00000096000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/ftplugin/oasis.vimif exists("b:did_ftplugin") finish endif let b:did_ftplugin=1 setlocal comments=:# setlocal commentstring=#\ %s let b:undo_ftplugin = "com< cms<" 07070100000014000081A400000000000000000000000165945CFF00005F56000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/ftplugin/ocaml.vim" Language: OCaml " Maintainer: David Baelde <firstname.name@ens-lyon.org> " Mike Leary <leary@nwlink.com> " Markus Mottl <markus.mottl@gmail.com> " Pierre Vittet <pierre-vittet@pvittet.com> " Stefano Zacchiroli <zack@bononia.it> " Vincent Aravantinos <firstname.name@imag.fr> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2013 Oct 27 - Added commentstring (MM) " 2013 Jul 26 - load default compiler settings (MM) " 2013 Jul 24 - removed superfluous efm-setting (MM) " 2013 Jul 22 - applied fixes supplied by Hirotaka Hamada (MM) if exists("b:did_ftplugin") finish endif let b:did_ftplugin=1 " Use standard compiler settings unless user wants otherwise if !exists("current_compiler") :compiler ocaml endif " some macro if exists('*fnameescape') function! s:Fnameescape(s) return fnameescape(a:s) endfun else function! s:Fnameescape(s) return escape(a:s," \t\n*?[{`$\\%#'\"|!<") endfun endif " Error handling -- helps moving where the compiler wants you to go let s:cposet=&cpoptions set cpo&vim " Comment string setlocal comments=sr:(*\ ,mb:\ ,ex:*) setlocal comments^=sr:(**,mb:\ \ ,ex:*) setlocal commentstring=(*%s*) let b:undo_ftplugin = "setlocal com< cms<" " Add mappings, unless the user didn't want this. if !exists("no_plugin_maps") && !exists("no_ocaml_maps") " (un)commenting if !hasmapto('<Plug>Comment') nmap <buffer> <LocalLeader>c <Plug>LUncomOn xmap <buffer> <LocalLeader>c <Plug>BUncomOn nmap <buffer> <LocalLeader>C <Plug>LUncomOff xmap <buffer> <LocalLeader>C <Plug>BUncomOff let b:undo_ftplugin .= \ " | silent! execute 'nunmap <buffer> <LocalLeader>c'" . \ " | silent! execute 'xunmap <buffer> <LocalLeader>c'" . \ " | silent! execute 'nunmap <buffer> <LocalLeader>C'" . \ " | silent! execute 'xunmap <buffer> <LocalLeader>C'" endif nnoremap <buffer> <Plug>LUncomOn gI(* <End> *)<ESC> nnoremap <buffer> <Plug>LUncomOff :s/^(\* \(.*\) \*)/\1/<CR>:noh<CR> xnoremap <buffer> <Plug>BUncomOn <ESC>:'<,'><CR>`<O<ESC>0i(*<ESC>`>o<ESC>0i*)<ESC>`< xnoremap <buffer> <Plug>BUncomOff <ESC>:'<,'><CR>`<dd`>dd`< nmap <buffer> <LocalLeader>s <Plug>OCamlSwitchEdit nmap <buffer> <LocalLeader>S <Plug>OCamlSwitchNewWin nmap <buffer> <LocalLeader>t <Plug>OCamlPrintType xmap <buffer> <LocalLeader>t <Plug>OCamlPrintType let b:undo_ftplugin .= \ " | silent! execute 'nunmap <buffer> <LocalLeader>s'" . \ " | silent! execute 'nunmap <buffer> <LocalLeader>S'" . \ " | silent! execute 'nunmap <buffer> <LocalLeader>t'" . \ " | silent! execute 'xunmap <buffer> <LocalLeader>t'" endif if exists("loaded_matchit") && !exists("b:match_words") " Let % jump between structure elements (due to Issac Trotts) let b:mw = '\<let\>:\<and\>:\(\<in\>\|;;\)' let b:mw = b:mw . ',\<if\>:\<then\>:\<else\>' let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>' let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\<end\>' let b:mw = b:mw . ',\<\(match\|try\)\>:\<with\>' let b:match_words = b:mw let b:match_ignorecase=0 let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" endif function! s:OcpGrep(bang,args) abort let grepprg = &l:grepprg let grepformat = &l:grepformat let shellpipe = &shellpipe try let &l:grepprg = "ocp-grep -c never" setlocal grepformat=%f:%l:%m if &shellpipe ==# '2>&1| tee' || &shellpipe ==# '|& tee' let &shellpipe = "| tee" endif execute 'grep! '.a:args if empty(a:bang) && !empty(getqflist()) return 'cfirst' else return '' endif finally let &l:grepprg = grepprg let &l:grepformat = grepformat let &shellpipe = shellpipe endtry endfunction command! -bar -bang -complete=file -nargs=+ Ocpgrep exe s:OcpGrep(<q-bang>, <q-args>) " switching between interfaces (.mli) and implementations (.ml) if !exists("g:did_ocaml_switch") let g:did_ocaml_switch = 1 nnoremap <Plug>OCamlSwitchEdit :<C-u>call OCaml_switch(0)<CR> nnoremap <Plug>OCamlSwitchNewWin :<C-u>call OCaml_switch(1)<CR> fun OCaml_switch(newwin) let open_command = a:newwin == 1 ? "new" : "arge" if (match(bufname(""), "\\.mli$") >= 0) let fname = s:Fnameescape(substitute(bufname(""), "\\.mli$", ".ml", "")) elseif (match(bufname(""), "\\.ml$") >= 0) let fname = s:Fnameescape(bufname("")) . "i" endif exec open_command " " . fname endfun endif " Folding support " Get the modeline because folding depends on indentation let lnum = search('^\s*(\*:o\?caml:', 'n') let s:modeline = lnum? getline(lnum): "" " Get the indentation params let s:m = matchstr(s:modeline,'default\s*=\s*\d\+') if s:m != "" let s:idef = matchstr(s:m,'\d\+') elseif exists("g:omlet_indent") let s:idef = g:omlet_indent else let s:idef = 2 endif let s:m = matchstr(s:modeline,'struct\s*=\s*\d\+') if s:m != "" let s:i = matchstr(s:m,'\d\+') elseif exists("g:omlet_indent_struct") let s:i = g:omlet_indent_struct else let s:i = s:idef endif " Set the folding method if exists("g:ocaml_folding") setlocal foldmethod=expr setlocal foldexpr=OMLetFoldLevel(v:lnum) let b:undo_ftplugin .= " | setlocal fdm< fde<" endif " - Only definitions below, executed once ------------------------------------- if exists("*OMLetFoldLevel") finish endif function s:topindent(lnum) let l = a:lnum while l > 0 if getline(l) =~ '\s*\%(\<struct\>\|\<sig\>\|\<object\>\)' return indent(l) endif let l = l-1 endwhile return -s:i endfunction function OMLetFoldLevel(l) " This is for not merging blank lines around folds to them if getline(a:l) !~ '\S' return -1 endif " We start folds for modules, classes, and every toplevel definition if getline(a:l) =~ '^\s*\%(\<val\>\|\<module\>\|\<class\>\|\<type\>\|\<method\>\|\<initializer\>\|\<inherit\>\|\<exception\>\|\<external\>\)' exe 'return ">' (indent(a:l)/s:i)+1 '"' endif " Toplevel let are detected thanks to the indentation if getline(a:l) =~ '^\s*let\>' && indent(a:l) == s:i+s:topindent(a:l) exe 'return ">' (indent(a:l)/s:i)+1 '"' endif " We close fold on end which are associated to struct, sig or object. " We use syntax information to do that. if getline(a:l) =~ '^\s*end\>' && synIDattr(synID(a:l, indent(a:l)+1, 0), "name") != "ocamlKeyword" return (indent(a:l)/s:i)+1 endif " Folds end on ;; if getline(a:l) =~ '^\s*;;' exe 'return "<' (indent(a:l)/s:i)+1 '"' endif " Comments around folds aren't merged to them. if synIDattr(synID(a:l, indent(a:l)+1, 0), "name") == "ocamlComment" return -1 endif return '=' endfunction " Vim support for OCaml .annot files " " Last Change: 2007 Jul 17 " Maintainer: Vincent Aravantinos <vincent.aravantinos@gmail.com> " License: public domain " " Originally inspired by 'ocaml-dtypes.vim' by Stefano Zacchiroli. " The source code is quite radically different for we not use python anymore. " However this plugin should have the exact same behaviour, that's why the " following lines are the quite exact copy of Stefano's original plugin : " " << " Executing Ocaml_print_type(<mode>) function will display in the Vim bottom " line(s) the type of an ocaml value getting it from the corresponding .annot " file (if any). If Vim is in visual mode, <mode> should be "visual" and the " selected ocaml value correspond to the highlighted text, otherwise (<mode> " can be anything else) it corresponds to the literal found at the current " cursor position. " " Typing '<LocalLeader>t' (LocalLeader defaults to '\', see :h LocalLeader) " will cause " Ocaml_print_type function to be invoked with the right " argument depending on the current mode (visual or not). " >> " " If you find something not matching this behaviour, please signal it. " " Differences are: " - no need for python support " + plus : more portable " + minus: no more lazy parsing, it looks very fast however " " - ocamlbuild support, ie. " + the plugin finds the _build directory and looks for the " corresponding file inside; " + if the user decides to change the name of the _build directory thanks " to the '-build-dir' option of ocamlbuild, the plugin will manage in " most cases to find it out (most cases = if the source file has a unique " name among your whole project); " + if ocamlbuild is not used, the usual behaviour holds; ie. the .annot " file should be in the same directory as the source file; " + for vim plugin programmers: " the variable 'b:_build_dir' contains the inferred path to the build " directory, even if this one is not named '_build'. " " Bonus : " - latin1 accents are handled " - lists are handled, even on multiple lines, you don't need the visual mode " (the cursor must be on the first bracket) " - parenthesized expressions, arrays, and structures (ie. '(...)', '[|...|]', " and '{...}') are handled the same way " Copied from Stefano's original plugin : " << " .annot ocaml file representation " " File format (copied verbatim from caml-types.el) " " file ::= block * " block ::= position <SP> position <LF> annotation * " position ::= filename <SP> num <SP> num <SP> num " annotation ::= keyword open-paren <LF> <SP> <SP> data <LF> close-paren " " <SP> is a space character (ASCII 0x20) " <LF> is a line-feed character (ASCII 0x0A) " num is a sequence of decimal digits " filename is a string with the lexical conventions of O'Caml " open-paren is an open parenthesis (ASCII 0x28) " close-paren is a closed parenthesis (ASCII 0x29) " data is any sequence of characters where <LF> is always followed by " at least two space characters. " " - in each block, the two positions are respectively the start and the " end of the range described by the block. " - in a position, the filename is the name of the file, the first num " is the line number, the second num is the offset of the beginning " of the line, the third num is the offset of the position itself. " - the char number within the line is the difference between the third " and second nums. " " For the moment, the only possible keyword is \"type\"." " >> " 1. Finding the annotation file even if we use ocamlbuild " In: two strings representing paths " Out: one string representing the common prefix between the two paths function! s:Find_common_path (p1,p2) let temp = a:p2 while matchstr(a:p1,temp) == '' let temp = substitute(temp,'/[^/]*$','','') endwhile return temp endfun " After call: " " Following information have been put in s:annot_file_list, using " annot_file_name name as key: " - annot_file_path : " path to the .annot file corresponding to the " source file (dealing with ocamlbuild stuff) " - _build_path: " path to the build directory even if this one is " not named '_build' " - date_of_last annot: " Set to 0 until we load the file. It contains the " date at which the file has been loaded. function! s:Locate_annotation() let annot_file_name = s:Fnameescape(expand('%:t:r')).'.annot' if !exists ("s:annot_file_list[annot_file_name]") silent exe 'cd' s:Fnameescape(expand('%:p:h')) " 1st case : the annot file is in the same directory as the buffer (no ocamlbuild) let annot_file_path = findfile(annot_file_name,'.') if annot_file_path != '' let annot_file_path = getcwd().'/'.annot_file_path let _build_path = '' else " 2nd case : the buffer and the _build directory are in the same directory " .. " / \ " / \ " _build .ml " let _build_path = finddir('_build','.') if _build_path != '' let _build_path = getcwd().'/'._build_path let annot_file_path = findfile(annot_file_name,'_build') if annot_file_path != '' let annot_file_path = getcwd().'/'.annot_file_path endif else " 3rd case : the _build directory is in a directory higher in the file hierarchy " (it can't be deeper by ocamlbuild requirements) " .. " / \ " / \ " _build ... " \ " \ " .ml " let _build_path = finddir('_build',';') if _build_path != '' let project_path = substitute(_build_path,'/_build$','','') let path_relative_to_project = s:Fnameescape(substitute(expand('%:p:h'),project_path.'/','','')) let annot_file_path = findfile(annot_file_name,project_path.'/_build/'.path_relative_to_project) else let annot_file_path = findfile(annot_file_name,'**') "4th case : what if the user decided to change the name of the _build directory ? " -> we relax the constraints, it should work in most cases if annot_file_path != '' " 4a. we suppose the renamed _build directory is in the current directory let _build_path = matchstr(annot_file_path,'^[^/]*') if annot_file_path != '' let annot_file_path = getcwd().'/'.annot_file_path let _build_path = getcwd().'/'._build_path endif else let annot_file_name = '' "(Pierre Vittet: I have commented 4b because this was crashing "my vim (it produced infinite loop)) " " 4b. anarchy : the renamed _build directory may be higher in the hierarchy " this will work if the file for which we are looking annotations has a unique name in the whole project " if this is not the case, it may still work, but no warranty here "let annot_file_path = findfile(annot_file_name,'**;') "let project_path = s:Find_common_path(annot_file_path,expand('%:p:h')) "let _build_path = matchstr(annot_file_path,project_path.'/[^/]*') endif endif endif endif if annot_file_path == '' throw 'E484: no annotation file found' endif silent exe 'cd' '-' let s:annot_file_list[annot_file_name]= [annot_file_path, _build_path, 0] endif endfun " This variable contains a dictionary of lists. Each element of the dictionary " represents an annotation system. An annotation system is a list with: " - annotation file name as its key " - annotation file path as first element of the contained list " - build path as second element of the contained list " - annot_file_last_mod (contain the date of .annot file) as third element let s:annot_file_list = {} " 2. Finding the type information in the annotation file " a. The annotation file is opened in vim as a buffer that " should be (almost) invisible to the user. " After call: " The current buffer is now the one containing the .annot file. " We manage to keep all this hidden to the user's eye. function! s:Enter_annotation_buffer(annot_file_path) let s:current_pos = getpos('.') let s:current_hidden = &l:hidden set hidden let s:current_buf = bufname('%') if bufloaded(a:annot_file_path) silent exe 'keepj keepalt' 'buffer' s:Fnameescape(a:annot_file_path) else silent exe 'keepj keepalt' 'view' s:Fnameescape(a:annot_file_path) endif call setpos(".", [0, 0 , 0 , 0]) endfun " After call: " The original buffer has been restored in the exact same state as before. function! s:Exit_annotation_buffer() silent exe 'keepj keepalt' 'buffer' s:Fnameescape(s:current_buf) let &l:hidden = s:current_hidden call setpos('.',s:current_pos) endfun " After call: " The annot file is loaded and assigned to a buffer. " This also handles the modification date of the .annot file, eg. after a " compilation (return an updated annot_file_list). function! s:Load_annotation(annot_file_name) let annot = s:annot_file_list[a:annot_file_name] let annot_file_path = annot[0] let annot_file_last_mod = 0 if exists("annot[2]") let annot_file_last_mod = annot[2] endif if bufloaded(annot_file_path) && annot_file_last_mod < getftime(annot_file_path) " if there is a more recent file let nr = bufnr(annot_file_path) silent exe 'keepj keepalt' 'bunload' nr endif if !bufloaded(annot_file_path) call s:Enter_annotation_buffer(annot_file_path) setlocal nobuflisted setlocal bufhidden=hide setlocal noswapfile setlocal buftype=nowrite call s:Exit_annotation_buffer() let annot[2] = getftime(annot_file_path) " List updated with the new date let s:annot_file_list[a:annot_file_name] = annot endif endfun "b. 'search' and 'match' work to find the type information "In: - lin1,col1: position of expression first char " - lin2,col2: position of expression last char "Out: - the pattern to be looked for to find the block " Must be called in the source buffer (use of line2byte) function! s:Block_pattern(lin1,lin2,col1,col2) let start_num1 = a:lin1 let start_num2 = line2byte(a:lin1) - 1 let start_num3 = start_num2 + a:col1 let path = '"\(\\"\|[^"]\)\+"' let start_pos = path.' '.start_num1.' '.start_num2.' '.start_num3 let end_num1 = a:lin2 let end_num2 = line2byte(a:lin2) - 1 let end_num3 = end_num2 + a:col2 let end_pos = path.' '.end_num1.' '.end_num2.' '.end_num3 return '^'.start_pos.' '.end_pos."$" " rq: the '^' here is not totally correct regarding the annot file "grammar" " but currently the annotation file respects this, and it's a little bit faster with the '^'; " can be removed safely. endfun "In: (the cursor position should be at the start of an annotation) "Out: the type information " Must be called in the annotation buffer (use of search) function! s:Match_data() " rq: idem as previously, in the following, the '^' at start of patterns is not necessary keepj while search('^type($','ce',line(".")) == 0 keepj if search('^.\{-}($','e') == 0 throw "no_annotation" endif keepj if searchpair('(','',')') == 0 throw "malformed_annot_file" endif endwhile let begin = line(".") + 1 keepj if searchpair('(','',')') == 0 throw "malformed_annot_file" endif let end = line(".") - 1 return join(getline(begin,end),"\n") endfun "In: the pattern to look for in order to match the block "Out: the type information (calls s:Match_data) " Should be called in the annotation buffer function! s:Extract_type_data(block_pattern, annot_file_name) let annot_file_path = s:annot_file_list[a:annot_file_name][0] call s:Enter_annotation_buffer(annot_file_path) try if search(a:block_pattern,'e') == 0 throw "no_annotation" endif call cursor(line(".") + 1,1) let annotation = s:Match_data() finally call s:Exit_annotation_buffer() endtry return annotation endfun "c. link this stuff with what the user wants " ie. get the expression selected/under the cursor let s:ocaml_word_char = '\w|[\xc0-\xff]|''' "In: the current mode (eg. "visual", "normal", etc.) "Out: the borders of the expression we are looking for the type function! s:Match_borders(mode) if a:mode == "visual" let cur = getpos(".") normal `< let col1 = col(".") let lin1 = line(".") normal `> let col2 = col(".") let lin2 = line(".") call cursor(cur[1],cur[2]) return [lin1,lin2,col1-1,col2] else let cursor_line = line(".") let cursor_col = col(".") let line = getline('.') if line[cursor_col-1:cursor_col] == '[|' let [lin2,col2] = searchpairpos('\[|','','|\]','n') return [cursor_line,lin2,cursor_col-1,col2+1] elseif line[cursor_col-1] == '[' let [lin2,col2] = searchpairpos('\[','','\]','n') return [cursor_line,lin2,cursor_col-1,col2] elseif line[cursor_col-1] == '(' let [lin2,col2] = searchpairpos('(','',')','n') return [cursor_line,lin2,cursor_col-1,col2] elseif line[cursor_col-1] == '{' let [lin2,col2] = searchpairpos('{','','}','n') return [cursor_line,lin2,cursor_col-1,col2] else let [lin1,col1] = searchpos('\v%('.s:ocaml_word_char.'|\.)*','ncb') let [lin2,col2] = searchpos('\v%('.s:ocaml_word_char.'|\.)*','nce') if col1 == 0 || col2 == 0 throw "no_expression" endif return [cursor_line,cursor_line,col1-1,col2] endif endif endfun "In: the current mode (eg. "visual", "normal", etc.) "Out: the type information (calls s:Extract_type_data) function! s:Get_type(mode, annot_file_name) let [lin1,lin2,col1,col2] = s:Match_borders(a:mode) return s:Extract_type_data(s:Block_pattern(lin1,lin2,col1,col2), a:annot_file_name) endfun "In: A string destined to be printed in the 'echo buffer'. It has line "break and 2 space at each line beginning. "Out: A string destined to be yanked, without space and double space. function s:unformat_ocaml_type(res) "Remove end of line. let res = substitute (a:res, "\n", "", "g" ) "remove double space let res =substitute(res , " ", " ", "g") "remove space at beginning of string. let res = substitute(res, "^ *", "", "g") return res endfunction "d. main "In: the current mode (eg. "visual", "normal", etc.) "After call: the type information is displayed if !exists("*Ocaml_get_type") function Ocaml_get_type(mode) let annot_file_name = s:Fnameescape(expand('%:t:r')).'.annot' call s:Locate_annotation() call s:Load_annotation(annot_file_name) let res = s:Get_type(a:mode, annot_file_name) " Copy result in the unnamed buffer let @" = s:unformat_ocaml_type(res) return res endfun endif if !exists("*Ocaml_get_type_or_not") function Ocaml_get_type_or_not(mode) let t=reltime() try let res = Ocaml_get_type(a:mode) return res catch return "" endtry endfun endif if !exists("*Ocaml_print_type") function Ocaml_print_type(mode) if expand("%:e") == "mli" echohl ErrorMsg | echo "No annotations for interface (.mli) files" | echohl None return endif try echo Ocaml_get_type(a:mode) catch /E484:/ echohl ErrorMsg | echo "No type annotations (.annot) file found" | echohl None catch /no_expression/ echohl ErrorMsg | echo "No expression found under the cursor" | echohl None catch /no_annotation/ echohl ErrorMsg | echo "No type annotation found for the given text" | echohl None catch /malformed_annot_file/ echohl ErrorMsg | echo "Malformed .annot file" | echohl None endtry endfun endif " Maps nnoremap <silent> <Plug>OCamlPrintType :<C-U>call Ocaml_print_type("normal")<CR> xnoremap <silent> <Plug>OCamlPrintType :<C-U>call Ocaml_print_type("visual")<CR>`< " Make sure the environment is consistent if !exists('g:opam_current_compiler') && exists('g:opam_init_env') && g:opam_init_env != 0 call opam#eval_env() endif let &cpoptions=s:cposet unlet s:cposet " vim:sw=2 fdm=indent 07070100000015000081A400000000000000000000000165945CFF00000096000000000000000000000000000000000000003F00000000vim-ocaml-20240102T125911.c11dfa3/ftplugin/ocamlbuild_tags.vimif exists("b:did_ftplugin") finish endif let b:did_ftplugin=1 setlocal comments=:# setlocal commentstring=#\ %s let b:undo_ftplugin = "com< cms<" 07070100000016000081A400000000000000000000000165945CFF0000027D000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/ftplugin/omake.vim" Vim filetype plugin file " Language: OMake " Only do this when not done yet for this buffer if exists("b:did_ftplugin") finish endif 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 fo-=t fo+=croql " Set 'comments' to format dashed lists in comments setlocal com=sO:#\ -,mO:#\ \ ,b:# " Set 'commentstring' to put the marker after a #. setlocal commentstring=#\ %s " always use spaces and not tabs setlocal expandtab " Including files. let &l:include = '^\s*include' let b:undo_ftplugin = "fo< com< cms< et< inc<" 07070100000017000081A400000000000000000000000165945CFF00000185000000000000000000000000000000000000003700000000vim-ocaml-20240102T125911.c11dfa3/ftplugin/sexplib.vim" Vim filetype plugin file " Language: Sexplib " Maintainer: Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2017 Apr 12 - First version (MM) if exists("b:did_ftplugin") finish endif let b:did_ftplugin=1 " Comment string setl commentstring=;\ %s setl comments=n:; let b:undo_ftplugin = "setl cms< com<" 07070100000018000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002900000000vim-ocaml-20240102T125911.c11dfa3/indent07070100000019000081A400000000000000000000000165945CFF00000175000000000000000000000000000000000000003200000000vim-ocaml-20240102T125911.c11dfa3/indent/dune.vim" Vim indent file " Language: dune " Maintainers: Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: 2020 Dec 31 if exists("b:did_indent") finish endif let b:did_indent = 1 " dune format-dune-file uses 1 space to indent setlocal softtabstop=1 shiftwidth=1 expandtab let b:undo_indent = "setl et< sts< sw<" 0707010000001A000081A400000000000000000000000165945CFF00002447000000000000000000000000000000000000003300000000vim-ocaml-20240102T125911.c11dfa3/indent/ocaml.vim" Vim indent file " Language: OCaml " Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org> " Mike Leary <leary@nwlink.com> " Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: 2017 Jun 13 " 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working " 2005 May 09 - Added an option to not indent OCaml-indents specially (MM) " 2013 June - commented textwidth (Marc Weber) " " Marc Weber's comment: This file may contain a lot of (very custom) stuff " which eventually should be moved somewhere else .. " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal expandtab setlocal indentexpr=GetOCamlIndent() setlocal indentkeys+=0=and,0=class,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=initializer,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0;;,0>\],0\|\],0>},0\|,0},0\],0) setlocal nolisp setlocal nosmartindent let b:undo_indent = "setl et< inde< indk< lisp< si<" " At least Marc Weber and Markus Mottl do not like this: " setlocal textwidth=80 " Comment formatting if !exists("no_ocaml_comments") if (has("comments")) setlocal comments=sr:(*\ ,mb:\ ,ex:*) setlocal comments^=sr:(**,mb:\ \ ,ex:*) setlocal fo=cqort let b:undo_indent .= " | setl com< fo<" endif endif " Only define the function once. if exists("*GetOCamlIndent") finish endif " Define some patterns: let s:beflet = '^\s*\(initializer\|method\|try\)\|\(\<\(begin\|do\|else\|in\|then\|try\)\|->\|<-\|=\|;\|(\)\s*$' let s:letpat = '^\s*\(let\|type\|module\|class\|open\|exception\|val\|include\|external\)\>' let s:letlim = '\(\<\(sig\|struct\)\|;;\)\s*$' let s:lim = '^\s*\(exception\|external\|include\|let\|module\|open\|type\|val\)\>' let s:module = '\<\%(begin\|sig\|struct\|object\)\>' let s:obj = '^\s*\(constraint\|inherit\|initializer\|method\|val\)\>\|\<\(object\|object\s*(.*)\)\s*$' let s:type = '^\s*\%(class\|let\|type\)\>.*=' " Skipping pattern, for comments function! s:GetLineWithoutFullComment(lnum) let lnum = prevnonblank(a:lnum - 1) let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '') while lline =~ '^\s*$' && lnum > 0 let lnum = prevnonblank(lnum - 1) let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '') endwhile return lnum endfunction " Indent for ';;' to match multiple 'let' function! s:GetInd(lnum, pat, lim) let llet = search(a:pat, 'bW') let old = indent(a:lnum) while llet > 0 let old = indent(llet) let nb = s:GetLineWithoutFullComment(llet) if getline(nb) =~ a:lim return old endif let llet = search(a:pat, 'bW') endwhile return old endfunction " Indent pairs function! s:FindPair(pstart, pmid, pend) call search(a:pend, 'bW') return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"')) endfunction " Indent 'let' function! s:FindLet(pstart, pmid, pend) call search(a:pend, 'bW') return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ s:beflet')) endfunction function! GetOCamlIndent() " Find a non-commented line above the current line. let lnum = s:GetLineWithoutFullComment(v:lnum) " At the start of the file use zero indent. if lnum == 0 return 0 endif let ind = indent(lnum) let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '') " Return double 'shiftwidth' after lines matching: if lline =~ '^\s*|.*->\s*$' return ind + 2 * shiftwidth() endif let line = getline(v:lnum) " Indent if current line begins with 'end': if line =~ '^\s*end\>' return s:FindPair(s:module, '','\<end\>') " Indent if current line begins with 'done' for 'do': elseif line =~ '^\s*done\>' return s:FindPair('\<do\>', '','\<done\>') " Indent if current line begins with '}' or '>}': elseif line =~ '^\s*\(\|>\)}' return s:FindPair('{', '','}') " Indent if current line begins with ']', '|]' or '>]': elseif line =~ '^\s*\(\||\|>\)\]' return s:FindPair('\[', '','\]') " Indent if current line begins with ')': elseif line =~ '^\s*)' return s:FindPair('(', '',')') " Indent if current line begins with 'let': elseif line =~ '^\s*let\>' if lline !~ s:lim . '\|' . s:letlim . '\|' . s:beflet return s:FindLet(s:type, '','\<let\s*$') endif " Indent if current line begins with 'class' or 'type': elseif line =~ '^\s*\(class\|type\)\>' if lline !~ s:lim . '\|\<and\s*$\|' . s:letlim return s:FindLet(s:type, '','\<\(class\|type\)\s*$') endif " Indent for pattern matching: elseif line =~ '^\s*|' if lline !~ '^\s*\(|[^\]]\|\(match\|type\|with\)\>\)\|\<\(function\|parser\|private\|with\)\s*$' call search('|', 'bW') return indent(searchpair('^\s*\(match\|type\)\>\|\<\(function\|parser\|private\|with\)\s*$', '', '^\s*|', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") !~ "^\\s*|.*->"')) endif " Indent if current line begins with ';;': elseif line =~ '^\s*;;' if lline !~ ';;\s*$' return s:GetInd(v:lnum, s:letpat, s:letlim) endif " Indent if current line begins with 'in': elseif line =~ '^\s*in\>' if lline !~ '^\s*\(let\|and\)\>' return s:FindPair('\<let\>', '', '\<in\>') endif " Indent if current line begins with 'else': elseif line =~ '^\s*else\>' if lline !~ '^\s*\(if\|then\)\>' return s:FindPair('\<if\>', '', '\<else\>') endif " Indent if current line begins with 'then': elseif line =~ '^\s*then\>' if lline !~ '^\s*\(if\|else\)\>' return s:FindPair('\<if\>', '', '\<then\>') endif " Indent if current line begins with 'and': elseif line =~ '^\s*and\>' if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$' return ind - shiftwidth() endif " Indent if current line begins with 'with': elseif line =~ '^\s*with\>' if lline !~ '^\s*\(match\|try\)\>' return s:FindPair('\<\%(match\|try\)\>', '','\<with\>') endif " Indent if current line begins with 'exception', 'external', 'include' or " 'open': elseif line =~ '^\s*\(exception\|external\|include\|open\)\>' if lline !~ s:lim . '\|' . s:letlim call search(line) return indent(search('^\s*\(\(exception\|external\|include\|open\|type\)\>\|val\>.*:\)', 'bW')) endif " Indent if current line begins with 'val': elseif line =~ '^\s*val\>' if lline !~ '^\s*\(exception\|external\|include\|open\)\>\|' . s:obj . '\|' . s:letlim return indent(search('^\s*\(\(exception\|include\|initializer\|method\|open\|type\|val\)\>\|external\>.*:\)', 'bW')) endif " Indent if current line begins with 'constraint', 'inherit', 'initializer' " or 'method': elseif line =~ '^\s*\(constraint\|inherit\|initializer\|method\)\>' if lline !~ s:obj return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + shiftwidth() endif endif " Add a 'shiftwidth' after lines ending with: if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$' let ind = ind + shiftwidth() " Back to normal indent after lines ending with ';;': elseif lline =~ ';;\s*$' && lline !~ '^\s*;;' let ind = s:GetInd(v:lnum, s:letpat, s:letlim) " Back to normal indent after lines ending with 'end': elseif lline =~ '\<end\s*$' let ind = s:FindPair(s:module, '','\<end\>') " Back to normal indent after lines ending with 'in': elseif lline =~ '\<in\s*$' && lline !~ '^\s*in\>' let ind = s:FindPair('\<let\>', '', '\<in\>') " Back to normal indent after lines ending with 'done': elseif lline =~ '\<done\s*$' let ind = s:FindPair('\<do\>', '','\<done\>') " Back to normal indent after lines ending with '}' or '>}': elseif lline =~ '\(\|>\)}\s*$' let ind = s:FindPair('{', '','}') " Back to normal indent after lines ending with ']', '|]' or '>]': elseif lline =~ '\(\||\|>\)\]\s*$' let ind = s:FindPair('\[', '','\]') " Back to normal indent after comments: elseif lline =~ '\*)\s*$' call search('\*)', 'bW') let ind = indent(searchpair('(\*', '', '\*)', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')) " Back to normal indent after lines ending with ')': elseif lline =~ ')\s*$' let ind = s:FindPair('(', '',')') " If this is a multiline comment then align '*': elseif lline =~ '^\s*(\*' && line =~ '^\s*\*' let ind = ind + 1 else " Don't change indentation of this line " for new lines (indent==0) use indentation of previous line " This is for preventing removing indentation of these args: " let f x = " let y = x + 1 in " Printf.printf " "o" << here " "oeuth" << don't touch indentation let i = indent(v:lnum) return i == 0 ? ind : i endif " Subtract a 'shiftwidth' after lines matching 'match ... with parser': if lline =~ '\<match\>.*\<with\>\s*\<parser\s*$' let ind = ind - shiftwidth() endif return ind endfunction " vim:sw=2 0707010000001B000081A400000000000000000000000165945CFF00000D16000000000000000000000000000000000000003300000000vim-ocaml-20240102T125911.c11dfa3/indent/omake.vim" Vim indent file " Language: OMakefile if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetMakeIndent() setlocal indentkeys=!^F,o,O,<:>,=else,=endif setlocal nosmartindent if exists("*GetMakeIndent") finish endif let s:comment_rx = '^\s*#' let s:rule_rx = '^[^ \t#:][^#:]*:\{1,2}\%([^=:]\|$\)' let s:continued_rule_rx = '^[^#:]*:\{1,2}\%([^=:]\|$\)' let s:continuation_rx = '\\$' let s:assignment_rx = '^\s*\h\w*\s*[+?]\==\s*\zs.*\\$' let s:folded_assignment_rx = '^\s*\h\w*\s*[+?]\==' " TODO: This needs to be a lot more restrictive in what it matches. let s:just_inserted_rule_rx = '^\s*[^#:]\+:\{1,2}$' let s:conditional_directive_rx = '^ *\%(ifn\=\%(eq\|def\)\|else\)\>' let s:end_conditional_directive_rx = '^\s*\%(else\|endif\)\>' function s:remove_continuation(line) return substitute(a:line, s:continuation_rx, "", "") endfunction function GetMakeIndent() " TODO: Should this perhaps be v:lnum -1? " let prev_lnum = prevnonblank(v:lnum - 1) let prev_lnum = v:lnum - 1 if prev_lnum == 0 return 0 endif let prev_line = getline(prev_lnum) let prev_prev_lnum = prev_lnum - 1 let prev_prev_line = prev_prev_lnum != 0 ? getline(prev_prev_lnum) : "" " TODO: Deal with comments. In comments, continuations aren't interesting. if prev_line =~ s:continuation_rx if prev_prev_line =~ s:continuation_rx return indent(prev_lnum) elseif prev_line =~ s:rule_rx return &sw elseif prev_line =~ s:assignment_rx call cursor(prev_lnum, 1) if search(s:assignment_rx, 'W') != 0 return virtcol('.') - 1 else " TODO: ? return &sw endif else " TODO: OK, this might be a continued shell command, so perhaps indent " properly here? Leave this out for now, but in the next release this " should be using indent/sh.vim somehow. "if prev_line =~ '^\t' " s:rule_command_rx " if prev_line =~ '^\s\+[@-]\%(if\)\>' " return indent(prev_lnum) + 2 " endif "endif return indent(prev_lnum) + &sw endif elseif prev_prev_line =~ s:continuation_rx let folded_line = s:remove_continuation(prev_prev_line) . ' ' . s:remove_continuation(prev_line) let lnum = prev_prev_lnum - 1 let line = getline(lnum) while line =~ s:continuation_rx let folded_line = s:remove_continuation(line) . ' ' . folded_line let lnum -= 1 let line = getline(lnum) endwhile let folded_lnum = lnum + 1 if folded_line =~ s:rule_rx if getline(v:lnum) =~ s:rule_rx return 0 else return &ts endif else " elseif folded_line =~ s:folded_assignment_rx if getline(v:lnum) =~ s:rule_rx return 0 else return indent(folded_lnum) endif " else " " TODO: ? " return indent(prev_lnum) endif elseif prev_line =~ s:rule_rx if getline(v:lnum) =~ s:rule_rx return 0 else return &ts endif elseif prev_line =~ s:conditional_directive_rx return &sw else let line = getline(v:lnum) if line =~ s:just_inserted_rule_rx return 0 elseif line =~ s:end_conditional_directive_rx return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - &sw else return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) endif endif endfunction 0707010000001C000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002900000000vim-ocaml-20240102T125911.c11dfa3/plugin0707010000001D000081A400000000000000000000000165945CFF00000C24000000000000000000000000000000000000003200000000vim-ocaml-20240102T125911.c11dfa3/plugin/opam.vim" opam.vim - Switch ocaml versions from inside Vim " Maintainer: Rudi Grinberg <http://rgrinberg.com> " Version: 1.0 if exists('g:loaded_opam') || v:version < 700 || &cp finish endif let g:loaded_opam = 1 if !exists('g:opam_set_switch') let g:opam_set_switch = 0 endif " Utility {{{1 function! opam#eval_env() let l:env_extra_args = "" if g:opam_set_switch " Unlet so 'opam env' uses the selected switch unlet $OPAMSWITCH " Will add OPAMSWITCH and OPAMROOT to the output let l:env_extra_args = " --set-switch --set-root" endif let opam_eval = system("opam env --readonly" . l:env_extra_args) if v:shell_error return 0 endif let cmds = split(opam_eval, "\n") for cmd in cmds let var = split(split(cmd, ";")[0], "=") execute 'let $' . var[0] . " = " . var[1] endfor if g:opam_set_switch let g:opam_current_compiler = $OPAMSWITCH else let g:opam_current_compiler = opam#compiler_version() endif return 1 endfunction function! opam#switch(ocaml_version) let res = system('opam switch --color=never ' . s:shellesc(a:ocaml_version)) let success = empty(matchstr(res, 'ERROR')) if success call opam#eval_env() endif return success endfunction function! opam#chomp(s) return substitute(a:s, '\n', '', 'g') endfunction function! opam#compiler_version() return opam#chomp(system("opam switch show")) endfunction function! s:shellesc(arg) abort if a:arg =~ '^[A-Za-z0-9_/.-]\+$' return a:arg else return shellescape(a:arg) endif endfunction " }}}1 " :Opam {{{1 function! opam#cmd_switch(version) let success = opam#switch(a:version) if success if g:opam_current_compiler == a:version let l:extra_msg = "" elseif !g:opam_set_switch && exists('$OPAMSWITCH') let l:extra_msg = " (set with OPAMSWITCH)" else let l:extra_msg = " (local switch)" endif echomsg "Using " . g:opam_current_compiler . l:extra_msg else echoerr "Switching to " . a:version . " failed" endif endfunction function! s:Opam(bang,...) abort if len(a:000) > 1 if a:1 ==# "switch" call opam#cmd_switch(a:2) else echoerr "Only switching is supported for now" end elseif len(a:000) > 0 call opam#cmd_switch(a:1) else if opam#eval_env() echomsg "Using " . g:opam_current_compiler else echomsg "Updating the environment failed." endif end endfunction function! s:Complete(A,L,P) let switches = split((system("opam switch --short 2> /dev/null")), "\n") call map(switches, 'opam#chomp(v:val)') return join(switches, "\n") endfunction command! -bar -nargs=* -complete=custom,s:Complete Opam :call s:Opam(<bang>0,<f-args>) " }}}1 " Statusline {{{1 function! opam#statusline() if exists('g:opam_current_compiler') let c = g:opam_current_compiler else let c = opam#compiler_version() endif return substitute('['.c.']','^\[\]$','','') endfunction function! opam#statusline_ft_ocaml() if &filetype ==# 'ocaml' return opam#statusline() else return '' endif endfunction " }}}1 " vim:set sw=2 sts=2: 0707010000001E000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000002900000000vim-ocaml-20240102T125911.c11dfa3/syntax0707010000001F000041ED00000000000000000000000265945CFF00000000000000000000000000000000000000000000003300000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases07070100000020000081A400000000000000000000000165945CFF00000019000000000000000000000000000000000000004600000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/exception_alias.ml(* ok *) exception E = F 07070100000021000081A400000000000000000000000165945CFF000001A7000000000000000000000000000000000000003F00000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/functor1.ml(* ok *) module M : sig module type F = functor () (X : Ord) -> sig end module F : functor () (X : Ord) -> sig end end = struct module type F = functor () (X : Ord) -> sig end module F : functor () (X : Ord) -> sig end = functor () (X : Ord) -> struct end end module type F = functor () (X : Ord) -> sig end module F : functor () (X : Ord) -> sig end = functor () (X : Ord) -> struct end 07070100000022000081A400000000000000000000000165945CFF000000E4000000000000000000000000000000000000003F00000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/functor2.ml(* https://github.com/ocaml/vim-ocaml/issues/3 *) module Make (M : sig end) = struct module type S = sig end end module Test : Make(Make(Int)).S = struct end (* ----------------^ the inner modules are linted as constructors *) 07070100000023000081A400000000000000000000000165945CFF0000006C000000000000000000000000000000000000004000000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/functor3.mlimodule Make : functor(X: Ord) -> sig module Bar : module type of Make(X) val x : int val y : int end 07070100000024000081A400000000000000000000000165945CFF0000009F000000000000000000000000000000000000004400000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/functor_param.mlmodule M : sig module F () (X : Ord) : sig end end = struct module F () (X : Ord) : sig end = struct end end module F () (X : Ord) : sig end = struct end 07070100000025000081A400000000000000000000000165945CFF000001AD000000000000000000000000000000000000004400000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/module_paren1.mlmodule M0 : sig end = struct let x = 0 end (* => linting of struct is correct *) module M1 : sig end = (struct let x = 0 end : sig end) (* => linting of struct is correct (but linting of last sig is buggy because of the type linter of PR#76) *) module M2 = (struct let x = 0 end : sig end) (* => ^^^^^^^^^^^^^^^^^^^^ the whole struct is linted with a wrong, uniform style (but linting of last sig is correct) *) 07070100000026000081A400000000000000000000000165945CFF0000018E000000000000000000000000000000000000004400000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/module_paren2.ml(* https://github.com/ocaml/vim-ocaml/issues/6 *) module IM = Stdlib.Map.Make(Int) (* ^^^^^^^^^^^^^^^^^^^^ shown as a module/functor, with a uniform style *) module IM : sig end = Stdlib.Map.Make(Int) (* ^^^^^^^^^^^^^^^^^^^^ shown as as an expression (a datatype constructor `Make` prefixed with a module path, and a constructor `Int`) *) 07070100000027000081A400000000000000000000000165945CFF0000006E000000000000000000000000000000000000004200000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/module_type.ml(* https://github.com/ocaml/vim-ocaml/issues/84 *) (* Foo is highlighted incorrectly *) type x = (module Foo) 07070100000028000081A400000000000000000000000165945CFF00000132000000000000000000000000000000000000004600000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/module_type_of.mli(* approximately ok: * - "module type of" linted as ocamlKeyword * - "F" linted as ocamlModule * - "(X)" linted meaninglessly but by chance it doesn’t look SO bad *) module N : module type of F(X) module M : sig module N : module type of X module N : module type of F(X) val x : int end 07070100000029000081A400000000000000000000000165945CFF0000002D000000000000000000000000000000000000004800000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/module_underscore.ml(* ok *) module _ = struct let () = () end 0707010000002A000081A400000000000000000000000165945CFF0000003D000000000000000000000000000000000000004C00000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/module_with_signature.mlmodule F : Bar = Foo module Test : Make(Int).S = struct end 0707010000002B000081A400000000000000000000000165945CFF000000FB000000000000000000000000000000000000004B00000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/poly_variant_in_type.ml(* https://github.com/ocaml/vim-ocaml/issues/88 *) (* foo is highlighted incorrectly on every line *) val bar : [>foo] let decode x = (Dns.Packet.decode x : (_, Dns.Packet.err) result :> (_, [> foo]) result) type t = [Dns.Packet.foo | Dns.Packet.bar] 0707010000002C000081A400000000000000000000000165945CFF0000303D000000000000000000000000000000000000004700000000vim-ocaml-20240102T125911.c11dfa3/syntax-testcases/type-linter-test.ml(* TODO: * - error reporting of wrong keywords in type context: mutable/of/done/etc. * - class type parameters * * Cases which were not detected by examining the OCaml grammar in the manual: * - let f (type a b) … * - module M : MSIG with type t = u = struct … end * - module M (X : …) … * - (x : t :> t) * - (x : name :> t) (“name :” looks like a label) * - let f : type a b. a -> b = … * - let f ~x:local_name … * - false, true, (), [], :: are constructors * - extensible type: type u = .. , type u += U2 * - destructive substitution (lang. extension): with type t := … *) (* TYPE EXPRESSIONS *) type t0 = unit type _ t1 = bool type (_, _) t2 = int type u = char type v = string type w = bytes (* type expressions with arrows, tuples, 0-ary type constructors *) type t = t0 * t0 -> t0 (* type expressions with type arguments *) type t = t0 * u t1 -> (v, w) t2 (* type expressions with builtin type names *) type t = unit option * bool ref * int array * char list -> (string, bytes) result (* type expressions with type variables *) type ('a, 'b) t = 'a list * ('a, 'b) result (* type expressions with module paths *) type t = Scanf.Scanning . in_channel type t = Stdlib.Set.Make ( Stdlib.Set.Make(Stdlib.Set.Make(Int)) ) . t (* type expressions with labels *) type t = name : int -> int type t = ?name : int -> int (* conflict between labels in type expressions and builtin type names *) type t = int : int -> int type t = ?int : int -> int (* type expressions with parentheses *) type t = (((?name : int -> int) -> int) -> int) (* quantified type expression *) let f : 'a 'b . 'a -> 'b -> 'a * 'b = fun x y -> (x, y) (* object types *) type 't t = < method1 : int * int ; method2 : name:int -> int ; .. > as 't (* polymorphic variant types *) type 't t = [< `a ] as 't type 't t = [> `a ] as 't type t = [ `a ] type t = [ `a | `b ] type 't t = [< `a of int * int & char -> char ] as 't type 't t = [< `a of int * int & char -> char | `b of int * int ] as 't (* syntax errors *) (*! type 't t = [ `a : int * int -> t & (char -> char) -> t ] as 't !*) (*! type 't t = [ `a : int * int -> t & (char -> char) -> t | `b : int * int -> t ] as 't !*) (* TYPE DEFINITIONS *) (* type definitions with type variables *) type 'a t = 'a option type ('a, 'b) t = ('a, 'b) result type _ t = int type ('a, _) t = 'a (* type definitions with injectivity and variance precisions *) type + 'a t = int type + _ t = int type - 'a t = int type - _ t = int type (+'a, -_) t = int type ! 'a t = 'a list type ! + 'a t = 'a list type + ! 'a t = 'a list type (-!'a, !+'b) t = 'a -> 'b (* type definitions with “nonrec” and “private” *) type nonrec 'a r = 'a ref = private { mutable contents : 'a } type nonrec 'a r = private 'a r type nonrec 'a o = 'a option = private None | Some of 'a type nonrec 'a o = private 'a o (* type definitions with “as” *) type 'a t = int as 'a (* the “as” keyword outside of type contexts: *) let x as y = 0 (* type definitions with constraints *) type 'a t = int * 'a constraint (int * int) * int = 'a t * int type t = A constraint int = int (* mutually recursive type definitions *) type t = int and u = int type t = A and u = B type t = int constraint int = t and u = int constraint int = u (* definition of record types *) type t = { mutable field1 : int * int ; field2 : name:int -> int } (* definition of sum types *) type t = A type t = | A type t = A | B type t = | A | B type t = A of int * int type t = | A of int * int type t = A : int * int -> t type t = | A : int * int -> t type t = A of int * int | B of int * int type t = | A of int * int | B of int * int type t = A : int * int -> t | B : int * int -> t type t = | A : int * int -> t | B : int * int -> t (* definition of sum types with inline records *) type t = A of { field1 : int ; mutable field2 : int } type t = A : { field1 : int ; mutable field2 : int } -> t (* definition of extensible sum types *) type t = .. type t += A | B type t += C of int type t += D : int -> t (* definition of exceptions *) exception E exception E of int exception E : int -> exn exception E' = E exception F = Stdlib.Not_found (* local exceptions *) let _ = let exception E in () let _ = let exception E of int * int in () let _ = let exception E : int -> exn in () (* exception patterns *) let _ = match () with () -> () | exception E 42 -> () let _ = match () with exception E 42 -> () | () -> () let _ = match () with exception E 42 -> () | () -> () | exception E' 42 -> () (* exception patterns under or-patterns (since OCaml 4.08) *) let _ = match () with (exception E 42 | exception E 43) -> () | _ -> () (* empty type definition followed by an exception definition *) type t = | exception E (* definition with a constant constructor followed by a comment *) type t = A (* should work *) exception E (* should work *) (* corner case: “false”, “true”, “()” “[]” and “::” are constructors, too! *) module DamageControl = struct type 'a t = ( ) | false | true of 'a | [ ] | (::) of 'a * 'a end (* definition of an empty type *) type t = | (* TYPE ANNOTATIONS *) (* annotations on let binders *) let _ : float = 0. let f x : float = 0. let f (x : int) = 0. let f (x : int) : float = 0. let f ~(x : int) = 0. let f ?(x : int option)() = 0. let f ?(x : int = 0)() = 0. (* conflict between type annotations and local renaming of labels *) (* y is the local name of x, int is the type of x, float is the return type *) let f ~x:y = float y let f ~x: y = float y let f ~x :float = float x let f ~x : float = float x let f ~x:y:float = float y let f ~x:y :float = float y let f ~x:y: float = float y let f ~x:y : float = float y let f ~x: y:float = float y let f ~x: y :float = float y let f ~x: y: float = float y let f ~x: y : float = float y let f ~x:(y:int) : float = float y let f ~x:(y : int) : float = float y (*! let f ~x : y : float = float y (* syntax error *) !*) (* the same with optional arguments *) let[@warning "-16"] f ?x:y = 0. let[@warning "-16"] f ?x: y = 0. let[@warning "-16"] f ?x :float = 0. let[@warning "-16"] f ?x : float = 0. let[@warning "-16"] f ?x:y:float = 0. let[@warning "-16"] f ?x:y :float = 0. let[@warning "-16"] f ?x:y: float = 0. let[@warning "-16"] f ?x:y : float = 0. let[@warning "-16"] f ?x: y:float = 0. let[@warning "-16"] f ?x: y :float = 0. let[@warning "-16"] f ?x: y: float = 0. let[@warning "-16"] f ?x: y : float = 0. let[@warning "-16"] f ?x:(y:int option) : float = 0. let[@warning "-16"] f ?x:(y : int option) : float = 0. let[@warning "-16"] f ?x:(y : int = 0) : float = 0. (*! let f ?x : y : float = 0. (* syntax error *) !*) (* even worse *) let f ~x:y:z:unit->float = fun ~z:_ -> 0. let[@warning "-16"] f ?x:y:z:unit->float = fun ~z:_ -> 0. (* annotations and coercions on expressions *) let f x = (x : int) let f x = (x :> int) let f x = (x : int :> int) (* nested within parentheses *) let _ = let x : int = 0 in x let _ = (let x : int = 0 in x) (* nested type expressions *) let _ : < x : int ; y : int > = object method x = 0 method y = 0 end type 'a t = { field1 : int * < method1 : int -> string ; .. > as 'a ; field2 : int * < method1 : int -> string > ; } (* annotations in pattern-matching *) type t = A | B of int let _ = function | A -> () | (B (x:int) : t) -> () (* annotations on record fields *) type t = { x : int ; y : int } let _ = { x : int = 0 ; y : int = 0 } let _ = let x = 0 and y = 0 in { x : int ; y : int } (* annotations on object values and methods *) class c : object val v : int method x : int method y : int end = object val v : int = 0 method x : int = 0 method y : int = 0 end (* LOCALLY ABSTRACT TYPES *) (* type parameter *) let f (type a) (x : a) : a = x (* existential type when pattern-matching a GADT (since OCaml 4.13) *) (*! type t = A : ('a * ('a->string)) -> t !*) (*! let f t = match t with A (type a) (x, print : a * _) -> print x !*) (* polymorphic syntax for locally abstract types; * NOTE: this is only allowed on let/method defs, right after the colon. *) let f : type a b . a -> b -> a * b = fun x y -> (x, y) let _ = object method f : type a b. a -> b -> a * b = f end (* annotations on let must eat "type" but annotations on val must not *) module type SIG = sig type t = int val x : int type u = int end (* CLASS TYPES *) class c : x:int -> object method f : int method g : float constraint int = int inherit object end end = fun ~x -> object method f : int = 0 method g : float = 0. end (* FIXME the type parameters of the class should be highlighted as types: *) class ['a, 'b] c : x:int -> let open List in object end = fun ~x -> object end (* MODULES *) module type SIG = sig type t end (* modules with type constraints *) module F (M : sig end) : SIG with type t = int = struct type t = int end module F (M : SIG with type t = int) : SIG = M (* destructive type substitutions inside signatures *) module type SIG = sig type t val x : t end module type SIGINT = SIG with type t := int (* nesting *) module M : sig val f : 'a -> 'a type t = A | B of int | C of {x:int} module M : sig val f : 'a -> 'a type t = A | B of int | C of {x:int} end end = struct let f : type a. a -> a = fun x -> x type t = A | B of int | C of {x:int} module M : sig val f : 'a -> 'a type t = A | B of int | C of {x:int} end = struct let f : type a. a -> a = fun x -> x type t = A | B of int | C of {x:int} end end (* ATTRIBUTES AND COMMENTS *) exception[@my.attr "payld"] (*c*) E [@my.attr "payld"] (*c*) type[@my.attr "payld"] (*c*) t (*c*) = (*c*) int [@@my.attr "payld"] (*c*) type t = (int [@my.attr "payld"] (*c*)) type t = < x : int [@my.attr "payld"] ; (*c*) y (*c*) : (*c*) int (*c*) > type t = < x : int ; [@my.attr "payld"] (*c*) y (*c*) : (*c*) int (*c*) > type t = { x : int [@my.attr "payld"] ; (*c*) y (*c*) : (*c*) int (*c*) } type t = { x : int ; [@my.attr "payld"] (*c*) y (*c*) : (*c*) int (*c*) } type t = [ `A of int [@my.attr "payld"] (*c*) | (*c*) `B (*c*) of (*c*) int (*c*) ] type t = | A of int [@my.attr "payld"] (*c*) | (*c*) B (*c*) of (*c*) int (*c*) let _ : unit [@my.attr "payld"] (*c*) = () (* VARIOUS TRAPS *) (* items that have different meanings at type level and at value level *) let float ~float = float (* let-bound identifier * | optional named arg * | | local name for named arg * | | | TYPE OF NAMED ARG RETURN TYPE * | | | <------------> <---> * | | | named arg in type builtin type * | | | | builtin | variable in expr * | | | | | default value of optional arg * | | | | | | | | * v v v v v v v v *) let float ?float:(float:float:_->float=float)() : float = float ~float:0. let _ : < bool : bool * bool > = object method bool = 1 < 2 * 3, 4 * 5 > 6 end (* expression items that start with a colon *) let f r x = r := x let _ = 0 :: [] (* different uses of the syntax “name : type -> type” *) type t = ( x : int -> bool ) (* x is a label of type int *) type t = { x : int -> bool } (* x is a field of type int->bool *) let f x = ( x : int -> bool ) (* x is an expr of type int->bool *) let f = ( fun x -> x : int -> int ) (* x is an expr of type int *) let f (=) x = ( x = x : int -> bool ) (* totally irrealistic case *) (* return type of a `fun` *) let _ = fun x : int -> 42 (* int is the return type, `->` ends the type! *) let _ = fun (f : int -> int) : int -> 42 0707010000002D000081A400000000000000000000000165945CFF0000081E000000000000000000000000000000000000003200000000vim-ocaml-20240102T125911.c11dfa3/syntax/dune.vim" Vim syntax file " Language: Dune buildsystem " Maintainer: Markus Mottl <markus.mottl@gmail.com> " Anton Kochkov <anton.kochkov@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2023 Nov 24 - Add end-of-line strings (Samuel Hym) " 2019 Feb 27 - Add newer keywords to the syntax (Simon Cruanes) " 2018 May 8 - Check current_syntax (Kawahara Satoru) " 2018 Mar 29 - Extend jbuild syntax with more keywords (Petter A. Urkedal) " 2017 Sep 6 - Initial version (Etienne Millon) if exists("b:current_syntax") finish endif set syntax=lisp syn case match " The syn-iskeyword setting lacks #,? from the iskeyword setting here. " Clearing it avoids maintaining keyword characters in multiple places. syn iskeyword clear syn keyword lispDecl jbuild_version library executable executables rule ocamllex ocamlyacc menhir alias install syn keyword lispKey name public_name synopsis modules libraries wrapped syn keyword lispKey preprocess preprocessor_deps optional c_names cxx_names syn keyword lispKey install_c_headers modes no_dynlink self_build_stubs_archive syn keyword lispKey ppx_runtime_libraries virtual_deps js_of_ocaml link_flags syn keyword lispKey javascript_files flags ocamlc_flags ocamlopt_flags pps staged_pps syn keyword lispKey library_flags c_flags c_library_flags kind package action syn keyword lispKey deps targets locks fallback syn keyword lispKey inline_tests tests test names syn keyword lispAtom true false syn keyword lispFunc cat chdir copy# diff? echo run setenv syn keyword lispFunc ignore-stdout ignore-stderr ignore-outputs syn keyword lispFunc with-stdout-to with-stderr-to with-outputs-to syn keyword lispFunc write-file system bash syn region lispString start=+"\\[>|]+ end=+$+ contains=@Spell syn cluster lispBaseListCluster add=duneVar syn match duneVar '\${[@<^]}' containedin=lispSymbol syn match duneVar '\${\k\+\(:\k\+\)\?}' containedin=lispSymbol hi def link duneVar Identifier let b:current_syntax = "dune" 0707010000002E000081A400000000000000000000000165945CFF00000EA5000000000000000000000000000000000000003300000000vim-ocaml-20240102T125911.c11dfa3/syntax/oasis.vimif exists("b:current_syntax") finish endif syn keyword oasisSpecialFeatures ocamlbuild_more_args compiled_setup_ml pure_interface stdfiles_markdown syn keyword oasisTodo FIXME NOTE NOTES TODO XXX contained syn match oasisComment "#.*$" contains=oasisTodo,@Spell syn keyword oasisPlugin META DevFiles StdFiles syn match oasisOperator "(\|)\|>=\|,\|&&" syn match oasisVariable "$\w\+" syn match oasisVersion "\<\d\+\(.\(\d\)\+\)\+\>" syn region oasisString start=/"/ end=/"/ syntax keyword oasisSection Document Executable Flag Library Document Test SourceRepository syntax match oasisKey "OASISFormat:" syntax match oasisKey "OCamlVersion:" syntax match oasisKey "Copyrights:" syntax match oasisKey "Maintainers:" syntax match oasisKey "XStdFilesAUTHORS:" syntax match oasisKey "XStdFilesREADME:" syntax match oasisKey "FindlibVersion:" syntax match oasisKey "Name:" syntax match oasisKey "Version:" syntax match oasisKey "Synopsis:" syntax match oasisKey "Authors:" syntax match oasisKey "Homepage:" syntax match oasisKey "License:" syntax match oasisKey "LicenseFile:" syntax match oasisKey "BuildTools:" syntax match oasisKey "Plugins:" syntax match oasisKey "Description:" syntax match oasisKey "AlphaFeatures:" syntax match oasisKey "BetaFeatures:" syntax match oasisKey "PostConfCommand:" syntax match oasisKey "FilesAB:" syntax match oasisKey2 "\c\s\+Index\$\=:" syntax match oasisKey2 "\c\s\+Format\$\=:" syntax match oasisKey2 "\c\s\+TestTools\$\=:" syntax match oasisKey2 "\c\s\+Description\$\=:" syntax match oasisKey2 "\c\s\+Pack\$\=:" syntax match oasisKey2 "\c\s\+Default\$\=:" syntax match oasisKey2 "\c\s\+Path\$\=:" syntax match oasisKey2 "\c\s\+Findlibname\$\=:" syntax match oasisKey2 "\c\s\+Modules\$\=:" syntax match oasisKey2 "\c\s\+BuildDepends\$\=:" syntax match oasisKey2 "\c\s\+MainIs\$\=:" syntax match oasisKey2 "\c\s\+Install\$\=:" syntax match oasisKey2 "\c\s\+Custom\$\=:" syntax match oasisKey2 "\c\s\+InternalModules\$\=:" syntax match oasisKey2 "\c\s\+Build\$\=:" syntax match oasisKey2 "\c\s\+CompiledObject\$\=:" syntax match oasisKey2 "\c\s\+Title\$\=:" syntax match oasisKey2 "\c\s\+Type\$\=:" syntax match oasisKey2 "\c\s\+FindlibParent\$\=:" syntax match oasisKey2 "\c\s\+Command\$\=:" syntax match oasisKey2 "\c\s\+Run\$\=:" syntax match oasisKey2 "\c\s\+WorkingDirectory\$\=:" syntax match oasisKey2 "\c\s\+BuildTools+:" syntax match oasisKey2 "\c\s\+XMETARequires\$\=:" syntax match oasisKey2 "\c\s\+XMETADescription\$\=:" syntax match oasisKey2 "\c\s\+XMETAType\$\=:" syntax match oasisKey2 "\c\s\+XMETAExtraLines\$\=:" syntax match oasisKey2 "\c\s\+XMETAEnable\$\=:" syntax match oasisKey2 "\c\s\+InstallDir\$\=:" syntax match oasisKey2 "\c\s\+XOCamlbuildLibraries\$\=:" syntax match oasisKey2 "\c\s\+XOCamlbuildPath\$\=:" syntax match oasisKey2 "\c\s\+XOCamlbuildExtraArgs\$\=:" syntax match oasisKey2 "\c\s\+XOCamlbuildModules\$\=:" syntax match oasisKey2 "\c\s\+Type\$\=:" syntax match oasisKey2 "\c\s\+Location\$\=:" syntax match oasisKey2 "\c\s\+Branch\$\=:" syntax match oasisKey2 "\c\s\+Browser\$\=:" syntax match oasisKey2 "\c\s\+CSources\$\=:" syntax match oasisKey2 "\c\s\+CCLib\$\=:" syntax match oasisKey2 "\c\s\+CCOpt\$\=:" syntax match oasisKey2 "\c\s\+ByteOpt\$\=:" syntax match oasisKey2 "\c\s\+NativeOpt\$\=:" syntax match oasisKey2 "\c\s\+Tag\$\=:" highlight link oasisSection Keyword highlight link oasisKey Identifier highlight link oasisKey2 Function highlight link oasisTodo Todo highlight link oasisComment Comment highlight link oasisPlugin Type highlight link oasisSpecialFeatures Exception highlight link oasisOperator Operator highlight link oasisVariable Statement highlight link oasisString String highlight link oasisVersion Number let b:current_syntax = "oasis" 0707010000002F000081A400000000000000000000000165945CFF0000774F000000000000000000000000000000000000003300000000vim-ocaml-20240102T125911.c11dfa3/syntax/ocaml.vim" Vim syntax file " Language: OCaml " Filenames: *.ml *.mli *.mll *.mly " Maintainers: Markus Mottl <markus.mottl@gmail.com> " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> " Issac Trotts <ijtrotts@ucdavis.edu> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2019 Nov 05 - Accurate type highlighting (Maëlan) " 2018 Nov 08 - Improved highlighting of operators (Maëlan) " 2018 Apr 22 - Improved support for PPX (Andrey Popp) " 2018 Mar 16 - Remove raise, lnot and not from keywords (Étienne Millon, "copy") " 2017 Apr 11 - Improved matching of negative numbers (MM) " 2016 Mar 11 - Improved support for quoted strings (Glen Mével) " 2015 Aug 13 - Allow apostrophes in identifiers (Jonathan Chan, Einar Lielmanis) " 2015 Jun 17 - Added new "nonrec" keyword (MM) " A minor patch was applied to the official version so that object/end " can be distinguished from begin/end, which is used for indentation, " and folding. (David Baelde) " Quit when a syntax file was already loaded if exists("b:current_syntax") && b:current_syntax == "ocaml" finish endif let s:keepcpo = &cpo set cpo&vim " ' can be used in OCaml identifiers setlocal iskeyword+=' " ` is part of the name of polymorphic variants setlocal iskeyword+=` " OCaml is case sensitive. syn case match " Access to the method of an object syn match ocamlMethod "#" " Scripting directives syn match ocamlScript "^#\<\(quit\|labels\|warnings\|warn_error\|directory\|remove_directory\|cd\|load\|load_rec\|use\|mod_use\|install_printer\|remove_printer\|require\|list\|ppx\|principal\|predicates\|rectypes\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\|camlp4o\|camlp4r\|topfind_log\|topfind_verbose\)\>" " lowercase identifier - the standard way to match syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/ " Errors syn match ocamlBraceErr "}" syn match ocamlBrackErr "\]" syn match ocamlParenErr ")" syn match ocamlArrErr "|]" syn match ocamlCountErr "\<downto\>" syn match ocamlCountErr "\<to\>" if !exists("ocaml_revised") syn match ocamlDoErr "\<do\>" endif syn match ocamlDoneErr "\<done\>" syn match ocamlThenErr "\<then\>" " Error-highlighting of "end" without synchronization: " as keyword or as error (default) if exists("ocaml_noend_error") syn match ocamlKeyword "\<end\>" else syn match ocamlEndErr "\<end\>" endif " These keywords are only expected nested in constructions that are handled by " the type linter, so outside of type contexts we highlight them as errors: syn match ocamlKwErr "\<\(mutable\|nonrec\|of\|private\)\>" " Some convenient clusters syn cluster ocamlAllErrs contains=@ocamlAENoParen,ocamlParenErr syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr,ocamlKwErr syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlModTypePre,ocamlModRHS,ocamlFuncWith,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlFullMod,ocamlVal " Enclosing delimiters syn region ocamlNone transparent matchgroup=ocamlEncl start="(" matchgroup=ocamlEncl end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr syn region ocamlNone transparent matchgroup=ocamlEncl start="{" matchgroup=ocamlEncl end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr syn region ocamlNone transparent matchgroup=ocamlEncl start="\[" matchgroup=ocamlEncl end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr syn region ocamlNone transparent matchgroup=ocamlEncl start="\[|" matchgroup=ocamlEncl end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr " Comments syn region ocamlComment start="(\*" end="\*)" contains=@Spell,ocamlComment,ocamlTodo syn keyword ocamlTodo contained TODO FIXME XXX NOTE " Objects syn region ocamlEnd matchgroup=ocamlObject start="\<object\>" matchgroup=ocamlObject end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr " Blocks if !exists("ocaml_revised") syn region ocamlEnd matchgroup=ocamlKeyword start="\<begin\>" matchgroup=ocamlKeyword end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr endif " "for" syn region ocamlNone matchgroup=ocamlKeyword start="\<for\>" matchgroup=ocamlKeyword end="\<\(to\|downto\)\>" contains=ALLBUT,@ocamlContained,ocamlCountErr " "do" if !exists("ocaml_revised") syn region ocamlDo matchgroup=ocamlKeyword start="\<do\>" matchgroup=ocamlKeyword end="\<done\>" contains=ALLBUT,@ocamlContained,ocamlDoneErr endif " "if" syn region ocamlNone matchgroup=ocamlKeyword start="\<if\>" matchgroup=ocamlKeyword end="\<then\>" contains=ALLBUT,@ocamlContained,ocamlThenErr "" PPX nodes syn match ocamlPpxIdentifier /\(\[@\{1,3\}\)\@<=\w\+\(\.\w\+\)*/ syn region ocamlPpx matchgroup=ocamlPpxEncl start="\[@\{1,3\}" contains=TOP end="\]" "" Modules " "open" syn match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod " "include" syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod " "module" - somewhat complicated stuff ;-) " 2022-10: please document it? syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<_\|\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef syn region ocamlPreDef start="."me=e-1 end="[a-z:=)]\@=" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr nextgroup=ocamlModTypePre,ocamlModPreRHS syn region ocamlModParam start="(\*\@!" end=")" contained contains=ocamlGenMod,ocamlModParam,ocamlModParam1,ocamlSig,ocamlVal syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty syn match ocamlGenMod "()" contained skipwhite skipempty syn match ocamlModTypePre ":" contained skipwhite skipempty nextgroup=ocamlModTRWith,ocamlSig,ocamlFunctor,ocamlModTypeRestr,ocamlModTypeOf syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained syn match ocamlModPreRHS "=" contained skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod syn keyword ocamlKeyword val syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLCIdentifier end="\<\l\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment,ocamlFullMod skipwhite skipempty nextgroup=ocamlModTypePre syn region ocamlModRHS start="." end=". *\w\|([^*]"me=e-2 contained contains=ocamlComment skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod syn match ocamlFullMod "\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith syn region ocamlFuncWith start="([*)]\@!" end=")" contained contains=ocamlComment,ocamlWith,ocamlStruct skipwhite skipempty nextgroup=ocamlFuncWith syn region ocamlModTRWith start="(\*\@!" end=")" contained contains=@ocamlAENoParen,ocamlWith syn match ocamlWith "\<\(\u\(\w\|'\)* *\. *\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlWithRest syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@ocamlContained " "struct" syn region ocamlStruct matchgroup=ocamlStructEncl start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr " "sig" syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSigEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr " "functor" syn region ocamlFunctor start="\<functor\>" matchgroup=ocamlKeyword end="->" contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod skipwhite skipempty nextgroup=ocamlStruct,ocamlSig,ocamlFuncWith,ocamlFunctor " "module type" syn region ocamlModTypeOf start="\<module\s\+type\(\s\+of\)\=\>" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s+1 skipwhite skipempty nextgroup=ocamlFullMod " Quoted strings syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{\z\([a-z_]*\)|" end="|\z1}" contains=@Spell syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{%[a-z_]\+\(\.[a-z_]\+\)\?\( \z\([a-z_]\+\)\)\?|" end="|\z1}" contains=@Spell syn keyword ocamlKeyword and as assert class syn keyword ocamlKeyword else syn keyword ocamlKeyword external syn keyword ocamlKeyword in inherit initializer syn keyword ocamlKeyword lazy let match syn keyword ocamlKeyword method new syn keyword ocamlKeyword parser rec syn keyword ocamlKeyword try syn keyword ocamlKeyword virtual when while with " Keywords which are handled by the type linter: " as (within a type equation) " constraint exception mutable nonrec of private type " The `fun` keyword has special treatment because of the syntax `fun … : t -> e` " where `->` ends the type context rather than being part of it; to handle that, " we blacklist the ocamlTypeAnnot matchgroup, and we plug ocamlFunTypeAnnot " instead (later in this file, by using containedin=ocamlFun): syn region ocamlFun matchgroup=ocamlKeyword start='\<fun\>' matchgroup=ocamlArrow end='->' \ contains=ALLBUT,@ocamlContained,ocamlArrow,ocamlInfixOp,ocamlTypeAnnot if exists("ocaml_revised") syn keyword ocamlKeyword do value syn keyword ocamlBoolean True False else syn keyword ocamlKeyword function syn keyword ocamlBoolean true false endif syn match ocamlEmptyConstructor "(\s*)" syn match ocamlEmptyConstructor "\[\s*\]" syn match ocamlEmptyConstructor "\[|\s*>|]" syn match ocamlEmptyConstructor "\[<\s*>\]" syn match ocamlConstructor "\u\(\w\|'\)*\>" " Polymorphic variants syn match ocamlConstructor "`\w\(\w\|'\)*\>" " Module prefix syn match ocamlModPath "\u\(\w\|'\)* *\."he=e-1 syn match ocamlCharacter "'\\\d\d\d'\|'\\[\'ntbr]'\|'.'" syn match ocamlCharacter "'\\x\x\x'" syn match ocamlCharErr "'\\\d\d'\|'\\\d'" syn match ocamlCharErr "'\\[^\'ntbr]'" syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell syn match ocamlAnyVar "\<_\>" syn match ocamlKeyChar "|]\@!" syn match ocamlKeyChar ";" syn match ocamlKeyChar "\~" syn match ocamlKeyChar "?" " NOTE: for correct precedence, the rule for ";;" must come after that for ";" syn match ocamlTopStop ";;" "" Operators " The grammar of operators is found there: " https://caml.inria.fr/pub/docs/manual-ocaml/names.html#operator-name " https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:ext-ops " https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:index-operators " = is both an operator name and a keyword, we let the user choose how " to display it (has to be declared before regular infix operators): syn match ocamlEqual "=" " Custom indexing operators: syn region ocamlIndexing matchgroup=ocamlIndexingOp \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*(" \ end=")\(\_s*<-\)\?" \ contains=ALLBUT,@ocamlContained,ocamlParenErr syn region ocamlIndexing matchgroup=ocamlIndexingOp \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*\[" \ end="]\(\_s*<-\)\?" \ contains=ALLBUT,@ocamlContained,ocamlBrackErr syn region ocamlIndexing matchgroup=ocamlIndexingOp \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*{" \ end="}\(\_s*<-\)\?" \ contains=ALLBUT,@ocamlContained,ocamlBraceErr " Extension operators (has to be declared before regular infix operators): syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+" " Infix and prefix operators: syn match ocamlPrefixOp "![~?!.:|&$%<=>@^*/+-]*" syn match ocamlPrefixOp "[~?][~?!.:|&$%<=>@^*/+-]\+" syn match ocamlInfixOp "[&$%<>@^*/+-][~?!.:|&$%<=>@^*/+-]*" syn match ocamlInfixOp "[|=][~?!.:|&$%<=>@^*/+-]\+" syn match ocamlInfixOp "#[~?!.:|&$%<=>@^*/+-]\+#\@!" syn match ocamlInfixOp "!=[~?!.:|&$%<=>@^*/+-]\@!" syn keyword ocamlInfixOpKeyword asr land lor lsl lsr lxor mod or " := is technically an infix operator, but we may want to show it as a keyword " (somewhat analogously to = for let‐bindings and <- for assignations): syn match ocamlRefAssign ":=" " :: is technically not an operator, but we may want to show it as such: syn match ocamlCons "::" " -> and <- are keywords, not operators (but can appear in longer operators): syn match ocamlArrow "->[~?!.:|&$%<=>@^*/+-]\@!" if exists("ocaml_revised") syn match ocamlErr "<-[~?!.:|&$%<=>@^*/+-]\@!" else syn match ocamlKeyChar "<-[~?!.:|&$%<=>@^*/+-]\@!" endif " Script shebang (has to be declared after operators) syn match ocamlShebang "\%1l^#!.*$" syn match ocamlNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>" syn match ocamlNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>" syn match ocamlNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>" syn match ocamlNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>" syn match ocamlFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>" " Labels syn match ocamlLabel "[~?]\(\l\|_\)\(\w\|'\)*:\?" syn region ocamlLabel transparent matchgroup=ocamlLabel start="[~?](\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "" Type contexts " How we recognize type contexts is explained in `type-linter-notes.md` " and a test suite is found in `type-linter-test.ml`. " " ocamlTypeExpr is the cluster of things that can make up a type expression " (in a loose sense, e.g. the “as” keyword and universal quantification are " included). Regions containing a type expression use it like this: " " contains=@ocamlTypeExpr,... " " ocamlTypeContained is the cluster of things that can be found in a type " expression or a type definition. It is not expected to be used in any region, " it exists solely for throwing things in it that should not pollute the main " linter. " " Both clusters are filled in incrementally. Every match group that is not to be " found at the main level must be declared as “contained” and added to either " ocamlTypeExpr or ocamlTypeContained. " " In these clusters we don’t put generic things that can also be found elswhere, " i.e. ocamlComment and ocamlPpx, because everything that is in these clusters " is also put in ocamlContained and thus ignored by the main linter. "syn cluster ocamlTypeExpr contains= syn cluster ocamlTypeContained contains=@ocamlTypeExpr syn cluster ocamlContained add=@ocamlTypeContained " We’ll use a “catch-all” highlighting group to show as error anything that is " not matched more specifically; we don’t want spaces to be reported as errors " (different background color), so we just catch them here: syn cluster ocamlTypeExpr add=ocamlTypeBlank syn match ocamlTypeBlank contained "\_s\+" hi link ocamlTypeBlank NONE " NOTE: Carefully avoid catching "(*" here. syn cluster ocamlTypeExpr add=ocamlTypeParen syn region ocamlTypeParen contained transparent \ matchgroup=ocamlEncl start="(\*\@!" \ matchgroup=ocamlEncl end=")" \ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx syn cluster ocamlTypeExpr add=ocamlTypeKeyChar,ocamlTypeAs syn match ocamlTypeKeyChar contained "->" syn match ocamlTypeKeyChar contained "\*" syn match ocamlTypeKeyChar contained "#" syn match ocamlTypeKeyChar contained "," syn match ocamlTypeKeyChar contained "\." syn keyword ocamlTypeAs contained as hi link ocamlTypeAs ocamlKeyword syn cluster ocamlTypeExpr add=ocamlTypeVariance syn match ocamlTypeVariance contained "[-+!]\ze *\('\|\<_\>\)" syn match ocamlTypeVariance contained "[-+] *!\+\ze *\('\|\<_\>\)" syn match ocamlTypeVariance contained "! *[-+]\+\ze *\('\|\<_\>\)" syn cluster ocamlTypeContained add=ocamlTypeEq syn match ocamlTypeEq contained "[+:]\?=" hi link ocamlTypeEq ocamlKeyChar syn cluster ocamlTypeExpr add=ocamlTypeVar,ocamlTypeConstr,ocamlTypeAnyVar,ocamlTypeBuiltin syn match ocamlTypeVar contained "'\(\l\|_\)\(\w\|'\)*\>" syn match ocamlTypeConstr contained "\<\(\l\|_\)\(\w\|'\)*\>" " NOTE: for correct precedence, the rule for the wildcard (ocamlTypeAnyVar) " must come after the rule for type constructors (ocamlTypeConstr). syn match ocamlTypeAnyVar contained "\<_\>" " NOTE: For correct precedence, these builtin names must occur after the rule " for type constructors (ocamlTypeConstr) but before the rule for non-optional " labeled arguments (ocamlTypeLabel). For the latter to take precedence over " these builtin names, we use “syn match” here instead of “syn keyword”. syn match ocamlTypeBuiltin contained "\<array\>" syn match ocamlTypeBuiltin contained "\<bool\>" syn match ocamlTypeBuiltin contained "\<bytes\>" syn match ocamlTypeBuiltin contained "\<char\>" syn match ocamlTypeBuiltin contained "\<exn\>" syn match ocamlTypeBuiltin contained "\<float\>" syn match ocamlTypeBuiltin contained "\<format\>" syn match ocamlTypeBuiltin contained "\<format4\>" syn match ocamlTypeBuiltin contained "\<format6\>" syn match ocamlTypeBuiltin contained "\<in_channel\>" syn match ocamlTypeBuiltin contained "\<int\>" syn match ocamlTypeBuiltin contained "\<int32\>" syn match ocamlTypeBuiltin contained "\<int64\>" syn match ocamlTypeBuiltin contained "\<lazy_t\>" syn match ocamlTypeBuiltin contained "\<list\>" syn match ocamlTypeBuiltin contained "\<nativeint\>" syn match ocamlTypeBuiltin contained "\<option\>" syn match ocamlTypeBuiltin contained "\<out_channel\>" syn match ocamlTypeBuiltin contained "\<ref\>" syn match ocamlTypeBuiltin contained "\<result\>" syn match ocamlTypeBuiltin contained "\<scanner\>" syn match ocamlTypeBuiltin contained "\<string\>" syn match ocamlTypeBuiltin contained "\<unit\>" syn cluster ocamlTypeExpr add=ocamlTypeLabel syn match ocamlTypeLabel contained "?\?\(\l\|_\)\(\w\|'\)*\_s*:[>=]\@!" hi link ocamlTypeLabel ocamlLabel " Object type syn cluster ocamlTypeExpr add=ocamlTypeObject syn region ocamlTypeObject contained \ matchgroup=ocamlEncl start="<" \ matchgroup=ocamlEncl end=">" \ contains=ocamlTypeObjectDots,ocamlLCIdentifier,ocamlTypeObjectAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx hi link ocamlTypeObject ocamlTypeCatchAll syn cluster ocamlTypeContained add=ocamlTypeObjectDots syn match ocamlTypeObjectDots contained "\.\." hi link ocamlTypeObjectDots ocamlKeyChar syn cluster ocamlTypeContained add=ocamlTypeObjectAnnot syn region ocamlTypeObjectAnnot contained \ matchgroup=ocamlKeyChar start=":" \ matchgroup=ocamlKeyChar end=";\|>\@=" \ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx hi link ocamlTypeObjectAnnot ocamlTypeCatchAll " Record type definition syn cluster ocamlTypeContained add=ocamlTypeRecordDecl syn region ocamlTypeRecordDecl contained \ matchgroup=ocamlEncl start="{" \ matchgroup=ocamlEncl end="}" \ contains=ocamlTypeMutable,ocamlLCIdentifier,ocamlTypeRecordAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx hi link ocamlTypeRecordDecl ocamlTypeCatchAll syn cluster ocamlTypeContained add=ocamlTypeMutable syn keyword ocamlTypeMutable contained mutable hi link ocamlTypeMutable ocamlKeyword syn cluster ocamlTypeContained add=ocamlTypeRecordAnnot syn region ocamlTypeRecordAnnot contained \ matchgroup=ocamlKeyChar start=":" \ matchgroup=ocamlKeyChar end=";\|}\@=" \ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx hi link ocamlTypeRecordAnnot ocamlTypeCatchAll " Polymorphic variant types " NOTE: Carefully avoid catching "[@" here. syn cluster ocamlTypeExpr add=ocamlTypeVariant syn region ocamlTypeVariant contained \ matchgroup=ocamlEncl start="\[>" start="\[<" start="\[@\@!" \ matchgroup=ocamlEncl end="\]" \ contains=ocamlTypeVariantKeyChar,ocamlTypeVariantConstr,ocamlTypeVariantAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx hi link ocamlTypeVariant ocamlTypeCatchAll syn cluster ocamlTypeContained add=ocamlTypeVariantKeyChar syn match ocamlTypeVariantKeyChar contained "|" syn match ocamlTypeVariantKeyChar contained ">" hi link ocamlTypeVariantKeyChar ocamlKeyChar syn cluster ocamlTypeContained add=ocamlTypeVariantConstr syn match ocamlTypeVariantConstr contained "`\w\(\w\|'\)*\>" hi link ocamlTypeVariantConstr ocamlConstructor syn cluster ocamlTypeContained add=ocamlTypeVariantAnnot syn region ocamlTypeVariantAnnot contained \ matchgroup=ocamlKeyword start="\<of\>" \ matchgroup=ocamlKeyChar end="|\|>\|\]\@=" \ contains=@ocamlTypeExpr,ocamlTypeAmp,ocamlComment,ocamlPpx hi link ocamlTypeVariantAnnot ocamlTypeCatchAll syn cluster ocamlTypeContained add=ocamlTypeAmp syn match ocamlTypeAmp contained "&" hi link ocamlTypeAmp ocamlTypeKeyChar " Sum type definition syn cluster ocamlTypeContained add=ocamlTypeSumDecl syn region ocamlTypeSumDecl contained \ matchgroup=ocamlTypeSumBar start="|" \ matchgroup=ocamlTypeSumConstr start="\<\u\(\w\|'\)*\>" \ matchgroup=ocamlTypeSumConstr start="\<false\>" start="\<true\>" \ matchgroup=ocamlTypeSumConstr start="(\_s*)" start="\[\_s*]" start="(\_s*::\_s*)" \ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\|=\)\@=" \ matchgroup=NONE end="\(\<and\>\)\@=" \ contains=ocamlTypeSumBar,ocamlTypeSumConstr,ocamlTypeSumAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx hi link ocamlTypeSumDecl ocamlTypeCatchAll syn cluster ocamlTypeContained add=ocamlTypeSumBar syn match ocamlTypeSumBar contained "|" hi link ocamlTypeSumBar ocamlKeyChar syn cluster ocamlTypeContained add=ocamlTypeSumConstr syn match ocamlTypeSumConstr contained "\<\u\(\w\|'\)*\>" syn match ocamlTypeSumConstr contained "\<false\>" syn match ocamlTypeSumConstr contained "\<true\>" syn match ocamlTypeSumConstr contained "(\_s*)" syn match ocamlTypeSumConstr contained "\[\_s*]" syn match ocamlTypeSumConstr contained "(\_s*::\_s*)" hi link ocamlTypeSumConstr ocamlConstructor syn cluster ocamlTypeContained add=ocamlTypeSumAnnot syn region ocamlTypeSumAnnot contained \ matchgroup=ocamlKeyword start="\<of\>" \ matchgroup=ocamlKeyChar start=":" \ matchgroup=NONE end="|\@=" \ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@=" \ matchgroup=NONE end="\(\<and\>\)\@=" \ contains=@ocamlTypeExpr,ocamlTypeRecordDecl,ocamlComment,ocamlPpx hi link ocamlTypeSumAnnot ocamlTypeCatchAll " Type context opened by “type” (type definition), “constraint” (type " constraint) and “exception” (exception definition) syn region ocamlTypeDef \ matchgroup=ocamlKeyword start="\<type\>\(\_s\+\<nonrec\>\)\?\|\<constraint\>\|\<exception\>" \ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@=" \ contains=@ocamlTypeExpr,ocamlTypeEq,ocamlTypePrivate,ocamlTypeDefDots,ocamlTypeRecordDecl,ocamlTypeSumDecl,ocamlTypeDefAnd,ocamlComment,ocamlPpx hi link ocamlTypeDef ocamlTypeCatchAll syn cluster ocamlTypeContained add=ocamlTypePrivate syn keyword ocamlTypePrivate contained private hi link ocamlTypePrivate ocamlKeyword syn cluster ocamlTypeContained add=ocamlTypeDefAnd syn keyword ocamlTypeDefAnd contained and hi link ocamlTypeDefAnd ocamlKeyword syn cluster ocamlTypeContained add=ocamlTypeDefDots syn match ocamlTypeDefDots contained "\.\." hi link ocamlTypeDefDots ocamlKeyChar " When "exception" is preceded by "with", "|" or "(", that’s not an exception " definition but an exception pattern; we simply highlight the keyword without " starting a type context. " NOTE: These rules must occur after that for "exception". syn match ocamlKeyword "\<with\_s\+exception\>"lc=4 syn match ocamlKeyword "|\_s*exception\>"lc=1 syn match ocamlKeyword "(\_s*exception\>"lc=1 " Type context opened by “:” (countless kinds of type annotations) and “:>” " (type coercions) syn region ocamlTypeAnnot matchgroup=ocamlKeyChar start=":\(>\|\_s*type\>\|[>:=]\@!\)" \ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@=" \ matchgroup=NONE end="\(;\|}\)\@=" \ matchgroup=NONE end="\(=\|:>\)\@=" \ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx hi link ocamlTypeAnnot ocamlTypeCatchAll " Type annotation that gives the return type of a `fun` keyword " (the type context is ended by `->`) syn cluster ocamlTypeContained add=ocamlFunTypeAnnot syn region ocamlFunTypeAnnot contained containedin=ocamlFun \ matchgroup=ocamlKeyChar start=":" \ matchgroup=NONE end="\(->\)\@=" \ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx hi link ocamlFunTypeAnnot ocamlTypeCatchAll " Module paths (including functors) in types. " NOTE: This rule must occur after the rule for ocamlTypeSumDecl as it must take " precedence over it (otherwise the module name would be mistakenly highlighted " as a constructor). " NOTE: Carefully avoid catching "(*" here. syn cluster ocamlTypeExpr add=ocamlTypeModPath syn match ocamlTypeModPath contained "\<\u\(\w\|'\)*\_s*\." syn region ocamlTypeModPath contained transparent \ matchgroup=ocamlModPath start="\<\u\(\w\|'\)*\_s*(\*\@!" \ matchgroup=ocamlModPath end=")\_s*\." \ contains=ocamlTypeDotlessModPath,ocamlTypeBlank,ocamlComment,ocamlPpx hi link ocamlTypeModPath ocamlModPath syn cluster ocamlTypeContained add=ocamlTypeDotlessModPath syn match ocamlTypeDotlessModPath contained "\<\u\(\w\|'\)*\_s*\.\?" syn region ocamlTypeDotlessModPath contained transparent \ matchgroup=ocamlModPath start="\<\u\(\w\|'\)*\_s*(\*\@!" \ matchgroup=ocamlModPath end=")\_s*\.\?" \ contains=ocamlTypeDotlessModPath,ocamlTypeBlank,ocamlComment,ocamlPpx hi link ocamlTypeDotlessModPath ocamlTypeModPath """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Synchronization syn sync minlines=50 syn sync maxlines=500 if !exists("ocaml_revised") syn sync match ocamlDoSync grouphere ocamlDo "\<do\>" syn sync match ocamlDoSync groupthere ocamlDo "\<done\>" endif if exists("ocaml_revised") syn sync match ocamlEndSync grouphere ocamlEnd "\<\(object\)\>" else syn sync match ocamlEndSync grouphere ocamlEnd "\<\(begin\|object\)\>" endif syn sync match ocamlEndSync groupthere ocamlEnd "\<end\>" syn sync match ocamlStructSync grouphere ocamlStruct "\<struct\>" syn sync match ocamlStructSync groupthere ocamlStruct "\<end\>" syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>" syn sync match ocamlSigSync groupthere ocamlSig "\<end\>" " Define the default highlighting. hi def link ocamlBraceErr Error hi def link ocamlBrackErr Error hi def link ocamlParenErr Error hi def link ocamlArrErr Error hi def link ocamlCountErr Error hi def link ocamlDoErr Error hi def link ocamlDoneErr Error hi def link ocamlEndErr Error hi def link ocamlThenErr Error hi def link ocamlKwErr Error hi def link ocamlCharErr Error hi def link ocamlErr Error hi def link ocamlComment Comment hi def link ocamlShebang ocamlComment hi def link ocamlModPath Include hi def link ocamlObject Include hi def link ocamlModule Include hi def link ocamlModParam1 Include hi def link ocamlGenMod Include hi def link ocamlFullMod Include hi def link ocamlFuncWith Include hi def link ocamlModParam Include hi def link ocamlModTypeRestr Include hi def link ocamlWith Include hi def link ocamlMTDef Include hi def link ocamlSigEncl ocamlModule hi def link ocamlStructEncl ocamlModule hi def link ocamlScript Include hi def link ocamlConstructor Constant hi def link ocamlEmptyConstructor ocamlConstructor hi def link ocamlVal Keyword hi def link ocamlModTypePre Keyword hi def link ocamlModPreRHS Keyword hi def link ocamlFunctor Keyword hi def link ocamlModTypeOf Keyword hi def link ocamlKeyword Keyword hi def link ocamlMethod Include hi def link ocamlArrow Keyword hi def link ocamlKeyChar Keyword hi def link ocamlAnyVar Keyword hi def link ocamlTopStop Keyword hi def link ocamlRefAssign ocamlKeyChar hi def link ocamlEqual ocamlKeyChar hi def link ocamlCons ocamlInfixOp hi def link ocamlPrefixOp ocamlOperator hi def link ocamlInfixOp ocamlOperator hi def link ocamlExtensionOp ocamlOperator hi def link ocamlIndexingOp ocamlOperator if exists("ocaml_highlight_operators") hi def link ocamlInfixOpKeyword ocamlOperator hi def link ocamlOperator Operator else hi def link ocamlInfixOpKeyword Keyword endif hi def link ocamlBoolean Boolean hi def link ocamlCharacter Character hi def link ocamlNumber Number hi def link ocamlFloat Float hi def link ocamlString String hi def link ocamlQuotedStringDelim Identifier hi def link ocamlLabel Identifier " Type linting groups that the user can customize: " - ocamlTypeCatchAll: anything in a type context that is not caught by more " specific rules (in principle, this should only match syntax errors) " - ocamlTypeConstr: type constructors " - ocamlTypeBuiltin: builtin type constructors (like int or list) " - ocamlTypeVar: type variables ('a) " - ocamlTypeAnyVar: wildcard (_) " - ocamlTypeVariance: variance and injectivity indications (+'a, !'a) " - ocamlTypeKeyChar: symbols such as -> and * " Default values below mimick the behavior before the type linter was " implemented, but now we can do better. :-) hi def link ocamlTypeCatchAll Error hi def link ocamlTypeConstr NONE hi def link ocamlTypeBuiltin Type hi def link ocamlTypeVar NONE hi def link ocamlTypeAnyVar NONE hi def link ocamlTypeVariance ocamlKeyChar hi def link ocamlTypeKeyChar ocamlKeyChar hi def link ocamlTodo Todo hi def link ocamlEncl Keyword hi def link ocamlPpxEncl ocamlEncl let b:current_syntax = "ocaml" let &cpo = s:keepcpo unlet s:keepcpo " vim: ts=8 07070100000030000081A400000000000000000000000165945CFF00000575000000000000000000000000000000000000003D00000000vim-ocaml-20240102T125911.c11dfa3/syntax/ocamlbuild_tags.vimif exists("b:current_syntax") finish endif syn keyword ocamlbuild_tagsOperator ",\|:\|-\|(\|)" syn keyword ocamlbuild_tagsTodo FIXME NOTE NOTES TODO XXX contained syn keyword ocamlbuild_tagsKeyword1 true annot bin_annot traverse not_hygienic custom package include debug principal strict_sequence strict_formats short_paths or no_alias_deps safe_string warn syntax thread syn match ocamlbuild_tagsKeyword2 "for-pack" syn match ocamlbuild_tagsOr "or" contained syn region ocamlbuild_tagsString start=/"/ end=/"/ syn region ocamlbuild_tagsPattern start=/</ end=/>/ contains=ocamlbuild_tagsGlob,ocamlbuild_tagsAlt,ocamlbuild_tagsOr syn match ocamlbuild_tagsComment "#.*$" contains=ocamlbuild_tagsTodo,@Spell syn match ocamlbuild_tagsGlob "\*\|\*\*\|\/" contained syn match ocamlbuild_tagsComma "," syn region ocamlbuild_tagsAlt start=/{/ end=/}/ contains=ocamlbuild_tagsComma contained syn match ocamlbuild_tagsFindlibPkg "\vpkg_[a-zA-Z_.]+" hi! link ocamlbuild_tagsKeyword1 Keyword hi! link ocamlbuild_tagsKeyword2 Keyword hi! link ocamlbuild_tagsOr Keyword hi! link ocamlbuild_tagsString String hi! link ocamlbuild_tagsPattern Statement hi! link ocamlbuild_tagsGlob Operator hi! link ocamlbuild_tagsOperator Operator hi! link ocamlbuild_tagsComma Operator hi! link ocamlbuild_tagsComment Comment hi link ocamlbuild_tagsFindlibPkg Identifier let b:current_syntax = "ocamlbuild_tags" 07070100000031000081A400000000000000000000000165945CFF000005A3000000000000000000000000000000000000003600000000vim-ocaml-20240102T125911.c11dfa3/syntax/ocpbuild.vim" Vim syntax file " Language: ocp-build files " Maintainer: Florent Monnier " Latest Revision: 14 September 2013 if exists("b:current_syntax") finish endif syn keyword ocpKeywords begin end pack syn keyword ocpKeywords if then else syn keyword ocpBlockKind library syntax objects program test syn keyword ocpFields files generated dirname archive syn keyword ocpFields requires bundle syn keyword ocpFields tests test_dir test_args test_benchmark syn keyword ocpFields bytecomp bytelink link syn keyword ocpFields has_asm nopervasives sort syn keyword ocpFields comp ccopt byte has_byte syn keyword ocpFields version authors license copyright syn keyword ocpFields lib_files install installed syn keyword ocpPreProc test_exit ocp2ml env_strings syn keyword ocpPreProc ocaml_major_version syn keyword ocpPreProc system " Strings syn region ocpString start=+"+ end=+"+ " Comments syn keyword ocpTodo TODO XXX FIXME BUG contained syn region ocpComment start="(\*" end="\*)" contains=ocpTodo " Usual Values syn keyword ocpNumber None syn keyword ocpNumber true syn keyword ocpNumber false hi def link ocpTodo Todo hi def link ocpComment Comment hi def link ocpString String hi def link ocpBlockKind Identifier hi def link ocpNumber Number hi def link ocpFields Structure hi def link ocpKeywords Keyword hi def link ocpPreProc PreProc let b:current_syntax = "ocpbuild" 07070100000032000081A400000000000000000000000165945CFF000005D1000000000000000000000000000000000000003A00000000vim-ocaml-20240102T125911.c11dfa3/syntax/ocpbuildroot.vim" Vim syntax file " Language: ocp-build.root files " Maintainer: Florent Monnier " Latest Revision: 14 September 2013 if exists("b:current_syntax") finish endif " Keywords syn keyword ocprKeywords digest syn keyword ocprKeywords verbosity syn keyword ocprKeywords njobs syn keyword ocprKeywords autoscan syn keyword ocprKeywords bytecode syn keyword ocprKeywords native syn keyword ocprKeywords meta_dirnames syn keyword ocprKeywords install_destdir syn keyword ocprKeywords install_bin syn keyword ocprKeywords install_lib syn keyword ocprKeywords install_data syn keyword ocprKeywords install_doc syn keyword ocprKeywords ocamllib syn keyword ocprKeywords use_ocamlfind syn keyword ocprKeywords ocpbuild_version syn keyword ocprKeywords project_external_dirs syn keyword ocprKeywords files syn keyword ocprKeywords install_docdir syn keyword ocprKeywords install_datadir syn keyword ocprKeywords install_libdir syn keyword ocprKeywords install_bindir syn keyword ocprKeywords install_metadir syn keyword ocprNumber None syn keyword ocprNumber true syn keyword ocprNumber false " Strings syn match ocprString "\".\{-}\"" " Comments syn keyword ocprTodo TODO XXX FIXME BUG contained syn region ocprComment start="(\*" end="\*)" contains=ocprTodo hi def link ocprKeywords Keyword hi def link ocprTodo Todo hi def link ocprComment Comment hi def link ocprString String hi def link ocprNumber Number let b:current_syntax = "ocpbuildroot" 07070100000033000081A400000000000000000000000165945CFF00001868000000000000000000000000000000000000003300000000vim-ocaml-20240102T125911.c11dfa3/syntax/omake.vim" Vim syntax file " Language: OMakefile " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if exists("b:current_syntax") finish endif syn match omakeRuleOption +:\(optional\|exists\|effects\|scanner\|value\):+ syn match omakeKeyword "^\s*\(case\|catch\|class\|declare\|default\|do\|elseif\|else\|export\|extends\|finally\|if\|import\|include\|match\|open\|raise\|return\|section\|switch\|try\|value\|when\|while\)\s*" syn match omakeOperator "\[\]\|=\|+=" " some special characters syn match makeSpecial "^\s*[@+-]\+" syn match makeNextLine "\\\n\s*" " some directives syn match makeInclude "^ *[-s]\=include" syn match makeStatement "^ *vpath" syn match makeExport "^ *\(export\|unexport\)\>" syn match makeSection "^\s*section\s*$" syn match makeOverride "^ *override" hi link makeOverride makeStatement hi link makeExport makeStatement hi link makeSection makeStatement " Koehler: catch unmatched define/endef keywords. endef only matches it is by itself on a line syn region makeDefine start="^\s*define\s" end="^\s*endef\s*$" contains=makeStatement,makeIdent,makeDefine " Microsoft Makefile specials syn case ignore syn match makeInclude "^! *include" syn case match " identifiers syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent,makeSString,makeDString,omakeDoubleQuoteString,omakeSingleQuoteString syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent,makeSString,makeDString,omakeDoubleQuoteString,omakeSingleQuoteString syn match makeIdent "\$\$\w*" syn match makeIdent "\$[^({]" syn match makeIdent "^ *\a\w*\s*[:+?!*]="me=e-2 syn match makeIdent "^ *\a\w*\s*="me=e-1 syn match makeIdent "%" " Makefile.in variables syn match makeConfig "@[A-Za-z0-9_]\+@" " make targets " syn match makeSpecTarget "^\.\(STATIC\|PHONY\|DEFAULT\|MEMO\|INCLUDE\|ORDER\|SCANNER\|SUBDIRS\|BUILD_BEGIN\|BUILD_FAILURE\|BUILD_SUCCESS\|BUILDORDER\)\>" syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 nextgroup=makeSource syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 nextgroup=makeSource syn region makeTarget transparent matchgroup=makeTarget start="^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands syn match makeTarget "^[A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget skipnl nextgroup=makeCommands syn region makeSpecTarget transparent matchgroup=makeSpecTarget start="^\s*\.\(STATIC\|PHONY\|DEFAULT\|MEMO\|INCLUDE\|ORDER\|SCANNER\|SUBDIRS\|BUILD_BEGIN\|BUILD_FAILURE\|BUILD_SUCCESS\|BUILDORDER\)\>\s*:\{1,2}[^:=]"rs=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands syn match makeSpecTarget "^\s*\.\(STATIC\|PHONY\|DEFAULT\|MEMO\|INCLUDE\|ORDER\|SCANNER\|SUBDIRS\|BUILD_BEGIN\|BUILD_FAILURE\|BUILD_SUCCESS\|BUILDORDER\)\>\s*::\=\s*$" contains=makeIdent skipnl nextgroup=makeCommands syn region makeCommands start=";"hs=s+1 start="^\t" end="^[^\t#]"me=e-1,re=e-1 end="^$" contained contains=makeCmdNextLine,makeSpecial,makeComment,makeIdent,makeDefine,makeDString,makeSString syn match makeCmdNextLine "\\\n."he=e-1 contained " Statements / Functions (GNU make) syn match makeStatement contained "(\(subst\|abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1 " Comment syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo syn match makeComment "#$" contains=@Spell syn keyword makeTodo TODO FIXME XXX contained " match escaped quotes and any other escaped character " except for $, as a backslash in front of a $ does " not make it a standard character, but instead it will " still act as the beginning of a variable " The escaped char is not highlighted currently syn match makeEscapedChar "\\[^$]" syn match omakeCallExpr "\$(\h[a-zA-Z0-9_-]*\s\+[^(]\+)" contains=@omakeExpr syn match omakeVar "\$(\h[a-zA-Z0-9_-]*)" syn cluster omakeExpr contains=omakeVar,omakeCallExpr syn region omakeSingleQuoteString start=+\$'+ skip=+[^']+ end=+'+ syn region omakeDoubleQuoteString start=+\$"+ skip=+\\.+ end=+"+ syn region omakeDoubleQuoteString start=+\$"""+ skip=+\\.+ end=+"""+ syn region makeDString start=+\(\\\)\@<!"+ skip=+\\.+ end=+"+ contains=makeIdent syn region makeSString start=+\(\\\)\@<!'+ skip=+\\.+ end=+'+ contains=makeIdent syn region makeBString start=+\(\\\)\@<!`+ skip=+\\.+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine " Syncing syn sync minlines=20 maxlines=200 " Sync on Make command block region: When searching backwards hits a line that " can't be a command or a comment, use makeCommands if it looks like a target, " NONE otherwise. syn sync match makeCommandSync groupthere NONE "^[^\t#]" syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]" syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}\s*$" hi def link makeNextLine makeSpecial hi def link makeCmdNextLine makeSpecial hi def link makeSpecTarget Statement hi def link makeCommands Number hi def link makeImplicit Function hi def link makeTarget Function hi def link makeInclude Include hi def link makeStatement Statement hi def link makeIdent Identifier hi def link makeSpecial Special hi def link makeComment Comment hi def link makeDString String hi def link makeSString String hi def link makeBString Function hi def link makeError Error hi def link makeTodo Todo hi def link makeDefine Define hi def link makeConfig PreCondit hi def link omakeOperator Operator hi def link omakeDoubleQuoteString String hi def link omakeSingleQuoteString String hi def link omakeVar Identifier hi def link omakeCallExpr Statement hi def link omakeKeyword Keyword hi def link omakeRuleOption Type let b:current_syntax = "omake" " vim: ts=8 07070100000034000081A400000000000000000000000165945CFF0000094E000000000000000000000000000000000000003200000000vim-ocaml-20240102T125911.c11dfa3/syntax/opam.vim" Vim syntax file " Language: opam - OCaml package manager " Maintainer: Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2020 Dec 31 - Added header (Markus Mottl) if exists("b:current_syntax") finish endif " need %{vars}% " env: [[CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"]] syn iskeyword a-z,A-Z,- syn keyword opamKeyword1 author syn keyword opamKeyword1 authors syn keyword opamKeyword1 available syn keyword opamKeyword1 bug-reports syn keyword opamKeyword1 build syn keyword opamKeyword1 build-env syn keyword opamKeyword1 conflict-class syn keyword opamKeyword1 conflicts syn keyword opamKeyword1 depends syn keyword opamKeyword1 depexts syn keyword opamKeyword1 depopts syn keyword opamKeyword1 description syn keyword opamKeyword1 dev-repo syn keyword opamKeyword1 doc syn keyword opamKeyword1 extra-files syn keyword opamKeyword1 features syn keyword opamKeyword1 flags syn keyword opamKeyword1 homepage syn keyword opamKeyword1 install syn keyword opamKeyword1 libraries syn keyword opamKeyword1 license syn keyword opamKeyword1 maintainer syn keyword opamKeyword1 messages syn keyword opamKeyword1 name syn keyword opamKeyword1 opam-version syn keyword opamKeyword1 patches syn keyword opamKeyword1 pin-depends syn keyword opamKeyword1 post-messages syn keyword opamKeyword1 remove syn keyword opamKeyword1 run-test syn keyword opamKeyword1 setenv syn keyword opamKeyword1 substs syn keyword opamKeyword1 synopsis syn keyword opamKeyword1 syntax syn keyword opamKeyword1 tags syn keyword opamKeyword1 version syn keyword opamTodo FIXME NOTE NOTES TODO XXX contained syn match opamComment "#.*$" contains=opamTodo,@Spell syn match opamOperator ">\|<\|=\|<=\|>=" syn match opamUnclosedInterpolate "%{[^ "]*" contained syn match opamInterpolate "%{[^ "]\+}%" contained syn region opamString start=/"/ end=/"/ contains=opamInterpolate,OpamUnclosedInterpolate syn region opamSeq start=/\[/ end=/\]/ contains=ALLBUT,opamKeyword1 syn region opamExp start=/{/ end=/}/ contains=ALLBUT,opamKeyword1 hi link opamKeyword1 Keyword hi link opamString String hi link opamExp Function hi link opamSeq Statement hi link opamOperator Operator hi link opamComment Comment hi link opamInterpolate Identifier hi link opamUnclosedInterpolate Error let b:current_syntax = "opam" " vim: ts=2 sw=2 07070100000035000081A400000000000000000000000165945CFF00000E65000000000000000000000000000000000000003500000000vim-ocaml-20240102T125911.c11dfa3/syntax/sexplib.vim" Vim syntax file " Language: S-expressions as used in Sexplib " Filenames: *.sexp " Maintainers: Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: 2020 Dec 31 - Updated header for Vim contribution (MM) " 2017 Apr 11 - Improved matching of negative numbers (MM) " 2012 Jun 20 - Fixed a block comment highlighting bug (MM) " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") && b:current_syntax == "sexplib" finish endif " Sexplib is case sensitive. syn case match " Comments syn keyword sexplibTodo contained TODO FIXME XXX NOTE syn region sexplibBlockComment matchgroup=sexplibComment start="#|" matchgroup=sexplibComment end="|#" contains=ALLBUT,sexplibQuotedAtom,sexplibUnquotedAtom,sexplibEncl,sexplibComment syn match sexplibSexpComment "#;" skipwhite skipempty nextgroup=sexplibQuotedAtomComment,sexplibUnquotedAtomComment,sexplibListComment,sexplibComment syn region sexplibQuotedAtomComment start=+"+ skip=+\\\\\|\\"+ end=+"+ contained syn match sexplibUnquotedAtomComment /\([^;()" \t#|]\|#[^;()" \t|]\||[^;()" \t#]\)[^;()" \t]*/ contained syn region sexplibListComment matchgroup=sexplibComment start="(" matchgroup=sexplibComment end=")" contained contains=ALLBUT,sexplibEncl,sexplibString,sexplibQuotedAtom,sexplibUnquotedAtom,sexplibTodo,sexplibNumber,sexplibFloat syn match sexplibComment ";.*" contains=sexplibTodo " Atoms syn match sexplibUnquotedAtom /\([^;()" \t#|]\|#[^;()" \t|]\||[^;()" \t#]\)[^;()" \t]*/ syn region sexplibQuotedAtom start=+"+ skip=+\\\\\|\\"+ end=+"+ syn match sexplibNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>" syn match sexplibNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>" syn match sexplibNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>" syn match sexplibNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>" syn match sexplibFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>" " Lists syn region sexplibEncl transparent matchgroup=sexplibEncl start="(" matchgroup=sexplibEncl end=")" contains=ALLBUT,sexplibParenErr " Errors syn match sexplibUnquotedAtomErr /\([^;()" \t#|]\|#[^;()" \t|]\||[^;()" \t#]\)[^;()" \t]*\(#|\||#\)[^;()" \t]*/ syn match sexplibParenErr ")" " Synchronization syn sync minlines=50 syn sync maxlines=500 " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_sexplib_syntax_inits") if version < 508 let did_sexplib_syntax_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink sexplibParenErr Error HiLink sexplibUnquotedAtomErr Error HiLink sexplibComment Comment HiLink sexplibSexpComment Comment HiLink sexplibQuotedAtomComment Include HiLink sexplibUnquotedAtomComment Comment HiLink sexplibBlockComment Comment HiLink sexplibListComment Comment HiLink sexplibBoolean Boolean HiLink sexplibCharacter Character HiLink sexplibNumber Number HiLink sexplibFloat Float HiLink sexplibUnquotedAtom Identifier HiLink sexplibEncl Identifier HiLink sexplibQuotedAtom Keyword HiLink sexplibTodo Todo HiLink sexplibEncl Keyword delcommand HiLink endif let b:current_syntax = "sexplib" " vim: ts=8 07070100000036000081A400000000000000000000000165945CFF00000FC9000000000000000000000000000000000000003700000000vim-ocaml-20240102T125911.c11dfa3/type-linter-notes.mdBelow are the tokens that are used as delimiters for type contexts. It has been constituted in late 2018 by (manually…) inspecting the (possibly inaccurate) grammar given in the reference manual; in May 2022, I read through the changelog from 4.08 to 4.14 and checked that listed syntax-related changes are supported. So the current implementation *should* support OCaml 4.14, but: * I may have missed cases when reading the grammar (I think the documented grammar is maintained by hand so it might be incomplete or out-of-sync; also, I originally missed some cases because they were only documented in the “extensions“ section of the reference manual); * a few pathological cases cannot be handled (unless by implementing a pattern parser…). **opening delimiters** + `type`, `type nonrec`, `constraint` + `exception` (excepted when preceded by `with`, `|` or `(`) * the rule is so that `exception` opens a type context when it is used for defining an exception, but not when it is used for pattern-matching; the case `( exception` is to handle exception patterns under or-patterns, which is allowed since OCaml 4.08: `| (exception E 42 | _) -> …` + `of`, `:` in sum type definitions + `:`, `: type`, `:>` * `: type` is because of polymorphic locally abstract types: `let f : type a b . … = …` that is necessary because otherwise the type linter would treat `type` as beginning a toplevel type definition, which has different delimiters (it spans across `=`). **common closing delimiters** + `type`, `exception`, `val` + `module`, `class` + `method`, `constraint`, `inherit` * because of class types: `class c : object method x : int … end` + `object` * because of `class c : object … end` + `struct` * because of `module M : MSIG with type t = u = struct … end` + `open`, `include` + `let`, `external` + `in` * because of `let exception E of typ in expr` + `end` + `)` * because of type annotations: `(x : int)` * but also of functors: `(M : SIG with type t = int)` * and also of type abstractions: `let f (type a b) …` + `]` and `}` * for error reporting + `;` * why not + `;;` + EOF Not all closing delimiters are useful in all situations, but it is safe to add them anyway, and it may help error reporting (e.g. by adding `}` and `]`, we can spot dangling closing parentheses). **more closing delimiters for `type` and `type nonrec` and `constraint` and `exception`** - `and` ? * to support `type … and …` * nope, we rather implement it as a keyword contained in the region (because otherwise, we’d need `and` to also be an opening delimiter for type contexts, but at that point we would not be able to distinguish between `type … and …` and `let … and …`) **more closing delimiters for sum type definitions** + → the additional closing delimiters for `type` + `and` + `=` (because of `exception E = F`) **more closing delimiters for `of` and `:` in sum type definitions** + → the additional closing delimiters for sum type definitions (excepted `=`) + `|` **more closing delimiters for `:` and `: type` and `:>`** + `=` + `:>` * to support `(x : … :> …)` + `}` and `;` * for record fields in record expressions **places where a comment is not recognized (uses of the regex `"\_s"`)** - the `nonrec` keyword: `type ??? nonrec` - polymorphic locally abstract types: `: ??? type` - exception patterns: `with ??? exception`, `| ??? exception`, `( ??? exception` - special constructors in sum type definitions: `( ??? )`, `[ ??? ]`, `( ??? :: ??? )` - module paths in types: `MyMod ??? .`, `MyFunc ??? (M) ??? .` - labeled arguments in types: `myname ??? :`, `?myname ??? :` - variance and/or injectivity indications in type definitions: `+ ??? ! ??? 'a` I think this is good enough, inserting comments there would be strange style. 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!254 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor