diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-02 16:39:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-02 16:39:53 +0100 |
commit | 7e6a515ed14e204fafb3dd6e98f2fb543e64aedd (patch) | |
tree | 75163fe37994ee84b512bbd8d833453583fd3bd8 /runtime/syntax/ocaml.vim | |
parent | 02faa944c69ea22a7a5338135b686dac2c946ca1 (diff) |
Update runtime files.
Diffstat (limited to 'runtime/syntax/ocaml.vim')
-rw-r--r-- | runtime/syntax/ocaml.vim | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim index 42913f228e..af3efd3dab 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -4,7 +4,7 @@ " Maintainers: Markus Mottl <markus.mottl@gmail.com> " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> " Issac Trotts <ijtrotts@ucdavis.edu> -" URL: https://github.com/rgrinberg/vim-ocaml +" URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2018 Nov 08 - Improved highlighting of operators (Maƫlan) " 2018 Apr 22 - Improved support for PPX (Andrey Popp) @@ -18,14 +18,20 @@ " can be distinguished from begin/end, which is used for indentation, " and folding. (David Baelde) -" quit when a syntax file was already loaded +" 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 @@ -123,7 +129,7 @@ syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSi 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 match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod " "include" syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod @@ -225,7 +231,18 @@ syn match ocamlStar "*" syn match ocamlAngle "<" syn match ocamlAngle ">" " Custom indexing operators: -syn match ocamlIndexingOp "\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\(()\|\[]\|{}\)\(<-\)\?" +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: @@ -283,7 +300,6 @@ syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>" syn sync match ocamlSigSync groupthere ocamlSig "\<end\>" " Define the default highlighting. -" Only when an item doesn't have highlighting yet hi def link ocamlBraceErr Error hi def link ocamlBrackErr Error @@ -308,14 +324,17 @@ 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 ocamlModType Include hi def link ocamlMPRestr3 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 ocamlSigEncl ocamlModule +hi def link ocamlStructEncl ocamlModule hi def link ocamlScript Include @@ -326,24 +345,25 @@ hi def link ocamlModPreRHS Keyword hi def link ocamlMPRestr2 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 ocamlStar ocamlInfixOp -hi def link ocamlAngle ocamlInfixOp -hi def link ocamlCons ocamlInfixOp +hi def link ocamlRefAssign ocamlKeyChar +hi def link ocamlEqual ocamlKeyChar +hi def link ocamlStar ocamlInfixOp +hi def link ocamlAngle ocamlInfixOp +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 +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 + hi def link ocamlOperator Operator else hi def link ocamlInfixOpKeyword Keyword endif @@ -353,7 +373,7 @@ 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 ocamlQuotedStringDelim Identifier hi def link ocamlLabel Identifier @@ -363,8 +383,11 @@ hi def link ocamlTodo Todo hi def link ocamlEncl Keyword -hi def link ocamlPpxEncl ocamlEncl +hi def link ocamlPpxEncl ocamlEncl let b:current_syntax = "ocaml" +let &cpo = s:keepcpo +unlet s:keepcpo + " vim: ts=8 |