Change ocaml provider, closes #320

This commit is contained in:
Adam Stankiewicz
2019-03-04 12:09:44 +01:00
parent b4cb58661e
commit 521220f389
19 changed files with 1329 additions and 387 deletions

40
syntax/jbuild.vim Normal file
View File

@@ -0,0 +1,40 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
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 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 cluster lispBaseListCluster add=jbuildVar
syn match jbuildVar '\${[@<^]}' containedin=lispSymbol
syn match jbuildVar '\${\k\+\(:\k\+\)\?}' containedin=lispSymbol
hi def link jbuildVar Identifier
let b:current_syntax = "jbuild"

99
syntax/oasis.vim Normal file
View File

@@ -0,0 +1,99 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
if 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"

View File

@@ -9,9 +9,14 @@ endif
" Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de>
" Issac Trotts <ijtrotts@ucdavis.edu>
" URL: http://www.ocaml.info/vim/syntax/ocaml.vim
" Last Change: 2010 Oct 11 - Added highlighting of lnot (MM, thanks to Erick Matsen)
" 2010 Sep 03 - Fixed escaping bug (MM, thanks to Florent Monnier)
" 2010 Aug 07 - Fixed module type bug (MM)
" Last Change:
" 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,
@@ -25,6 +30,9 @@ elseif exists("b:current_syntax") && b:current_syntax == "ocaml"
finish
endif
" ' can be used in OCaml identifiers
setlocal iskeyword+='
" OCaml is case sensitive.
syn case match
@@ -32,10 +40,10 @@ syn case match
syn match ocamlMethod "#"
" Script headers highlighted like comments
syn match ocamlComment "^#!.*"
syn match ocamlComment "^#!.*" contains=@Spell
" Scripting directives
syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|require\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\|camlp4o\)\>"
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\|'\)*\>/
@@ -73,7 +81,7 @@ syn cluster ocamlAllErrs contains=ocamlBraceErr,ocamlBrackErr,ocamlParenErr,oca
syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr
syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlPreMPRestr,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal
syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal
" Enclosing delimiters
@@ -84,7 +92,7 @@ syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[|" matchgrou
" Comments
syn region ocamlComment start="(\*" end="\*)" contains=ocamlComment,ocamlTodo
syn region ocamlComment start="(\*" end="\*)" contains=@Spell,ocamlComment,ocamlTodo
syn keyword ocamlTodo contained TODO FIXME XXX NOTE
@@ -110,60 +118,66 @@ 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
" "sig"
syn region ocamlSig matchgroup=ocamlModule start="\<sig\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSigEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr
" "open"
syn region ocamlNone matchgroup=ocamlKeyword start="\<open\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*\>" contains=@ocamlAllErrs,ocamlComment
syn region ocamlNone matchgroup=ocamlKeyword start="\<open\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*\>" contains=@ocamlAllErrs,ocamlComment
" "include"
syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
" "module" - somewhat complicated stuff ;-)
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 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS
syn region ocamlModParam start="([^*]" end=")" contained contains=@ocamlAENoParen,ocamlModParam1,ocamlVal
syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlPreMPRestr
syn region ocamlPreMPRestr start="."me=e-1 end=")"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlMPRestr,ocamlModTypeRestr
syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS
syn region ocamlModParam start="([^*]" end=")" contained contains=ocamlGenMod,ocamlModParam1,ocamlSig,ocamlVal
syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty
syn match ocamlGenMod "()" contained skipwhite skipempty
syn region ocamlMPRestr start=":" end="."me=e-1 contained contains=@ocamlComment skipwhite skipempty nextgroup=ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3
syn region ocamlMPRestr1 matchgroup=ocamlModule start="\ssig\s\=" matchgroup=ocamlModule end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2
syn match ocamlMPRestr3 "\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*" contained
syn region ocamlMPRestr1 matchgroup=ocamlSigEncl start="\ssig\s\=" matchgroup=ocamlSigEncl end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2
syn match ocamlMPRestr3 "\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 skipwhite skipempty nextgroup=ocamlMPRestr
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 ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLCIdentifier end="\<\l\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment,ocamlFullMod skipwhite skipempty nextgroup=ocamlMPRestr
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="([^*]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith
syn region ocamlFuncStruct matchgroup=ocamlModule start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
syn region ocamlFuncWith start="([^*)]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith
syn region ocamlFuncStruct matchgroup=ocamlStructEncl start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contained
syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained
syn region ocamlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@ocamlAENoParen,ocamlWith
syn match ocamlWith "\<\(\u\(\w\|'\)*\.\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlWithRest
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=ocamlModule start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
syn region ocamlStruct matchgroup=ocamlStructEncl start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
" "module type"
syn region ocamlKeyword 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
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 keyword ocamlKeyword and as assert class
syn keyword ocamlKeyword constraint else
syn keyword ocamlKeyword exception external fun
syn keyword ocamlKeyword in inherit initializer
syn keyword ocamlKeyword land lazy let match
syn keyword ocamlKeyword method mutable new of
syn keyword ocamlKeyword parser private raise rec
syn keyword ocamlKeyword lazy let match
syn keyword ocamlKeyword method mutable new nonrec of
syn keyword ocamlKeyword parser private rec
syn keyword ocamlKeyword try type
syn keyword ocamlKeyword virtual when while with
@@ -173,15 +187,12 @@ if exists("ocaml_revised")
else
syn keyword ocamlKeyword function
syn keyword ocamlBoolean true false
syn match ocamlKeyChar "!"
endif
syn keyword ocamlType array bool char exn float format format4
syn keyword ocamlType int int32 int64 lazy_t list nativeint option
syn keyword ocamlType string unit
syn keyword ocamlOperator asr lnot lor lsl lsr lxor mod not
syn match ocamlConstructor "(\s*)"
syn match ocamlConstructor "\[\s*\]"
syn match ocamlConstructor "\[|\s*>|]"
@@ -192,47 +203,69 @@ syn match ocamlConstructor "\u\(\w\|'\)*\>"
syn match ocamlConstructor "`\w\(\w\|'\)*\>"
" Module prefix
syn match ocamlModPath "\u\(\w\|'\)*\."he=e-1
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=+"+
syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
syn match ocamlFunDef "->"
syn match ocamlRefAssign ":="
syn match ocamlTopStop ";;"
syn match ocamlOperator "\^"
syn match ocamlOperator "::"
syn match ocamlOperator "&&"
syn match ocamlOperator "<"
syn match ocamlOperator ">"
syn match ocamlAnyVar "\<_\>"
syn match ocamlKeyChar "|[^\]]"me=e-1
syn match ocamlKeyChar ";"
syn match ocamlKeyChar "\~"
syn match ocamlKeyChar "?"
syn match ocamlKeyChar "\*"
syn match ocamlKeyChar "="
"" 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
" =, *, < and > are both operator names and keywords, we let the user choose how
" to display them (has to be declared before regular infix operators):
syn match ocamlEqual "="
syn match ocamlStar "*"
syn match ocamlAngle "<"
syn match ocamlAngle ">"
" Custom indexing operators:
syn match ocamlIndexingOp "\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\(()\|\[]\|{}\)\(<-\)\?"
" 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 letbindings 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 "<-"
syn match ocamlErr "<-[~?!.:|&$%<=>@^*/+-]\@!"
else
syn match ocamlOperator "<-"
syn match ocamlKeyChar "<-[~?!.:|&$%<=>@^*/+-]\@!"
endif
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\)*\)\=\>"
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\|'\)*"lc=1
syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1
syn region ocamlLabel transparent matchgroup=ocamlLabel start="?(\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr
syn region ocamlLabel transparent matchgroup=ocamlLabel start="[~?](\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr
" Synchronization
@@ -290,12 +323,17 @@ if version >= 508 || !exists("did_ocaml_syntax_inits")
HiLink ocamlObject Include
HiLink ocamlModule Include
HiLink ocamlModParam1 Include
HiLink ocamlGenMod Include
HiLink ocamlModType Include
HiLink ocamlMPRestr3 Include
HiLink ocamlFullMod Include
HiLink ocamlFuncWith Include
HiLink ocamlModParam Include
HiLink ocamlModTypeRestr Include
HiLink ocamlWith Include
HiLink ocamlMTDef Include
HiLink ocamlSigEncl ocamlModule
HiLink ocamlStructEncl ocamlModule
HiLink ocamlScript Include
@@ -306,18 +344,35 @@ if version >= 508 || !exists("did_ocaml_syntax_inits")
HiLink ocamlMPRestr2 Keyword
HiLink ocamlKeyword Keyword
HiLink ocamlMethod Include
HiLink ocamlFunDef Keyword
HiLink ocamlRefAssign Keyword
HiLink ocamlArrow Keyword
HiLink ocamlKeyChar Keyword
HiLink ocamlAnyVar Keyword
HiLink ocamlTopStop Keyword
HiLink ocamlOperator Keyword
HiLink ocamlRefAssign ocamlKeyChar
HiLink ocamlEqual ocamlKeyChar
HiLink ocamlStar ocamlInfixOp
HiLink ocamlAngle ocamlInfixOp
HiLink ocamlCons ocamlInfixOp
HiLink ocamlPrefixOp ocamlOperator
HiLink ocamlInfixOp ocamlOperator
HiLink ocamlExtensionOp ocamlOperator
HiLink ocamlIndexingOp ocamlOperator
if exists("ocaml_highlight_operators")
HiLink ocamlInfixOpKeyword ocamlOperator
HiLink ocamlOperator Operator
else
HiLink ocamlInfixOpKeyword Keyword
endif
HiLink ocamlBoolean Boolean
HiLink ocamlCharacter Character
HiLink ocamlNumber Number
HiLink ocamlFloat Float
HiLink ocamlString String
HiLink ocamlQuotedStringDelim Identifier
HiLink ocamlLabel Identifier
@@ -327,6 +382,8 @@ if version >= 508 || !exists("did_ocaml_syntax_inits")
HiLink ocamlEncl Keyword
HiLink ocamlPpxEncl ocamlEncl
delcommand HiLink
endif

View File

@@ -0,0 +1,44 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
if 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"

132
syntax/omake.vim Normal file
View File

@@ -0,0 +1,132 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
" 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

35
syntax/opam.vim Normal file
View File

@@ -0,0 +1,35 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
if exists("b:current_syntax")
finish
endif
" need %{vars}%
" env: [[CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"]]
syn keyword opamKeyword1 remove depends depopts conflicts env packages patches version maintainer tags license homepage authors doc install author available name depexts substs synopsis description
syn match opamKeyword2 "\v(bug-reports|post-messages|ocaml-version|opam-version|dev-repo|build-test|build-doc|build)"
syn keyword opamTodo FIXME NOTE NOTES TODO XXX contained
syn match opamComment "#.*$" contains=opamTodo,@Spell
syn match opamOperator ">\|<\|=\|<=\|>="
syn region opamInterpolate start=/%{/ end=/}%/ contained
syn region opamString start=/"/ end=/"/ contains=opamInterpolate
syn region opamSeq start=/\[/ end=/\]/ contains=ALLBUT,opamKeyword1,opamKeyword2
syn region opamExp start=/{/ end=/}/ contains=ALLBUT,opamKeyword1,opamKeyword2
hi link opamKeyword1 Keyword
hi link opamKeyword2 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
let b:current_syntax = "opam"
" vim: ts=2 sw=2

92
syntax/sexplib.vim Normal file
View File

@@ -0,0 +1,92 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
" Vim syntax file
" Language: S-expressions as used in Sexplib
" Filenames: *.sexp
" Maintainers: Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.ocaml.info/vim/syntax/sexplib.vim
" Last Change: 2017 Apr 11 - Improved matching of negative numbers (MM)
" 2012 Jun 20 - Fixed a block comment highlighting bug (MM)
" 2012 Apr 24 - Added support for new comment styles (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