annotate runtime/syntax/ocaml.vim @ 1337:36275e20d997 v7.1.051

updated for version 7.1-051
author vimboss
date Sun, 05 Aug 2007 16:33:12 +0000
parents e63691e7c504
children c869ff170ddc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: OCaml
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Filenames: *.ml *.mli *.mll *.mly
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
4 " Maintainers: Markus Mottl <markus.mottl@gmail.com>
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents: 7
diff changeset
5 " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents: 7
diff changeset
6 " Issac Trotts <ijtrotts@ucdavis.edu>
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
7 " URL: http://www.ocaml.info/vim/syntax/ocaml.vim
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
8 " Last Change: 2007 Apr 13 - Added highlighting of nativeints (MM)
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
9 " 2006 Oct 09 - More highlighting improvements to numbers (MM)
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
10 " 2006 Sep 19 - Improved highlighting of numbers (Florent Monnier)
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
11
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
12 " A minor patch was applied to the official version so that object/end
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
13 " can be distinguished from begin/end, which is used for indentation,
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
14 " and folding. (David Baelde)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 syntax clear
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 550
diff changeset
20 elseif exists("b:current_syntax") && b:current_syntax == "ocaml"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " OCaml is case sensitive.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " Script headers highlighted like comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn match ocamlComment "^#!.*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " Scripting directives
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
31 syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|require\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\)\>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
33 " Script headers highlighted like comments
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
34 syn match ocamlComment "^#!.*"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
35
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " lowercase identifier - the standard way to match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 syn match ocamlKeyChar "|"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " Errors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn match ocamlBraceErr "}"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn match ocamlBrackErr "\]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syn match ocamlParenErr ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn match ocamlArrErr "|]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match ocamlCommentErr "\*)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match ocamlCountErr "\<downto\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 syn match ocamlCountErr "\<to\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 if !exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn match ocamlDoErr "\<do\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 syn match ocamlDoneErr "\<done\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 syn match ocamlThenErr "\<then\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 " Error-highlighting of "end" without synchronization:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 " as keyword or as error (default)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 if exists("ocaml_noend_error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 syn match ocamlKeyword "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn match ocamlEndErr "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 " Some convenient clusters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 syn cluster ocamlAllErrs contains=ocamlBraceErr,ocamlBrackErr,ocamlParenErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlPreMPRestr,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " Enclosing delimiters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="(" matchgroup=ocamlKeyword end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="{" matchgroup=ocamlKeyword end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[" matchgroup=ocamlKeyword end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[|" matchgroup=ocamlKeyword end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " Comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 syn region ocamlComment start="(\*" end="\*)" contains=ocamlComment,ocamlTodo
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
84 syn keyword ocamlTodo contained TODO FIXME XXX NOTE
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " Objects
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
88 syn region ocamlEnd matchgroup=ocamlObject start="\<object\>" matchgroup=ocamlObject end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " Blocks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 if !exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 syn region ocamlEnd matchgroup=ocamlKeyword start="\<begin\>" matchgroup=ocamlKeyword end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " "for"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 syn region ocamlNone matchgroup=ocamlKeyword start="\<for\>" matchgroup=ocamlKeyword end="\<\(to\|downto\)\>" contains=ALLBUT,@ocamlContained,ocamlCountErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 " "do"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 if !exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syn region ocamlDo matchgroup=ocamlKeyword start="\<do\>" matchgroup=ocamlKeyword end="\<done\>" contains=ALLBUT,@ocamlContained,ocamlDoneErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 " "if"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 syn region ocamlNone matchgroup=ocamlKeyword start="\<if\>" matchgroup=ocamlKeyword end="\<then\>" contains=ALLBUT,@ocamlContained,ocamlThenErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 "" Modules
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 " "struct"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 syn region ocamlStruct matchgroup=ocamlModule start="\<struct\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " "sig"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 syn region ocamlSig matchgroup=ocamlModule start="\<sig\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 " "open"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 syn region ocamlNone matchgroup=ocamlKeyword start="\<open\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*\>" contains=@ocamlAllErrs,ocamlComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 " "include"
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
123 syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 " "module" - somewhat complicated stuff ;-)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|="me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 syn region ocamlModParam start="([^*]" end=")" contained contains=@ocamlAENoParen,ocamlModParam1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlPreMPRestr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 syn region ocamlPreMPRestr start="."me=e-1 end=")"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlMPRestr,ocamlModTypeRestr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 syn region ocamlMPRestr start=":" end="."me=e-1 contained contains=@ocamlComment skipwhite skipempty nextgroup=ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 syn region ocamlMPRestr1 matchgroup=ocamlModule start="\ssig\s\=" matchgroup=ocamlModule end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 syn match ocamlMPRestr3 "\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 syn match ocamlModPreRHS "=" contained skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 syn region ocamlModRHS start="." end=".\w\|([^*]"me=e-2 contained contains=ocamlComment skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 syn match ocamlFullMod "\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 syn region ocamlFuncWith start="([^*]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 syn region ocamlFuncStruct matchgroup=ocamlModule start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 syn region ocamlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@ocamlAENoParen,ocamlWith
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 syn match ocamlWith "\<\(\u\(\w\|'\)*\.\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlWithRest
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@ocamlContained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 " "module type"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 syn region ocamlKeyword start="\<module\>\s*\<type\>" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 syn keyword ocamlKeyword and as assert class
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 syn keyword ocamlKeyword constraint else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 syn keyword ocamlKeyword exception external fun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 syn keyword ocamlKeyword in inherit initializer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 syn keyword ocamlKeyword land lazy let match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 syn keyword ocamlKeyword method mutable new of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 syn keyword ocamlKeyword parser private raise rec
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 syn keyword ocamlKeyword try type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 syn keyword ocamlKeyword val virtual when while with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 if exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 syn keyword ocamlKeyword do value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 syn keyword ocamlBoolean True False
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 syn keyword ocamlKeyword function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 syn keyword ocamlBoolean true false
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 syn match ocamlKeyChar "!"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
173 syn keyword ocamlType array bool char exn float format format4
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
174 syn keyword ocamlType int int32 int64 lazy_t list nativeint option
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
175 syn keyword ocamlType string unit
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 syn keyword ocamlOperator asr lor lsl lsr lxor mod not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 syn match ocamlConstructor "(\s*)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 syn match ocamlConstructor "\[\s*\]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 syn match ocamlConstructor "\[|\s*>|]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 syn match ocamlConstructor "\[<\s*>\]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 syn match ocamlConstructor "\u\(\w\|'\)*\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 " Polymorphic variants
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 syn match ocamlConstructor "`\w\(\w\|'\)*\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 " Module prefix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 syn match ocamlModPath "\u\(\w\|'\)*\."he=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 syn match ocamlCharacter "'\\\d\d\d'\|'\\[\'ntbr]'\|'.'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 syn match ocamlCharErr "'\\\d\d'\|'\\\d'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 syn match ocamlCharErr "'\\[^\'ntbr]'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 syn match ocamlFunDef "->"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 syn match ocamlRefAssign ":="
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 syn match ocamlTopStop ";;"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 syn match ocamlOperator "\^"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 syn match ocamlOperator "::"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 syn match ocamlOperator "&&"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 syn match ocamlOperator "<"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 syn match ocamlOperator ">"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 syn match ocamlAnyVar "\<_\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 syn match ocamlKeyChar "|[^\]]"me=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 syn match ocamlKeyChar ";"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 syn match ocamlKeyChar "\~"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 syn match ocamlKeyChar "?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 syn match ocamlKeyChar "\*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 syn match ocamlKeyChar "="
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 if exists("ocaml_revised")
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
214 syn match ocamlErr "<-"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 else
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
216 syn match ocamlOperator "<-"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
219 syn match ocamlNumber "\<-\=\d\(_\|\d\)*[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
220 syn match ocamlNumber "\<-\=0[x|X]\(\x\|_\)\+[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
221 syn match ocamlNumber "\<-\=0[o|O]\(\o\|_\)\+[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
222 syn match ocamlNumber "\<-\=0[b|B]\([01]\|_\)\+[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
223 syn match ocamlFloat "\<-\=\d\(_\|\d\)*\.\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 " Labels
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
226 syn match ocamlLabel "\~\(\l\|_\)\(\w\|'\)*"lc=1
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
227 syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 syn region ocamlLabel transparent matchgroup=ocamlLabel start="?(\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 " Synchronization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 syn sync minlines=50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 syn sync maxlines=500
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 if !exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 syn sync match ocamlDoSync grouphere ocamlDo "\<do\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 syn sync match ocamlDoSync groupthere ocamlDo "\<done\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 if exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 syn sync match ocamlEndSync grouphere ocamlEnd "\<\(object\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 syn sync match ocamlEndSync grouphere ocamlEnd "\<\(begin\|object\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 syn sync match ocamlEndSync groupthere ocamlEnd "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 syn sync match ocamlStructSync grouphere ocamlStruct "\<struct\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 syn sync match ocamlStructSync groupthere ocamlStruct "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 syn sync match ocamlSigSync groupthere ocamlSig "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 if version >= 508 || !exists("did_ocaml_syntax_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 let did_ocaml_syntax_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 HiLink ocamlBraceErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 HiLink ocamlBrackErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 HiLink ocamlParenErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 HiLink ocamlArrErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 HiLink ocamlCommentErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 HiLink ocamlCountErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 HiLink ocamlDoErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 HiLink ocamlDoneErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 HiLink ocamlEndErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 HiLink ocamlThenErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 HiLink ocamlCharErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 HiLink ocamlErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 HiLink ocamlComment Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 HiLink ocamlModPath Include
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
283 HiLink ocamlObject Include
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 HiLink ocamlModule Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 HiLink ocamlModParam1 Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 HiLink ocamlModType Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 HiLink ocamlMPRestr3 Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 HiLink ocamlFullMod Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 HiLink ocamlModTypeRestr Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 HiLink ocamlWith Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 HiLink ocamlMTDef Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 HiLink ocamlScript Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 HiLink ocamlConstructor Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 HiLink ocamlModPreRHS Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 HiLink ocamlMPRestr2 Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 HiLink ocamlKeyword Keyword
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
300 HiLink ocamlMethod Include
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 HiLink ocamlFunDef Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 HiLink ocamlRefAssign Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 HiLink ocamlKeyChar Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 HiLink ocamlAnyVar Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 HiLink ocamlTopStop Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 HiLink ocamlOperator Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 HiLink ocamlBoolean Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 HiLink ocamlCharacter Character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 HiLink ocamlNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 HiLink ocamlFloat Float
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 HiLink ocamlString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 HiLink ocamlLabel Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 HiLink ocamlType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 HiLink ocamlTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 HiLink ocamlEncl Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 let b:current_syntax = "ocaml"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 " vim: ts=8