| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | " Vim syntax file | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | " Language:     Haskell Cabal Build file | 
					
						
							|  |  |  | " Author:	Vincent Berthoux <twinside@gmail.com> | 
					
						
							|  |  |  | " Maintainer:   Marcin Szamotulski <profunctor@pm.me> | 
					
						
							|  |  |  | " Previous Maintainer:	Vincent Berthoux <twinside@gmail.com> | 
					
						
							|  |  |  | " File Types:   .cabal | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  | " Last Change:  22 Oct 2022 | 
					
						
							|  |  |  | " v1.6: Added support for foreign-libraries | 
					
						
							|  |  |  | "       Added highlighting for various fields  | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | " v1.5: Incorporated changes from | 
					
						
							|  |  |  | "       https://github.com/sdiehl/haskell-vim-proto/blob/master/vim/syntax/cabal.vim | 
					
						
							|  |  |  | "       Use `syn keyword` instead of `syn match`. | 
					
						
							|  |  |  | "       Added cabalStatementRegion to limit matches of keywords, which fixes | 
					
						
							|  |  |  | "       the highlighting of description's value. | 
					
						
							|  |  |  | "       Added cabalVersionRegion to limit the scope of cabalVersionOperator | 
					
						
							|  |  |  | "       and cabalVersion matches. | 
					
						
							|  |  |  | "       Added cabalLanguage keyword. | 
					
						
							|  |  |  | "       Added calbalTitle, cabalAuthor and cabalMaintainer syntax groups. | 
					
						
							|  |  |  | "       Added ! and ^>= operators (calbal 2.0) | 
					
						
							|  |  |  | "       Added build-type keywords | 
					
						
							|  |  |  | " v1.4: Add benchmark support, thanks to Simon Meier | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | " v1.3: Updated to the last version of cabal | 
					
						
							|  |  |  | "       Added more highlighting for cabal function, true/false | 
					
						
							|  |  |  | "       and version number. Also added missing comment highlighting. | 
					
						
							|  |  |  | "       Cabal known compiler are highlighted too. | 
					
						
							|  |  |  | " | 
					
						
							|  |  |  | " V1.2: Added cpp-options which was missing. Feature implemented | 
					
						
							|  |  |  | "       by GHC, found with a GHC warning, but undocumented.  | 
					
						
							|  |  |  | "       Whatever... | 
					
						
							|  |  |  | " | 
					
						
							|  |  |  | " v1.1: Fixed operator problems and added ftdetect file | 
					
						
							|  |  |  | "       (thanks to Sebastian Schwarz) | 
					
						
							|  |  |  | " | 
					
						
							|  |  |  | " v1.0: Cabal syntax in vimball format | 
					
						
							|  |  |  | "       (thanks to Magnus Therning) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " quit when a syntax file was already loaded | 
					
						
							|  |  |  | if exists("b:current_syntax") | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | " this file uses line continuation | 
					
						
							|  |  |  | let s:cpo_save = &cpo | 
					
						
							|  |  |  | set cpo&vim | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " set iskeyword for this syntax script | 
					
						
							|  |  |  | syn iskeyword @,48-57,192-255,- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Case sensitive matches | 
					
						
							|  |  |  | syn case match | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | syn keyword cabalConditional	if else | 
					
						
							|  |  |  | syn keyword cabalFunction	os arche impl flag | 
					
						
							|  |  |  | syn match cabalComment		/--.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Case insensitive matches | 
					
						
							|  |  |  | syn case ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | syn keyword cabalCategory contained | 
					
						
							|  |  |  | 	\ executable | 
					
						
							|  |  |  | 	\ library | 
					
						
							|  |  |  | 	\ benchmark | 
					
						
							|  |  |  | 	\ test-suite | 
					
						
							|  |  |  | 	\ source-repository | 
					
						
							|  |  |  | 	\ flag | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ foreign-library | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ custom-setup | 
					
						
							| 
									
										
										
										
											2020-10-11 13:57:40 +02:00
										 |  |  | 	\ common | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | syn match cabalCategoryTitle contained /[^{]*\ze{\?/ | 
					
						
							|  |  |  | syn match cabalCategoryRegion | 
					
						
							|  |  |  | 	\ contains=cabalCategory,cabalCategoryTitle | 
					
						
							|  |  |  | 	\ nextgroup=cabalCategory skipwhite | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  | 	\ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|foreign-library\|custom-setup\|common\)\+\s*\%(.*$\|$\)/ | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | syn keyword cabalTruth true false | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " cabalStatementRegion which limits the scope of cabalStatement keywords, this | 
					
						
							|  |  |  | " way they are not highlighted in description. | 
					
						
							|  |  |  | syn region cabalStatementRegion start=+^\s*\(--\)\@<!\k\+\s*:+ end=+:+ | 
					
						
							|  |  |  | syn keyword cabalStatement contained containedin=cabalStatementRegion | 
					
						
							|  |  |  | 	\ default-language | 
					
						
							|  |  |  | 	\ default-extensions | 
					
						
							|  |  |  | 	\ author | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ autogen-includes | 
					
						
							| 
									
										
										
										
											2020-10-11 13:57:40 +02:00
										 |  |  |         \ autogen-modules | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ asm-sources | 
					
						
							|  |  |  |         \ asm-options | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ branch | 
					
						
							|  |  |  | 	\ bug-reports | 
					
						
							|  |  |  | 	\ build-depends | 
					
						
							|  |  |  | 	\ build-tools | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ build-tool-depends | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ build-type | 
					
						
							|  |  |  | 	\ buildable | 
					
						
							|  |  |  | 	\ c-sources | 
					
						
							|  |  |  | 	\ cabal-version | 
					
						
							|  |  |  | 	\ category | 
					
						
							|  |  |  | 	\ cc-options | 
					
						
							|  |  |  | 	\ copyright | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ cmm-sources | 
					
						
							|  |  |  |         \ cmm-options | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ cpp-options | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ cxx-options | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ cxx-sources | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ data-dir | 
					
						
							|  |  |  | 	\ data-files | 
					
						
							|  |  |  | 	\ default | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ default-extensions | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ description | 
					
						
							|  |  |  | 	\ executable | 
					
						
							|  |  |  | 	\ exposed-modules | 
					
						
							|  |  |  | 	\ exposed | 
					
						
							|  |  |  | 	\ extensions | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ extra-bundled-libraries | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ extra-doc-files | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  | 	\ extra-dynamic-library-flavours | 
					
						
							|  |  |  |         \ extra-framework-dirs | 
					
						
							|  |  |  |         \ extra-ghci-libraries | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ extra-lib-dirs | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  | 	\ extra-lib-dirs-static | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ extra-libraries | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  | 	\ extra-libraries-static | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  | 	\ extra-library-flavours | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ extra-source-files | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  | 	\ extra-tmp-files | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ for example | 
					
						
							|  |  |  | 	\ frameworks | 
					
						
							|  |  |  | 	\ ghc-options | 
					
						
							|  |  |  | 	\ ghc-prof-options | 
					
						
							|  |  |  | 	\ ghc-shared-options | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ ghcjs-options | 
					
						
							|  |  |  |         \ ghcjs-prof-options | 
					
						
							|  |  |  |         \ ghcjs-shared-options | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ homepage | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ hs-source-dir | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ hs-source-dirs | 
					
						
							|  |  |  | 	\ hugs-options | 
					
						
							| 
									
										
										
										
											2020-10-11 13:57:40 +02:00
										 |  |  | 	\ import | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ include-dirs | 
					
						
							|  |  |  | 	\ includes | 
					
						
							|  |  |  | 	\ install-includes | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ js-sources | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ ld-options | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ lib-version-info | 
					
						
							|  |  |  |         \ lib-version-linux | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ license | 
					
						
							|  |  |  | 	\ license-file | 
					
						
							|  |  |  | 	\ location | 
					
						
							|  |  |  | 	\ main-is | 
					
						
							|  |  |  | 	\ maintainer | 
					
						
							|  |  |  | 	\ manual | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ mixins | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ module | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ mod-def-file | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ name | 
					
						
							|  |  |  | 	\ nhc98-options | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ options | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ other-extensions | 
					
						
							| 
									
										
										
										
											2020-11-29 14:36:24 +01:00
										 |  |  |         \ other-language | 
					
						
							|  |  |  |         \ other-languages | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ other-modules | 
					
						
							|  |  |  | 	\ package-url | 
					
						
							|  |  |  | 	\ pkgconfig-depends | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ scope | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ setup-depends | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ signatures | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ stability | 
					
						
							|  |  |  | 	\ subdir | 
					
						
							|  |  |  | 	\ synopsis | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ reexported-modules | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ tag | 
					
						
							|  |  |  | 	\ tested-with | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:04 +00:00
										 |  |  |         \ test-module | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | 	\ type | 
					
						
							|  |  |  | 	\ version | 
					
						
							|  |  |  | 	\ virtual-modules | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " operators and version operators | 
					
						
							|  |  |  | syn match cabalOperator /&&\|||\|!/ | 
					
						
							|  |  |  | syn match cabalVersionOperator contained | 
					
						
							|  |  |  | 	\ /!\|==\|\^\?>=\|<=\|<\|>/ | 
					
						
							|  |  |  | " match version: `[%]\@<!` is to exclude `%20` in http addresses. | 
					
						
							|  |  |  | syn match cabalVersion contained | 
					
						
							|  |  |  | 	\ /[%$_-]\@<!\<\d\+\%(\.\d\+\)*\%(\.\*\)\?\>/ | 
					
						
							|  |  |  | " cabalVersionRegion which limits the scope of cabalVersion pattern. | 
					
						
							|  |  |  | syn match cabalVersionRegionA | 
					
						
							|  |  |  | 	\ contains=cabalVersionOperator,cabalVersion | 
					
						
							|  |  |  | 	\ keepend | 
					
						
							|  |  |  | 	\ /\%(==\|\^\?>=\|<=\|<\|>\)\s*\d\+\%(\.\d\+\)*\%(\.\*\)\?\>/ | 
					
						
							|  |  |  | " version inside `version: ...`  | 
					
						
							|  |  |  | syn match cabalVersionRegionB | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalVersionOperator,cabalVersion | 
					
						
							|  |  |  | 	\ /^\s*\%(cabal-\)\?version\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | syn keyword cabalLanguage Haskell98 Haskell2010 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " title region | 
					
						
							|  |  |  | syn match cabalName contained /:\@<=.*/ | 
					
						
							|  |  |  | syn match cabalNameRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalName | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ oneline | 
					
						
							|  |  |  | 	\ /^\c\s*name\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " author region | 
					
						
							|  |  |  | syn match cabalAuthor contained /:\@<=.*/ | 
					
						
							|  |  |  | syn match cabalAuthorRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalStatement,cabalAuthor | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ oneline | 
					
						
							|  |  |  | 	\ /^\c\s*author\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " maintainer region | 
					
						
							|  |  |  | syn match cabalMaintainer contained /:\@<=.*/ | 
					
						
							|  |  |  | syn match cabalMaintainerRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalStatement,cabalMaintainer | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ oneline | 
					
						
							|  |  |  | 	\ /^\c\s*maintainer\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " license region | 
					
						
							|  |  |  | syn match cabalLicense contained /:\@<=.*/ | 
					
						
							|  |  |  | syn match cabalLicenseRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalStatement,cabalLicense | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ oneline | 
					
						
							|  |  |  | 	\ /^\c\s*license\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " license-file region | 
					
						
							|  |  |  | syn match cabalLicenseFile contained /:\@<=.*/ | 
					
						
							|  |  |  | syn match cabalLicenseFileRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalStatement,cabalLicenseFile | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ oneline | 
					
						
							|  |  |  | 	\ /^\c\s*license-file\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " tested-with region with compilers and versions | 
					
						
							|  |  |  | syn keyword cabalCompiler contained ghc nhc yhc hugs hbc helium jhc lhc | 
					
						
							|  |  |  | syn match cabalTestedWithRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalStatement,cabalCompiler,cabalVersionRegionA | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ oneline | 
					
						
							|  |  |  | 	\ /^\c\s*tested-with\s*:.*$/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " build type keywords | 
					
						
							|  |  |  | syn keyword cabalBuildType contained | 
					
						
							|  |  |  | 	\ simple custom configure | 
					
						
							|  |  |  | syn match cabalBuildTypeRegion | 
					
						
							|  |  |  | 	\ contains=cabalStatementRegion,cabalStatement,cabalBuildType | 
					
						
							|  |  |  | 	\ nextgroup=cabalStatementRegion | 
					
						
							|  |  |  | 	\ /^\c\s*build-type\s*:.*$/ | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Define the default highlighting. | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " Only when an item doesn't have highlighting yet | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | hi def link cabalName	      Title | 
					
						
							|  |  |  | hi def link cabalAuthor	      Normal | 
					
						
							|  |  |  | hi def link cabalMaintainer   Normal | 
					
						
							|  |  |  | hi def link cabalCategoryTitle Title | 
					
						
							|  |  |  | hi def link cabalLicense      Normal | 
					
						
							|  |  |  | hi def link cabalLicenseFile  Normal | 
					
						
							|  |  |  | hi def link cabalBuildType    Keyword | 
					
						
							|  |  |  | hi def link cabalVersion      Number | 
					
						
							|  |  |  | hi def link cabalTruth        Boolean | 
					
						
							|  |  |  | hi def link cabalComment      Comment | 
					
						
							|  |  |  | hi def link cabalStatement    Statement | 
					
						
							|  |  |  | hi def link cabalLanguage     Type | 
					
						
							|  |  |  | hi def link cabalCategory     Type | 
					
						
							|  |  |  | hi def link cabalFunction     Function | 
					
						
							|  |  |  | hi def link cabalConditional  Conditional | 
					
						
							|  |  |  | hi def link cabalOperator     Operator | 
					
						
							|  |  |  | hi def link cabalVersionOperator Operator | 
					
						
							|  |  |  | hi def link cabalCompiler     Constant | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | let b:current_syntax = "cabal" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 13:15:23 +02:00
										 |  |  | let &cpo = s:cpo_save | 
					
						
							|  |  |  | unlet! s:cpo_save | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | " vim: ts=8 |