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