Mercurial > vim
annotate runtime/syntax/ocaml.vim @ 23513:872239543313 v8.2.2299
patch 8.2.2299: Vim9: invalid memory access making error message flaky
Commit: https://github.com/vim/vim/commit/d1510ee9469f623c872a18b6e3c3666c0fb23c58
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 4 16:15:58 2021 +0100
patch 8.2.2299: Vim9: invalid memory access making error message flaky
Problem: Vim9: invalid memory access making error message flaky.
Solution: Do not check cmd_argt for CMD_USER. (issue https://github.com/vim/vim/issues/7467)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 04 Jan 2021 16:30:03 +0100 |
parents | 15fa3923cc49 |
children | 7270e1122962 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: OCaml | |
3 " Filenames: *.ml *.mli *.mll *.mly | |
550 | 4 " Maintainers: Markus Mottl <markus.mottl@gmail.com> |
20 | 5 " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> |
6 " Issac Trotts <ijtrotts@ucdavis.edu> | |
23466 | 7 " URL: https://github.com/ocaml/vim-ocaml |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
8 " Last Change: |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
9 " 2018 Nov 08 - Improved highlighting of operators (Maëlan) |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
10 " 2018 Apr 22 - Improved support for PPX (Andrey Popp) |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
11 " 2018 Mar 16 - Remove raise, lnot and not from keywords (Étienne Millon, "copy") |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
12 " 2017 Apr 11 - Improved matching of negative numbers (MM) |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
13 " 2016 Mar 11 - Improved support for quoted strings (Glen Mével) |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
14 " 2015 Aug 13 - Allow apostrophes in identifiers (Jonathan Chan, Einar Lielmanis) |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
15 " 2015 Jun 17 - Added new "nonrec" keyword (MM) |
550 | 16 |
17 " A minor patch was applied to the official version so that object/end | |
18 " can be distinguished from begin/end, which is used for indentation, | |
19 " and folding. (David Baelde) | |
7 | 20 |
23466 | 21 " Quit when a syntax file was already loaded |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5244
diff
changeset
|
22 if exists("b:current_syntax") && b:current_syntax == "ocaml" |
7 | 23 finish |
24 endif | |
25 | |
23466 | 26 let s:keepcpo = &cpo |
27 set cpo&vim | |
28 | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
29 " ' can be used in OCaml identifiers |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
30 setlocal iskeyword+=' |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
31 |
23466 | 32 " ` is part of the name of polymorphic variants |
33 setlocal iskeyword+=` | |
34 | |
7 | 35 " OCaml is case sensitive. |
36 syn case match | |
37 | |
2833 | 38 " Access to the method of an object |
39 syn match ocamlMethod "#" | |
40 | |
7 | 41 " Script headers highlighted like comments |
5244 | 42 syn match ocamlComment "^#!.*" contains=@Spell |
7 | 43 |
44 " Scripting directives | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
45 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\)\>" |
1121 | 46 |
7 | 47 " lowercase identifier - the standard way to match |
48 syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/ | |
49 | |
50 syn match ocamlKeyChar "|" | |
51 | |
52 " Errors | |
53 syn match ocamlBraceErr "}" | |
54 syn match ocamlBrackErr "\]" | |
55 syn match ocamlParenErr ")" | |
56 syn match ocamlArrErr "|]" | |
57 | |
58 syn match ocamlCommentErr "\*)" | |
59 | |
60 syn match ocamlCountErr "\<downto\>" | |
61 syn match ocamlCountErr "\<to\>" | |
62 | |
63 if !exists("ocaml_revised") | |
64 syn match ocamlDoErr "\<do\>" | |
65 endif | |
66 | |
67 syn match ocamlDoneErr "\<done\>" | |
68 syn match ocamlThenErr "\<then\>" | |
69 | |
70 " Error-highlighting of "end" without synchronization: | |
71 " as keyword or as error (default) | |
72 if exists("ocaml_noend_error") | |
73 syn match ocamlKeyword "\<end\>" | |
74 else | |
75 syn match ocamlEndErr "\<end\>" | |
76 endif | |
77 | |
78 " Some convenient clusters | |
79 syn cluster ocamlAllErrs contains=ocamlBraceErr,ocamlBrackErr,ocamlParenErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr | |
80 | |
81 syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr | |
82 | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
83 syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal |
7 | 84 |
85 | |
86 " Enclosing delimiters | |
87 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="(" matchgroup=ocamlKeyword end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr | |
88 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="{" matchgroup=ocamlKeyword end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr | |
89 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[" matchgroup=ocamlKeyword end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr | |
90 syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[|" matchgroup=ocamlKeyword end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr | |
91 | |
92 | |
93 " Comments | |
5244 | 94 syn region ocamlComment start="(\*" end="\*)" contains=@Spell,ocamlComment,ocamlTodo |
550 | 95 syn keyword ocamlTodo contained TODO FIXME XXX NOTE |
7 | 96 |
97 | |
98 " Objects | |
550 | 99 syn region ocamlEnd matchgroup=ocamlObject start="\<object\>" matchgroup=ocamlObject end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr |
7 | 100 |
101 | |
102 " Blocks | |
103 if !exists("ocaml_revised") | |
104 syn region ocamlEnd matchgroup=ocamlKeyword start="\<begin\>" matchgroup=ocamlKeyword end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr | |
105 endif | |
106 | |
107 | |
108 " "for" | |
109 syn region ocamlNone matchgroup=ocamlKeyword start="\<for\>" matchgroup=ocamlKeyword end="\<\(to\|downto\)\>" contains=ALLBUT,@ocamlContained,ocamlCountErr | |
110 | |
111 | |
112 " "do" | |
113 if !exists("ocaml_revised") | |
114 syn region ocamlDo matchgroup=ocamlKeyword start="\<do\>" matchgroup=ocamlKeyword end="\<done\>" contains=ALLBUT,@ocamlContained,ocamlDoneErr | |
115 endif | |
116 | |
117 " "if" | |
118 syn region ocamlNone matchgroup=ocamlKeyword start="\<if\>" matchgroup=ocamlKeyword end="\<then\>" contains=ALLBUT,@ocamlContained,ocamlThenErr | |
119 | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
120 "" PPX nodes |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
121 |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
122 syn match ocamlPpxIdentifier /\(\[@\{1,3\}\)\@<=\w\+\(\.\w\+\)*/ |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
123 syn region ocamlPpx matchgroup=ocamlPpxEncl start="\[@\{1,3\}" contains=TOP end="\]" |
7 | 124 |
125 "" Modules | |
126 | |
127 " "sig" | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
128 syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSigEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule |
7 | 129 syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr |
130 | |
131 " "open" | |
23466 | 132 syn match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod |
7 | 133 |
134 " "include" | |
550 | 135 syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod |
7 | 136 |
137 " "module" - somewhat complicated stuff ;-) | |
138 syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
139 syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
140 syn region ocamlModParam start="([^*]" end=")" contained contains=ocamlGenMod,ocamlModParam1,ocamlSig,ocamlVal |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
141 syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
142 syn match ocamlGenMod "()" contained skipwhite skipempty |
7 | 143 |
144 syn region ocamlMPRestr start=":" end="."me=e-1 contained contains=@ocamlComment skipwhite skipempty nextgroup=ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3 | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
145 syn region ocamlMPRestr1 matchgroup=ocamlSigEncl start="\ssig\s\=" matchgroup=ocamlSigEncl end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
146 syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2 |
5244 | 147 syn match ocamlMPRestr3 "\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*" contained |
7 | 148 syn match ocamlModPreRHS "=" contained skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod |
2833 | 149 syn keyword ocamlKeyword val |
5244 | 150 syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLCIdentifier end="\<\l\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment,ocamlFullMod skipwhite skipempty nextgroup=ocamlMPRestr |
151 syn region ocamlModRHS start="." end=". *\w\|([^*]"me=e-2 contained contains=ocamlComment skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod | |
152 syn match ocamlFullMod "\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith | |
7 | 153 |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
154 syn region ocamlFuncWith start="([^*)]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
155 syn region ocamlFuncStruct matchgroup=ocamlStructEncl start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr |
7 | 156 |
5244 | 157 syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained |
7 | 158 syn region ocamlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@ocamlAENoParen,ocamlWith |
5244 | 159 syn match ocamlWith "\<\(\u\(\w\|'\)* *\. *\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlWithRest |
7 | 160 syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@ocamlContained |
161 | |
2833 | 162 " "struct" |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
163 syn region ocamlStruct matchgroup=ocamlStructEncl start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr |
2833 | 164 |
7 | 165 " "module type" |
2833 | 166 syn region ocamlKeyword start="\<module\>\s*\<type\>\(\s*\<of\>\)\=" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef |
5244 | 167 syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s+1 skipwhite skipempty nextgroup=ocamlFullMod |
7 | 168 |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
169 " Quoted strings |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
170 syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{\z\([a-z_]*\)|" end="|\z1}" contains=@Spell |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
171 |
7 | 172 syn keyword ocamlKeyword and as assert class |
173 syn keyword ocamlKeyword constraint else | |
174 syn keyword ocamlKeyword exception external fun | |
175 | |
176 syn keyword ocamlKeyword in inherit initializer | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
177 syn keyword ocamlKeyword lazy let match |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
178 syn keyword ocamlKeyword method mutable new nonrec of |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
179 syn keyword ocamlKeyword parser private rec |
7 | 180 syn keyword ocamlKeyword try type |
2833 | 181 syn keyword ocamlKeyword virtual when while with |
7 | 182 |
183 if exists("ocaml_revised") | |
184 syn keyword ocamlKeyword do value | |
185 syn keyword ocamlBoolean True False | |
186 else | |
187 syn keyword ocamlKeyword function | |
188 syn keyword ocamlBoolean true false | |
189 endif | |
190 | |
550 | 191 syn keyword ocamlType array bool char exn float format format4 |
192 syn keyword ocamlType int int32 int64 lazy_t list nativeint option | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
193 syn keyword ocamlType bytes string unit |
7 | 194 |
195 syn match ocamlConstructor "(\s*)" | |
196 syn match ocamlConstructor "\[\s*\]" | |
197 syn match ocamlConstructor "\[|\s*>|]" | |
198 syn match ocamlConstructor "\[<\s*>\]" | |
199 syn match ocamlConstructor "\u\(\w\|'\)*\>" | |
200 | |
201 " Polymorphic variants | |
202 syn match ocamlConstructor "`\w\(\w\|'\)*\>" | |
203 | |
204 " Module prefix | |
5244 | 205 syn match ocamlModPath "\u\(\w\|'\)* *\."he=e-1 |
7 | 206 |
207 syn match ocamlCharacter "'\\\d\d\d'\|'\\[\'ntbr]'\|'.'" | |
2833 | 208 syn match ocamlCharacter "'\\x\x\x'" |
7 | 209 syn match ocamlCharErr "'\\\d\d'\|'\\\d'" |
210 syn match ocamlCharErr "'\\[^\'ntbr]'" | |
5244 | 211 syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell |
7 | 212 |
213 syn match ocamlTopStop ";;" | |
214 | |
215 syn match ocamlAnyVar "\<_\>" | |
216 syn match ocamlKeyChar "|[^\]]"me=e-1 | |
217 syn match ocamlKeyChar ";" | |
218 syn match ocamlKeyChar "\~" | |
219 syn match ocamlKeyChar "?" | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
220 |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
221 "" Operators |
7 | 222 |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
223 " The grammar of operators is found there: |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
224 " https://caml.inria.fr/pub/docs/manual-ocaml/names.html#operator-name |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
225 " https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:ext-ops |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
226 " https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:index-operators |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
227 " =, *, < and > are both operator names and keywords, we let the user choose how |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
228 " to display them (has to be declared before regular infix operators): |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
229 syn match ocamlEqual "=" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
230 syn match ocamlStar "*" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
231 syn match ocamlAngle "<" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
232 syn match ocamlAngle ">" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
233 " Custom indexing operators: |
23466 | 234 syn region ocamlIndexing matchgroup=ocamlIndexingOp |
235 \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*(" | |
236 \ end=")\(\_s*<-\)\?" | |
237 \ contains=ALLBUT,@ocamlContained,ocamlParenErr | |
238 syn region ocamlIndexing matchgroup=ocamlIndexingOp | |
239 \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*\[" | |
240 \ end="]\(\_s*<-\)\?" | |
241 \ contains=ALLBUT,@ocamlContained,ocamlBrackErr | |
242 syn region ocamlIndexing matchgroup=ocamlIndexingOp | |
243 \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*{" | |
244 \ end="}\(\_s*<-\)\?" | |
245 \ contains=ALLBUT,@ocamlContained,ocamlBraceErr | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
246 " Extension operators (has to be declared before regular infix operators): |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
247 syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
248 " Infix and prefix operators: |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
249 syn match ocamlPrefixOp "![~?!.:|&$%<=>@^*/+-]*" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
250 syn match ocamlPrefixOp "[~?][~?!.:|&$%<=>@^*/+-]\+" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
251 syn match ocamlInfixOp "[&$%@^/+-][~?!.:|&$%<=>@^*/+-]*" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
252 syn match ocamlInfixOp "[|<=>*][~?!.:|&$%<=>@^*/+-]\+" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
253 syn match ocamlInfixOp "#[~?!.:|&$%<=>@^*/+-]\+#\@!" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
254 syn match ocamlInfixOp "!=[~?!.:|&$%<=>@^*/+-]\@!" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
255 syn keyword ocamlInfixOpKeyword asr land lor lsl lsr lxor mod or |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
256 " := is technically an infix operator, but we may want to show it as a keyword |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
257 " (somewhat analogously to = for let‐bindings and <- for assignations): |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
258 syn match ocamlRefAssign ":=" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
259 " :: is technically not an operator, but we may want to show it as such: |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
260 syn match ocamlCons "::" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
261 " -> and <- are keywords, not operators (but can appear in longer operators): |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
262 syn match ocamlArrow "->[~?!.:|&$%<=>@^*/+-]\@!" |
7 | 263 if exists("ocaml_revised") |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
264 syn match ocamlErr "<-[~?!.:|&$%<=>@^*/+-]\@!" |
7 | 265 else |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
266 syn match ocamlKeyChar "<-[~?!.:|&$%<=>@^*/+-]\@!" |
7 | 267 endif |
268 | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
269 syn match ocamlNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
270 syn match ocamlNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
271 syn match ocamlNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
272 syn match ocamlNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>" |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
273 syn match ocamlFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>" |
7 | 274 |
275 " Labels | |
550 | 276 syn match ocamlLabel "\~\(\l\|_\)\(\w\|'\)*"lc=1 |
277 syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1 | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
278 syn region ocamlLabel transparent matchgroup=ocamlLabel start="[~?](\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr |
7 | 279 |
280 | |
281 " Synchronization | |
282 syn sync minlines=50 | |
283 syn sync maxlines=500 | |
284 | |
285 if !exists("ocaml_revised") | |
286 syn sync match ocamlDoSync grouphere ocamlDo "\<do\>" | |
287 syn sync match ocamlDoSync groupthere ocamlDo "\<done\>" | |
288 endif | |
289 | |
290 if exists("ocaml_revised") | |
291 syn sync match ocamlEndSync grouphere ocamlEnd "\<\(object\)\>" | |
292 else | |
293 syn sync match ocamlEndSync grouphere ocamlEnd "\<\(begin\|object\)\>" | |
294 endif | |
295 | |
296 syn sync match ocamlEndSync groupthere ocamlEnd "\<end\>" | |
297 syn sync match ocamlStructSync grouphere ocamlStruct "\<struct\>" | |
298 syn sync match ocamlStructSync groupthere ocamlStruct "\<end\>" | |
299 syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>" | |
300 syn sync match ocamlSigSync groupthere ocamlSig "\<end\>" | |
301 | |
302 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5244
diff
changeset
|
303 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
304 hi def link ocamlBraceErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
305 hi def link ocamlBrackErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
306 hi def link ocamlParenErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
307 hi def link ocamlArrErr Error |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5244
diff
changeset
|
308 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
309 hi def link ocamlCommentErr Error |
7 | 310 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
311 hi def link ocamlCountErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
312 hi def link ocamlDoErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
313 hi def link ocamlDoneErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
314 hi def link ocamlEndErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
315 hi def link ocamlThenErr Error |
7 | 316 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
317 hi def link ocamlCharErr Error |
7 | 318 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
319 hi def link ocamlErr Error |
7 | 320 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
321 hi def link ocamlComment Comment |
7 | 322 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
323 hi def link ocamlModPath Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
324 hi def link ocamlObject Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
325 hi def link ocamlModule Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
326 hi def link ocamlModParam1 Include |
23466 | 327 hi def link ocamlGenMod Include |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
328 hi def link ocamlModType Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
329 hi def link ocamlMPRestr3 Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
330 hi def link ocamlFullMod Include |
23466 | 331 hi def link ocamlFuncWith Include |
332 hi def link ocamlModParam Include | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
333 hi def link ocamlModTypeRestr Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
334 hi def link ocamlWith Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
335 hi def link ocamlMTDef Include |
23466 | 336 hi def link ocamlSigEncl ocamlModule |
337 hi def link ocamlStructEncl ocamlModule | |
7 | 338 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
339 hi def link ocamlScript Include |
7 | 340 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
341 hi def link ocamlConstructor Constant |
7 | 342 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
343 hi def link ocamlVal Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
344 hi def link ocamlModPreRHS Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
345 hi def link ocamlMPRestr2 Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
346 hi def link ocamlKeyword Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
347 hi def link ocamlMethod Include |
23466 | 348 hi def link ocamlArrow Keyword |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
349 hi def link ocamlKeyChar Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
350 hi def link ocamlAnyVar Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
351 hi def link ocamlTopStop Keyword |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
352 |
23466 | 353 hi def link ocamlRefAssign ocamlKeyChar |
354 hi def link ocamlEqual ocamlKeyChar | |
355 hi def link ocamlStar ocamlInfixOp | |
356 hi def link ocamlAngle ocamlInfixOp | |
357 hi def link ocamlCons ocamlInfixOp | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
358 |
23466 | 359 hi def link ocamlPrefixOp ocamlOperator |
360 hi def link ocamlInfixOp ocamlOperator | |
361 hi def link ocamlExtensionOp ocamlOperator | |
362 hi def link ocamlIndexingOp ocamlOperator | |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
363 |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
364 if exists("ocaml_highlight_operators") |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
365 hi def link ocamlInfixOpKeyword ocamlOperator |
23466 | 366 hi def link ocamlOperator Operator |
16971
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
367 else |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
368 hi def link ocamlInfixOpKeyword Keyword |
e18b1c654d09
Update runtime files - Add typescript syntax and indent.
Bram Moolenaar <Bram@vim.org>
parents:
10051
diff
changeset
|
369 endif |
7 | 370 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
371 hi def link ocamlBoolean Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
372 hi def link ocamlCharacter Character |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
373 hi def link ocamlNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
374 hi def link ocamlFloat Float |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
375 hi def link ocamlString String |
23466 | 376 hi def link ocamlQuotedStringDelim Identifier |
7 | 377 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
378 hi def link ocamlLabel Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
379 |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
380 hi def link ocamlType Type |
7 | 381 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
382 hi def link ocamlTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
383 |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
384 hi def link ocamlEncl Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
385 |
23466 | 386 hi def link ocamlPpxEncl ocamlEncl |
7 | 387 |
388 let b:current_syntax = "ocaml" | |
389 | |
23466 | 390 let &cpo = s:keepcpo |
391 unlet s:keepcpo | |
392 | |
7 | 393 " vim: ts=8 |