Mercurial > vim
comparison runtime/syntax/cabal.vim @ 13960:bbff863d3cae
Updated runtime files.
commit https://github.com/vim/vim/commit/7c63fbc46e218cad266641a743a6c1353c2f00d4
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 17 13:15:23 2018 +0200
Updated runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 17 May 2018 13:30:06 +0200 |
parents | 46763b01cd9a |
children | 17c4178f26ea |
comparison
equal
deleted
inserted
replaced
13959:d61f3e89755d | 13960:bbff863d3cae |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: Haskell Cabal Build file | 2 " Language: Haskell Cabal Build file |
3 " Maintainer: Vincent Berthoux <twinside@gmail.com> | 3 " Author: Vincent Berthoux <twinside@gmail.com> |
4 " File Types: .cabal | 4 " Maintainer: Marcin Szamotulski <profunctor@pm.me> |
5 " Last Change: 2010 May 18 | 5 " Previous Maintainer: Vincent Berthoux <twinside@gmail.com> |
6 " File Types: .cabal | |
7 " Last Change: 15 May 2018 | |
8 " v1.5: Incorporated changes from | |
9 " https://github.com/sdiehl/haskell-vim-proto/blob/master/vim/syntax/cabal.vim | |
10 " Use `syn keyword` instead of `syn match`. | |
11 " Added cabalStatementRegion to limit matches of keywords, which fixes | |
12 " the highlighting of description's value. | |
13 " Added cabalVersionRegion to limit the scope of cabalVersionOperator | |
14 " and cabalVersion matches. | |
15 " Added cabalLanguage keyword. | |
16 " Added calbalTitle, cabalAuthor and cabalMaintainer syntax groups. | |
17 " Added ! and ^>= operators (calbal 2.0) | |
18 " Added build-type keywords | |
19 " v1.4: Add benchmark support, thanks to Simon Meier | |
6 " v1.3: Updated to the last version of cabal | 20 " v1.3: Updated to the last version of cabal |
7 " Added more highlighting for cabal function, true/false | 21 " Added more highlighting for cabal function, true/false |
8 " and version number. Also added missing comment highlighting. | 22 " and version number. Also added missing comment highlighting. |
9 " Cabal known compiler are highlighted too. | 23 " Cabal known compiler are highlighted too. |
10 " | 24 " |
21 " quit when a syntax file was already loaded | 35 " quit when a syntax file was already loaded |
22 if exists("b:current_syntax") | 36 if exists("b:current_syntax") |
23 finish | 37 finish |
24 endif | 38 endif |
25 | 39 |
26 syn keyword cabalCategory Library library Executable executable Flag flag | 40 " this file uses line continuation |
27 syn keyword cabalCategory source-repository Source-Repository | 41 let s:cpo_save = &cpo |
28 | 42 set cpo&vim |
29 syn keyword cabalConditional if else | 43 |
30 syn match cabalOperator "&&\|||\|!\|==\|>=\|<=" | 44 " set iskeyword for this syntax script |
31 syn keyword cabalFunction os arche impl flag | 45 syn iskeyword @,48-57,192-255,- |
32 syn match cabalComment /--.*$/ | 46 |
33 syn match cabalVersion "\d\+\(.\(\d\)\+\)\+" | 47 " Case sensitive matches |
34 | 48 syn case match |
35 syn match cabalTruth "\ctrue" | 49 |
36 syn match cabalTruth "\cfalse" | 50 syn keyword cabalConditional if else |
37 | 51 syn keyword cabalFunction os arche impl flag |
38 syn match cabalCompiler "\cghc" | 52 syn match cabalComment /--.*$/ |
39 syn match cabalCompiler "\cnhc" | 53 |
40 syn match cabalCompiler "\cyhc" | 54 " Case insensitive matches |
41 syn match cabalCompiler "\chugs" | 55 syn case ignore |
42 syn match cabalCompiler "\chbc" | 56 |
43 syn match cabalCompiler "\chelium" | 57 syn keyword cabalCategory contained |
44 syn match cabalCompiler "\cjhc" | 58 \ executable |
45 syn match cabalCompiler "\clhc" | 59 \ library |
46 | 60 \ benchmark |
47 | 61 \ test-suite |
48 syn match cabalStatement "\cauthor" | 62 \ source-repository |
49 syn match cabalStatement "\cbranch" | 63 \ flag |
50 syn match cabalStatement "\cbug-reports" | 64 \ custom-setup |
51 syn match cabalStatement "\cbuild-depends" | 65 syn match cabalCategoryTitle contained /[^{]*\ze{\?/ |
52 syn match cabalStatement "\cbuild-tools" | 66 syn match cabalCategoryRegion |
53 syn match cabalStatement "\cbuild-type" | 67 \ contains=cabalCategory,cabalCategoryTitle |
54 syn match cabalStatement "\cbuildable" | 68 \ nextgroup=cabalCategory skipwhite |
55 syn match cabalStatement "\cc-sources" | 69 \ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|custom-setup\)\+\s*\%(.*$\|$\)/ |
56 syn match cabalStatement "\ccabal-version" | 70 syn keyword cabalTruth true false |
57 syn match cabalStatement "\ccategory" | 71 |
58 syn match cabalStatement "\ccc-options" | 72 " cabalStatementRegion which limits the scope of cabalStatement keywords, this |
59 syn match cabalStatement "\ccopyright" | 73 " way they are not highlighted in description. |
60 syn match cabalStatement "\ccpp-options" | 74 syn region cabalStatementRegion start=+^\s*\(--\)\@<!\k\+\s*:+ end=+:+ |
61 syn match cabalStatement "\cdata-dir" | 75 syn keyword cabalStatement contained containedin=cabalStatementRegion |
62 syn match cabalStatement "\cdata-files" | 76 \ default-language |
63 syn match cabalStatement "\cdefault" | 77 \ default-extensions |
64 syn match cabalStatement "\cdescription" | 78 \ author |
65 syn match cabalStatement "\cexecutable" | 79 \ branch |
66 syn match cabalStatement "\cexposed-modules" | 80 \ bug-reports |
67 syn match cabalStatement "\cexposed" | 81 \ build-depends |
68 syn match cabalStatement "\cextensions" | 82 \ build-tools |
69 syn match cabalStatement "\cextra-lib-dirs" | 83 \ build-type |
70 syn match cabalStatement "\cextra-libraries" | 84 \ buildable |
71 syn match cabalStatement "\cextra-source-files" | 85 \ c-sources |
72 syn match cabalStatement "\cextra-tmp-files" | 86 \ cabal-version |
73 syn match cabalStatement "\cfor example" | 87 \ category |
74 syn match cabalStatement "\cframeworks" | 88 \ cc-options |
75 syn match cabalStatement "\cghc-options" | 89 \ copyright |
76 syn match cabalStatement "\cghc-prof-options" | 90 \ cpp-options |
77 syn match cabalStatement "\cghc-shared-options" | 91 \ data-dir |
78 syn match cabalStatement "\chomepage" | 92 \ data-files |
79 syn match cabalStatement "\chs-source-dirs" | 93 \ default |
80 syn match cabalStatement "\chugs-options" | 94 \ description |
81 syn match cabalStatement "\cinclude-dirs" | 95 \ executable |
82 syn match cabalStatement "\cincludes" | 96 \ exposed-modules |
83 syn match cabalStatement "\cinstall-includes" | 97 \ exposed |
84 syn match cabalStatement "\cld-options" | 98 \ extensions |
85 syn match cabalStatement "\clicense-file" | 99 \ extra-tmp-files |
86 syn match cabalStatement "\clicense" | 100 \ extra-doc-files |
87 syn match cabalStatement "\clocation" | 101 \ extra-lib-dirs |
88 syn match cabalStatement "\cmain-is" | 102 \ extra-libraries |
89 syn match cabalStatement "\cmaintainer" | 103 \ extra-source-files |
90 syn match cabalStatement "\cmodule" | 104 \ exta-tmp-files |
91 syn match cabalStatement "\cname" | 105 \ for example |
92 syn match cabalStatement "\cnhc98-options" | 106 \ frameworks |
93 syn match cabalStatement "\cother-modules" | 107 \ ghc-options |
94 syn match cabalStatement "\cpackage-url" | 108 \ ghc-prof-options |
95 syn match cabalStatement "\cpkgconfig-depends" | 109 \ ghc-shared-options |
96 syn match cabalStatement "\cstability" | 110 \ homepage |
97 syn match cabalStatement "\csubdir" | 111 \ hs-source-dirs |
98 syn match cabalStatement "\csynopsis" | 112 \ hugs-options |
99 syn match cabalStatement "\ctag" | 113 \ include-dirs |
100 syn match cabalStatement "\ctested-with" | 114 \ includes |
101 syn match cabalStatement "\ctype" | 115 \ install-includes |
102 syn match cabalStatement "\cversion" | 116 \ ld-options |
117 \ license | |
118 \ license-file | |
119 \ location | |
120 \ main-is | |
121 \ maintainer | |
122 \ manual | |
123 \ module | |
124 \ name | |
125 \ nhc98-options | |
126 \ other-extensions | |
127 \ other-modules | |
128 \ package-url | |
129 \ pkgconfig-depends | |
130 \ setup-depends | |
131 \ stability | |
132 \ subdir | |
133 \ synopsis | |
134 \ tag | |
135 \ tested-with | |
136 \ type | |
137 \ version | |
138 \ virtual-modules | |
139 | |
140 " operators and version operators | |
141 syn match cabalOperator /&&\|||\|!/ | |
142 syn match cabalVersionOperator contained | |
143 \ /!\|==\|\^\?>=\|<=\|<\|>/ | |
144 " match version: `[%]\@<!` is to exclude `%20` in http addresses. | |
145 syn match cabalVersion contained | |
146 \ /[%$_-]\@<!\<\d\+\%(\.\d\+\)*\%(\.\*\)\?\>/ | |
147 " cabalVersionRegion which limits the scope of cabalVersion pattern. | |
148 syn match cabalVersionRegionA | |
149 \ contains=cabalVersionOperator,cabalVersion | |
150 \ keepend | |
151 \ /\%(==\|\^\?>=\|<=\|<\|>\)\s*\d\+\%(\.\d\+\)*\%(\.\*\)\?\>/ | |
152 " version inside `version: ...` | |
153 syn match cabalVersionRegionB | |
154 \ contains=cabalStatementRegion,cabalVersionOperator,cabalVersion | |
155 \ /^\s*\%(cabal-\)\?version\s*:.*$/ | |
156 | |
157 syn keyword cabalLanguage Haskell98 Haskell2010 | |
158 | |
159 " title region | |
160 syn match cabalName contained /:\@<=.*/ | |
161 syn match cabalNameRegion | |
162 \ contains=cabalStatementRegion,cabalName | |
163 \ nextgroup=cabalStatementRegion | |
164 \ oneline | |
165 \ /^\c\s*name\s*:.*$/ | |
166 | |
167 " author region | |
168 syn match cabalAuthor contained /:\@<=.*/ | |
169 syn match cabalAuthorRegion | |
170 \ contains=cabalStatementRegion,cabalStatement,cabalAuthor | |
171 \ nextgroup=cabalStatementRegion | |
172 \ oneline | |
173 \ /^\c\s*author\s*:.*$/ | |
174 | |
175 " maintainer region | |
176 syn match cabalMaintainer contained /:\@<=.*/ | |
177 syn match cabalMaintainerRegion | |
178 \ contains=cabalStatementRegion,cabalStatement,cabalMaintainer | |
179 \ nextgroup=cabalStatementRegion | |
180 \ oneline | |
181 \ /^\c\s*maintainer\s*:.*$/ | |
182 | |
183 " license region | |
184 syn match cabalLicense contained /:\@<=.*/ | |
185 syn match cabalLicenseRegion | |
186 \ contains=cabalStatementRegion,cabalStatement,cabalLicense | |
187 \ nextgroup=cabalStatementRegion | |
188 \ oneline | |
189 \ /^\c\s*license\s*:.*$/ | |
190 | |
191 " license-file region | |
192 syn match cabalLicenseFile contained /:\@<=.*/ | |
193 syn match cabalLicenseFileRegion | |
194 \ contains=cabalStatementRegion,cabalStatement,cabalLicenseFile | |
195 \ nextgroup=cabalStatementRegion | |
196 \ oneline | |
197 \ /^\c\s*license-file\s*:.*$/ | |
198 | |
199 " tested-with region with compilers and versions | |
200 syn keyword cabalCompiler contained ghc nhc yhc hugs hbc helium jhc lhc | |
201 syn match cabalTestedWithRegion | |
202 \ contains=cabalStatementRegion,cabalStatement,cabalCompiler,cabalVersionRegionA | |
203 \ nextgroup=cabalStatementRegion | |
204 \ oneline | |
205 \ /^\c\s*tested-with\s*:.*$/ | |
206 | |
207 " build type keywords | |
208 syn keyword cabalBuildType contained | |
209 \ simple custom configure | |
210 syn match cabalBuildTypeRegion | |
211 \ contains=cabalStatementRegion,cabalStatement,cabalBuildType | |
212 \ nextgroup=cabalStatementRegion | |
213 \ /^\c\s*build-type\s*:.*$/ | |
103 | 214 |
104 " Define the default highlighting. | 215 " Define the default highlighting. |
105 " Only when an item doesn't have highlighting yet | 216 " Only when an item doesn't have highlighting yet |
106 | 217 hi def link cabalName Title |
107 hi def link cabalVersion Number | 218 hi def link cabalAuthor Normal |
108 hi def link cabalTruth Boolean | 219 hi def link cabalMaintainer Normal |
109 hi def link cabalComment Comment | 220 hi def link cabalCategoryTitle Title |
110 hi def link cabalStatement Statement | 221 hi def link cabalLicense Normal |
111 hi def link cabalCategory Type | 222 hi def link cabalLicenseFile Normal |
112 hi def link cabalFunction Function | 223 hi def link cabalBuildType Keyword |
113 hi def link cabalConditional Conditional | 224 hi def link cabalVersion Number |
114 hi def link cabalOperator Operator | 225 hi def link cabalTruth Boolean |
115 hi def link cabalCompiler Constant | 226 hi def link cabalComment Comment |
227 hi def link cabalStatement Statement | |
228 hi def link cabalLanguage Type | |
229 hi def link cabalCategory Type | |
230 hi def link cabalFunction Function | |
231 hi def link cabalConditional Conditional | |
232 hi def link cabalOperator Operator | |
233 hi def link cabalVersionOperator Operator | |
234 hi def link cabalCompiler Constant | |
116 | 235 |
117 let b:current_syntax = "cabal" | 236 let b:current_syntax = "cabal" |
118 | 237 |
238 let &cpo = s:cpo_save | |
239 unlet! s:cpo_save | |
240 | |
119 " vim: ts=8 | 241 " vim: ts=8 |