runtime/cabal: 23515b4ef7580af8b9d3b964a558ab2007cacda5

port cabal, cabalconfig, cabalproject syntax file
This commit is contained in:
Saad Parwaiz 2021-03-03 01:44:57 +00:00
parent 4053b7b1ca
commit af0a9da975
3 changed files with 80 additions and 3 deletions

View File

@ -4,7 +4,7 @@
" Maintainer: Marcin Szamotulski <profunctor@pm.me>
" Previous Maintainer: Vincent Berthoux <twinside@gmail.com>
" File Types: .cabal
" Last Change: 3 Oct 2020
" Last Change: 21 Nov 2020
" 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`.
@ -78,10 +78,13 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ default-extensions
\ author
\ autogen-modules
\ asm-sources
\ asm-options
\ branch
\ bug-reports
\ build-depends
\ build-tools
\ build-tools-depends
\ build-type
\ buildable
\ c-sources
@ -89,33 +92,46 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ category
\ cc-options
\ copyright
\ cmm-sources
\ cmm-options
\ cpp-options
\ cxx-sources
\ data-dir
\ data-files
\ default
\ default-extensions
\ description
\ executable
\ exposed-modules
\ exposed
\ extensions
\ extra-tmp-files
\ extra-bundled-libraries
\ extra-doc-files
\ extra-dynamic-library-flavours
\ extra-framework-dirs
\ extra-ghci-libraries
\ extra-lib-dirs
\ extra-libraries
\ extra-library-flavours
\ extra-source-files
\ exta-tmp-files
\ extra-tmp-files
\ for example
\ frameworks
\ ghc-options
\ ghc-prof-options
\ ghc-shared-options
\ ghcjs-options
\ ghcjs-prof-options
\ ghcjs-shared-options
\ homepage
\ hs-source-dir
\ hs-source-dirs
\ hugs-options
\ import
\ include-dirs
\ includes
\ install-includes
\ js-sources
\ ld-options
\ license
\ license-file
@ -123,10 +139,13 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ main-is
\ maintainer
\ manual
\ mixins
\ module
\ name
\ nhc98-options
\ other-extensions
\ other-language
\ other-languages
\ other-modules
\ package-url
\ pkgconfig-depends

View File

@ -0,0 +1,30 @@
" Vim syntax file
" Language: Cabal Config
" Maintainer: profunctor@pm.me
" Last Change: Marcin Szamotulski
" Original Author: Marcin Szamotulski
if exists("b:current_syntax")
finish
endif
syn match CabalConfigSection /^\S[[:alpha:]]\+\%(-[[:alpha:]]\+\)*[^:]*$/
syn region CabalConfigRegion matchgroup=CabalConfigKey start=/^\s*[[:alpha:]]\+\%(-[[:alpha:]]\+\)*:/ matchgroup=NONE end=/$/ contains=CabalConfigSeparator,CabalConfigKeyword,CabalConfigPath keepend
syn match CabalConfigComment /^\s*--.*$/
syn match CabalConfigValue /.*$/ contained
syn match CabalConfigKey /[[:alpha:]]\+\%(-[[:alpha:]]\+\)*\ze:/
syn keyword CabalConfigSeparator : contained
syn match CabalConfigVariable /\$[[:alpha:]]\+/
syn keyword CabalConfigKeyword True False ghc
syn match CabalConfigPath /\%([[:alpha:]]\+:\)\?\%(\/[[:print:]]\+\)\+/
hi def link CabalConfigComment Comment
hi def link CabalConfigSection Title
hi def link CabalConfigKey Statement
hi def link CabalConfigSeparator NonText
hi def link CabalConfigValue Normal
hi def link CabalConfigVariable Identifier
hi def link CabalConfigKeyword Keyword
hi def link CabalConfigPath Directory
let b:current_syntax = "cabal.config"

View File

@ -0,0 +1,28 @@
" Vim syntax file
" Language: Cabal Project
" Maintainer: profunctor@pm.me
" Last Change: Marcin Szamotulski
" Original Author: Marcin Szamotulski
if exists("b:current_syntax")
finish
endif
syn match CabalProjectComment /^\s*--.*/ contains=@Spell
syn match CabalProjectField /^\w\%(\w\|-\)\+/ contains=@NoSpell
syn keyword CabalProjectBoolean true false True False
syn keyword CabalProjectCompiler ghc ghcjs jhc lhc uhc haskell-suite
syn match CabalProjectNat /\<\d\+\>/
syn keyword CabalProjectJobs $ncpus
syn keyword CabalProjectProfilingLevel default none exported-functions toplevel-functions all-functions
hi def link CabalProjectComment Comment
hi def link CabalProjectField Statement
hi def link CabalProjectBoolean Boolean
hi def link CabalProjectCompiler Identifier
hi def link CabalProjectNat Number
hi def link CabalProjectJobs Number
hi def link CabalProjectProfilingLevel Statement
let b:current_syntax = "cabal.project"