summaryrefslogtreecommitdiffstats
path: root/syntax/ocaml.vim
diff options
context:
space:
mode:
Diffstat (limited to 'syntax/ocaml.vim')
-rw-r--r--syntax/ocaml.vim189
1 files changed, 87 insertions, 102 deletions
diff --git a/syntax/ocaml.vim b/syntax/ocaml.vim
index ecb18aff..2058821e 100644
--- a/syntax/ocaml.vim
+++ b/syntax/ocaml.vim
@@ -20,11 +20,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
" can be distinguished from begin/end, which is used for indentation,
" and folding. (David Baelde)
-" 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 == "ocaml"
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax") && b:current_syntax == "ocaml"
finish
endif
@@ -131,7 +128,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
@@ -192,7 +189,7 @@ 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 ocamlType bytes string unit
syn match ocamlConstructor "(\s*)"
syn match ocamlConstructor "\[\s*\]"
@@ -291,103 +288,91 @@ syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>"
syn sync match ocamlSigSync groupthere ocamlSig "\<end\>"
" 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_ocaml_syntax_inits")
- if version < 508
- let did_ocaml_syntax_inits = 1
- command -nargs=+ HiLink hi link <args>
- else
- command -nargs=+ HiLink hi def link <args>
- endif
-
- HiLink ocamlBraceErr Error
- HiLink ocamlBrackErr Error
- HiLink ocamlParenErr Error
- HiLink ocamlArrErr Error
-
- HiLink ocamlCommentErr Error
-
- HiLink ocamlCountErr Error
- HiLink ocamlDoErr Error
- HiLink ocamlDoneErr Error
- HiLink ocamlEndErr Error
- HiLink ocamlThenErr Error
-
- HiLink ocamlCharErr Error
-
- HiLink ocamlErr Error
-
- HiLink ocamlComment Comment
-
- HiLink ocamlModPath Include
- 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
-
- HiLink ocamlConstructor Constant
-
- HiLink ocamlVal Keyword
- HiLink ocamlModPreRHS Keyword
- HiLink ocamlMPRestr2 Keyword
- HiLink ocamlKeyword Keyword
- HiLink ocamlMethod Include
- HiLink ocamlArrow Keyword
- HiLink ocamlKeyChar Keyword
- HiLink ocamlAnyVar Keyword
- HiLink ocamlTopStop 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
-
- HiLink ocamlType Type
-
- HiLink ocamlTodo Todo
-
- HiLink ocamlEncl Keyword
-
- HiLink ocamlPpxEncl ocamlEncl
-
- delcommand HiLink
+
+hi def link ocamlBraceErr Error
+hi def link ocamlBrackErr Error
+hi def link ocamlParenErr Error
+hi def link ocamlArrErr Error
+
+hi def link ocamlCommentErr 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 ocamlCharErr Error
+
+hi def link ocamlErr Error
+
+hi def link ocamlComment Comment
+
+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 ocamlScript Include
+
+hi def link ocamlConstructor Constant
+
+hi def link ocamlVal Keyword
+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 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
+
+hi def link ocamlType Type
+
+hi def link ocamlTodo Todo
+
+hi def link ocamlEncl Keyword
+
+hi def link ocamlPpxEncl ocamlEncl
+
let b:current_syntax = "ocaml"
" vim: ts=8