annotate runtime/syntax/ocaml.vim @ 3586:583e46e4a56c v7.3.553

updated for version 7.3.553 Problem: With double-width characters and 'listchars' containing "precedes" the text is displayed one cell off. Solution: Check for double-width character being overwritten by the "precedes" character. (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Wed, 13 Jun 2012 18:06:36 +0200
parents c869ff170ddc
children eb7ce2918a03
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
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
8 " Last Change: 2010 Oct 11 - Added highlighting of lnot (MM, thanks to Erick Matsen)
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
9 " 2010 Sep 03 - Fixed escaping bug (MM, thanks to Florent Monnier)
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
10 " 2010 Aug 07 - Fixed module type bug (MM)
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
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
27 " Access to the method of an object
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
28 syn match ocamlMethod "#"
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
29
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " Script headers highlighted like comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn match ocamlComment "^#!.*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " Scripting directives
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
34 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\)\>"
1121
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
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
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,ocamlVal
7
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 " "sig"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 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
114 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
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 " "open"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 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
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 " "include"
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
120 syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 " "module" - somewhat complicated stuff ;-)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
124 syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
125 syn region ocamlModParam start="([^*]" end=")" contained contains=@ocamlAENoParen,ocamlModParam1,ocamlVal
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlPreMPRestr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 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
129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 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
131 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
132 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
133 syn match ocamlMPRestr3 "\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 syn match ocamlModPreRHS "=" contained skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
135 syn keyword ocamlKeyword val
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
136 syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLCIdentifier end="\<\l\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlMPRestr
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 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
138 syn match ocamlFullMod "\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 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
141 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
142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 syn region ocamlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@ocamlAENoParen,ocamlWith
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 syn match ocamlWith "\<\(\u\(\w\|'\)*\.\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlWithRest
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@ocamlContained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
148 " "struct"
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
149 syn region ocamlStruct matchgroup=ocamlModule start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
150
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 " "module type"
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
152 syn region ocamlKeyword start="\<module\>\s*\<type\>\(\s*\<of\>\)\=" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 syn keyword ocamlKeyword and as assert class
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 syn keyword ocamlKeyword constraint else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 syn keyword ocamlKeyword exception external fun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 syn keyword ocamlKeyword in inherit initializer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 syn keyword ocamlKeyword land lazy let match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 syn keyword ocamlKeyword method mutable new of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 syn keyword ocamlKeyword parser private raise rec
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 syn keyword ocamlKeyword try type
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
164 syn keyword ocamlKeyword virtual when while with
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 if exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 syn keyword ocamlKeyword do value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 syn keyword ocamlBoolean True False
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 syn keyword ocamlKeyword function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 syn keyword ocamlBoolean true false
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 syn match ocamlKeyChar "!"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
175 syn keyword ocamlType array bool char exn float format format4
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
176 syn keyword ocamlType int int32 int64 lazy_t list nativeint option
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
177 syn keyword ocamlType string unit
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
179 syn keyword ocamlOperator asr lnot lor lsl lsr lxor mod not
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
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 "\[|\s*>|]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 syn match ocamlConstructor "\[<\s*>\]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 syn match ocamlConstructor "\u\(\w\|'\)*\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 " Polymorphic variants
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 syn match ocamlConstructor "`\w\(\w\|'\)*\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 " Module prefix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 syn match ocamlModPath "\u\(\w\|'\)*\."he=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 syn match ocamlCharacter "'\\\d\d\d'\|'\\[\'ntbr]'\|'.'"
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
194 syn match ocamlCharacter "'\\x\x\x'"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 syn match ocamlCharErr "'\\\d\d'\|'\\\d'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 syn match ocamlCharErr "'\\[^\'ntbr]'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 syn match ocamlFunDef "->"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 syn match ocamlRefAssign ":="
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 syn match ocamlTopStop ";;"
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 syn match ocamlOperator "&&"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 syn match ocamlOperator "<"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 syn match ocamlOperator ">"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 syn match ocamlAnyVar "\<_\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 syn match ocamlKeyChar "|[^\]]"me=e-1
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 syn match ocamlKeyChar "?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 syn match ocamlKeyChar "\*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 syn match ocamlKeyChar "="
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 if exists("ocaml_revised")
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
217 syn match ocamlErr "<-"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 else
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
219 syn match ocamlOperator "<-"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
222 syn match ocamlNumber "\<-\=\d\(_\|\d\)*[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
223 syn match ocamlNumber "\<-\=0[x|X]\(\x\|_\)\+[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
224 syn match ocamlNumber "\<-\=0[o|O]\(\o\|_\)\+[l|L|n]\?\>"
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
225 syn match ocamlNumber "\<-\=0[b|B]\([01]\|_\)\+[l|L|n]\?\>"
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
226 syn match ocamlFloat "\<-\=\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 " Labels
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
229 syn match ocamlLabel "\~\(\l\|_\)\(\w\|'\)*"lc=1
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
230 syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 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
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 " Synchronization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 syn sync minlines=50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 syn sync maxlines=500
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 if !exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 syn sync match ocamlDoSync grouphere ocamlDo "\<do\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 syn sync match ocamlDoSync groupthere ocamlDo "\<done\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 if exists("ocaml_revised")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 syn sync match ocamlEndSync grouphere ocamlEnd "\<\(object\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 syn sync match ocamlEndSync grouphere ocamlEnd "\<\(begin\|object\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 syn sync match ocamlEndSync groupthere ocamlEnd "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 syn sync match ocamlStructSync grouphere ocamlStruct "\<struct\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 syn sync match ocamlStructSync groupthere ocamlStruct "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 syn sync match ocamlSigSync groupthere ocamlSig "\<end\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 " 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
258 if version >= 508 || !exists("did_ocaml_syntax_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 let did_ocaml_syntax_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 HiLink ocamlBraceErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 HiLink ocamlBrackErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 HiLink ocamlParenErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 HiLink ocamlArrErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 HiLink ocamlCommentErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 HiLink ocamlCountErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 HiLink ocamlDoErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 HiLink ocamlDoneErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 HiLink ocamlEndErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 HiLink ocamlThenErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 HiLink ocamlCharErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 HiLink ocamlErr Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 HiLink ocamlComment Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 HiLink ocamlModPath Include
550
74c2ea3c3081 updated for version 7.0156
vimboss
parents: 20
diff changeset
286 HiLink ocamlObject Include
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 HiLink ocamlModule Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 HiLink ocamlModParam1 Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 HiLink ocamlModType Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 HiLink ocamlMPRestr3 Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 HiLink ocamlFullMod Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 HiLink ocamlModTypeRestr Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 HiLink ocamlWith Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 HiLink ocamlMTDef Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 HiLink ocamlScript Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 HiLink ocamlConstructor Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299
2833
c869ff170ddc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1121
diff changeset
300 HiLink ocamlVal Keyword
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 HiLink ocamlModPreRHS Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 HiLink ocamlMPRestr2 Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 HiLink ocamlKeyword Keyword
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 826
diff changeset
304 HiLink ocamlMethod Include
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 HiLink ocamlFunDef Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 HiLink ocamlRefAssign Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 HiLink ocamlKeyChar Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 HiLink ocamlAnyVar Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 HiLink ocamlTopStop Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 HiLink ocamlOperator Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 HiLink ocamlBoolean Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 HiLink ocamlCharacter Character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 HiLink ocamlNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 HiLink ocamlFloat Float
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 HiLink ocamlString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 HiLink ocamlLabel Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 HiLink ocamlType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 HiLink ocamlTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 HiLink ocamlEncl Keyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 let b:current_syntax = "ocaml"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 " vim: ts=8