Mercurial > vim
annotate runtime/syntax/sml.vim @ 21059:90872dbd2bfe
Added tag v8.2.1080 for changeset 111f877e63d96a2d6e7efeaa7f7555506a99ac9a
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 28 Jun 2020 18:45:05 +0200 |
parents | 46763b01cd9a |
children | 15fa3923cc49 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: SML | |
3 " Filenames: *.sml *.sig | |
659 | 4 " Maintainers: Markus Mottl <markus.mottl@gmail.com> |
20 | 5 " Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it> |
659 | 6 " URL: http://www.ocaml.info/vim/syntax/sml.vim |
1120 | 7 " Last Change: 2006 Oct 23 - Fixed character highlighting bug (MM) |
8 " 2002 Jun 02 - Fixed small typo (MM) | |
20 | 9 " 2001 Nov 20 - Fixed small highlighting bug with modules (MM) |
7 | 10 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
1120
diff
changeset
|
11 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
1120
diff
changeset
|
12 if exists("b:current_syntax") |
7 | 13 finish |
14 endif | |
15 | |
16 " SML is case sensitive. | |
17 syn case match | |
18 | |
19 " lowercase identifier - the standard way to match | |
20 syn match smlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/ | |
21 | |
22 syn match smlKeyChar "|" | |
23 | |
24 " Errors | |
25 syn match smlBraceErr "}" | |
26 syn match smlBrackErr "\]" | |
27 syn match smlParenErr ")" | |
28 syn match smlCommentErr "\*)" | |
29 syn match smlThenErr "\<then\>" | |
30 | |
31 " Error-highlighting of "end" without synchronization: | |
32 " as keyword or as error (default) | |
33 if exists("sml_noend_error") | |
34 syn match smlKeyword "\<end\>" | |
35 else | |
36 syn match smlEndErr "\<end\>" | |
37 endif | |
38 | |
39 " Some convenient clusters | |
40 syn cluster smlAllErrs contains=smlBraceErr,smlBrackErr,smlParenErr,smlCommentErr,smlEndErr,smlThenErr | |
41 | |
42 syn cluster smlAENoParen contains=smlBraceErr,smlBrackErr,smlCommentErr,smlEndErr,smlThenErr | |
43 | |
44 syn cluster smlContained contains=smlTodo,smlPreDef,smlModParam,smlModParam1,smlPreMPRestr,smlMPRestr,smlMPRestr1,smlMPRestr2,smlMPRestr3,smlModRHS,smlFuncWith,smlFuncStruct,smlModTypeRestr,smlModTRWith,smlWith,smlWithRest,smlModType,smlFullMod | |
45 | |
46 | |
47 " Enclosing delimiters | |
48 syn region smlEncl transparent matchgroup=smlKeyword start="(" matchgroup=smlKeyword end=")" contains=ALLBUT,@smlContained,smlParenErr | |
49 syn region smlEncl transparent matchgroup=smlKeyword start="{" matchgroup=smlKeyword end="}" contains=ALLBUT,@smlContained,smlBraceErr | |
50 syn region smlEncl transparent matchgroup=smlKeyword start="\[" matchgroup=smlKeyword end="\]" contains=ALLBUT,@smlContained,smlBrackErr | |
51 syn region smlEncl transparent matchgroup=smlKeyword start="#\[" matchgroup=smlKeyword end="\]" contains=ALLBUT,@smlContained,smlBrackErr | |
52 | |
53 | |
54 " Comments | |
55 syn region smlComment start="(\*" end="\*)" contains=smlComment,smlTodo | |
56 syn keyword smlTodo contained TODO FIXME XXX | |
57 | |
58 | |
59 " let | |
60 syn region smlEnd matchgroup=smlKeyword start="\<let\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr | |
61 | |
62 " local | |
63 syn region smlEnd matchgroup=smlKeyword start="\<local\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr | |
64 | |
65 " abstype | |
66 syn region smlNone matchgroup=smlKeyword start="\<abstype\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr | |
67 | |
68 " begin | |
69 syn region smlEnd matchgroup=smlKeyword start="\<begin\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr | |
70 | |
71 " if | |
72 syn region smlNone matchgroup=smlKeyword start="\<if\>" matchgroup=smlKeyword end="\<then\>" contains=ALLBUT,@smlContained,smlThenErr | |
73 | |
74 | |
75 "" Modules | |
76 | |
77 " "struct" | |
78 syn region smlStruct matchgroup=smlModule start="\<struct\>" matchgroup=smlModule end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr | |
79 | |
80 " "sig" | |
81 syn region smlSig matchgroup=smlModule start="\<sig\>" matchgroup=smlModule end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr,smlModule | |
82 syn region smlModSpec matchgroup=smlKeyword start="\<structure\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contained contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlModTRWith,smlMPRestr | |
83 | |
84 " "open" | |
85 syn region smlNone matchgroup=smlKeyword start="\<open\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*\>" contains=@smlAllErrs,smlComment | |
86 | |
87 " "structure" - somewhat complicated stuff ;-) | |
88 syn region smlModule matchgroup=smlKeyword start="\<\(structure\|functor\)\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlPreDef | |
89 syn region smlPreDef start="."me=e-1 matchgroup=smlKeyword end="\l\|="me=e-1 contained contains=@smlAllErrs,smlComment,smlModParam,smlModTypeRestr,smlModTRWith nextgroup=smlModPreRHS | |
90 syn region smlModParam start="([^*]" end=")" contained contains=@smlAENoParen,smlModParam1 | |
91 syn match smlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=smlPreMPRestr | |
92 | |
93 syn region smlPreMPRestr start="."me=e-1 end=")"me=e-1 contained contains=@smlAllErrs,smlComment,smlMPRestr,smlModTypeRestr | |
94 | |
95 syn region smlMPRestr start=":" end="."me=e-1 contained contains=@smlComment skipwhite skipempty nextgroup=smlMPRestr1,smlMPRestr2,smlMPRestr3 | |
96 syn region smlMPRestr1 matchgroup=smlModule start="\ssig\s\=" matchgroup=smlModule end="\<end\>" contained contains=ALLBUT,@smlContained,smlEndErr,smlModule | |
97 syn region smlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=smlKeyword end="->" contained contains=@smlAllErrs,smlComment,smlModParam skipwhite skipempty nextgroup=smlFuncWith | |
98 syn match smlMPRestr3 "\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*" contained | |
99 syn match smlModPreRHS "=" contained skipwhite skipempty nextgroup=smlModParam,smlFullMod | |
100 syn region smlModRHS start="." end=".\w\|([^*]"me=e-2 contained contains=smlComment skipwhite skipempty nextgroup=smlModParam,smlFullMod | |
101 syn match smlFullMod "\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=smlFuncWith | |
102 | |
103 syn region smlFuncWith start="([^*]"me=e-1 end=")" contained contains=smlComment,smlWith,smlFuncStruct | |
104 syn region smlFuncStruct matchgroup=smlModule start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=smlModule end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr | |
105 | |
106 syn match smlModTypeRestr "\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contained | |
107 syn region smlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@smlAENoParen,smlWith | |
108 syn match smlWith "\<\(\u\(\w\|'\)*\.\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=smlWithRest | |
109 syn region smlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@smlContained | |
110 | |
111 " "signature" | |
112 syn region smlKeyword start="\<signature\>" matchgroup=smlModule end="\<\w\(\w\|'\)*\>" contains=smlComment skipwhite skipempty nextgroup=smlMTDef | |
113 syn match smlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s | |
114 | |
115 syn keyword smlKeyword and andalso case | |
116 syn keyword smlKeyword datatype else eqtype | |
117 syn keyword smlKeyword exception fn fun handle | |
118 syn keyword smlKeyword in infix infixl infixr | |
119 syn keyword smlKeyword match nonfix of orelse | |
120 syn keyword smlKeyword raise handle type | |
121 syn keyword smlKeyword val where while with withtype | |
122 | |
123 syn keyword smlType bool char exn int list option | |
124 syn keyword smlType real string unit | |
125 | |
126 syn keyword smlOperator div mod not or quot rem | |
127 | |
128 syn keyword smlBoolean true false | |
129 syn match smlConstructor "(\s*)" | |
130 syn match smlConstructor "\[\s*\]" | |
131 syn match smlConstructor "#\[\s*\]" | |
132 syn match smlConstructor "\u\(\w\|'\)*\>" | |
133 | |
134 " Module prefix | |
135 syn match smlModPath "\u\(\w\|'\)*\."he=e-1 | |
136 | |
1120 | 137 syn match smlCharacter +#"\\""\|#"."\|#"\\\d\d\d"+ |
7 | 138 syn match smlCharErr +#"\\\d\d"\|#"\\\d"+ |
139 syn region smlString start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
140 | |
141 syn match smlFunDef "=>" | |
142 syn match smlRefAssign ":=" | |
143 syn match smlTopStop ";;" | |
144 syn match smlOperator "\^" | |
145 syn match smlOperator "::" | |
146 syn match smlAnyVar "\<_\>" | |
147 syn match smlKeyChar "!" | |
148 syn match smlKeyChar ";" | |
149 syn match smlKeyChar "\*" | |
150 syn match smlKeyChar "=" | |
151 | |
152 syn match smlNumber "\<-\=\d\+\>" | |
153 syn match smlNumber "\<-\=0[x|X]\x\+\>" | |
154 syn match smlReal "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=[fl]\=\>" | |
155 | |
156 " Synchronization | |
157 syn sync minlines=20 | |
158 syn sync maxlines=500 | |
159 | |
160 syn sync match smlEndSync grouphere smlEnd "\<begin\>" | |
161 syn sync match smlEndSync groupthere smlEnd "\<end\>" | |
162 syn sync match smlStructSync grouphere smlStruct "\<struct\>" | |
163 syn sync match smlStructSync groupthere smlStruct "\<end\>" | |
164 syn sync match smlSigSync grouphere smlSig "\<sig\>" | |
165 syn sync match smlSigSync groupthere smlSig "\<end\>" | |
166 | |
167 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
1120
diff
changeset
|
168 " Only when an item doesn't have highlighting yet |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
1120
diff
changeset
|
169 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
170 hi def link smlBraceErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
171 hi def link smlBrackErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
172 hi def link smlParenErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
173 |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
174 hi def link smlCommentErr Error |
7 | 175 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
176 hi def link smlEndErr Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
177 hi def link smlThenErr Error |
7 | 178 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
179 hi def link smlCharErr Error |
7 | 180 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
181 hi def link smlComment Comment |
7 | 182 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
183 hi def link smlModPath Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
184 hi def link smlModule Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
185 hi def link smlModParam1 Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
186 hi def link smlModType Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
187 hi def link smlMPRestr3 Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
188 hi def link smlFullMod Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
189 hi def link smlModTypeRestr Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
190 hi def link smlWith Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
191 hi def link smlMTDef Include |
7 | 192 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
193 hi def link smlConstructor Constant |
7 | 194 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
195 hi def link smlModPreRHS Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
196 hi def link smlMPRestr2 Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
197 hi def link smlKeyword Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
198 hi def link smlFunDef Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
199 hi def link smlRefAssign Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
200 hi def link smlKeyChar Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
201 hi def link smlAnyVar Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
202 hi def link smlTopStop Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
203 hi def link smlOperator Keyword |
7 | 204 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
205 hi def link smlBoolean Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
206 hi def link smlCharacter Character |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
207 hi def link smlNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
208 hi def link smlReal Float |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
209 hi def link smlString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
210 hi def link smlType Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
211 hi def link smlTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
212 hi def link smlEncl Keyword |
7 | 213 |
214 | |
215 let b:current_syntax = "sml" | |
216 | |
217 " vim: ts=8 |