179 lines
6.1 KiB
VimL
179 lines
6.1 KiB
VimL
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1
|
|
|
|
" Vim syntax file
|
|
" Language: Haskell Cabal Build file
|
|
" Maintainer: Vincent Berthoux <twinside@gmail.com>
|
|
" File Types: .cabal
|
|
" Last Change: 2010 May 18
|
|
" 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)
|
|
|
|
" quit when a syntax file was already loaded
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
syn keyword cabalCategory Library library Executable executable Flag flag
|
|
syn keyword cabalCategory source-repository Source-Repository
|
|
|
|
syn keyword cabalConditional if else
|
|
syn match cabalOperator "&&\|||\|!\|==\|>=\|<="
|
|
syn keyword cabalFunction os arche impl flag
|
|
syn match cabalComment /--.*$/
|
|
syn match cabalVersion "\d\+\(.\(\d\)\+\)\+"
|
|
|
|
syn match cabalTruth "\ctrue"
|
|
syn match cabalTruth "\cfalse"
|
|
|
|
syn match cabalCompiler "\cghc"
|
|
syn match cabalCompiler "\cnhc"
|
|
syn match cabalCompiler "\cyhc"
|
|
syn match cabalCompiler "\chugs"
|
|
syn match cabalCompiler "\chbc"
|
|
syn match cabalCompiler "\chelium"
|
|
syn match cabalCompiler "\cjhc"
|
|
syn match cabalCompiler "\clhc"
|
|
|
|
|
|
syn match cabalStatement "\cauthor"
|
|
syn match cabalStatement "\cbranch"
|
|
syn match cabalStatement "\cbug-reports"
|
|
syn match cabalStatement "\cbuild-depends"
|
|
syn match cabalStatement "\cbuild-tools"
|
|
syn match cabalStatement "\cbuild-type"
|
|
syn match cabalStatement "\cbuildable"
|
|
syn match cabalStatement "\cc-sources"
|
|
syn match cabalStatement "\ccabal-version"
|
|
syn match cabalStatement "\ccategory"
|
|
syn match cabalStatement "\ccc-options"
|
|
syn match cabalStatement "\ccopyright"
|
|
syn match cabalStatement "\ccpp-options"
|
|
syn match cabalStatement "\cdata-dir"
|
|
syn match cabalStatement "\cdata-files"
|
|
syn match cabalStatement "\cdefault"
|
|
syn match cabalStatement "\cdescription"
|
|
syn match cabalStatement "\cexecutable"
|
|
syn match cabalStatement "\cexposed-modules"
|
|
syn match cabalStatement "\cexposed"
|
|
syn match cabalStatement "\cextensions"
|
|
syn match cabalStatement "\cextra-lib-dirs"
|
|
syn match cabalStatement "\cextra-libraries"
|
|
syn match cabalStatement "\cextra-source-files"
|
|
syn match cabalStatement "\cextra-tmp-files"
|
|
syn match cabalStatement "\cfor example"
|
|
syn match cabalStatement "\cframeworks"
|
|
syn match cabalStatement "\cghc-options"
|
|
syn match cabalStatement "\cghc-prof-options"
|
|
syn match cabalStatement "\cghc-shared-options"
|
|
syn match cabalStatement "\chomepage"
|
|
syn match cabalStatement "\chs-source-dirs"
|
|
syn match cabalStatement "\chugs-options"
|
|
syn match cabalStatement "\cinclude-dirs"
|
|
syn match cabalStatement "\cincludes"
|
|
syn match cabalStatement "\cinstall-includes"
|
|
syn match cabalStatement "\cld-options"
|
|
syn match cabalStatement "\clicense-file"
|
|
syn match cabalStatement "\clicense"
|
|
syn match cabalStatement "\clocation"
|
|
syn match cabalStatement "\cmain-is"
|
|
syn match cabalStatement "\cmaintainer"
|
|
syn match cabalStatement "\cmodule"
|
|
syn match cabalStatement "\cname"
|
|
syn match cabalStatement "\cnhc98-options"
|
|
syn match cabalStatement "\cother-modules"
|
|
syn match cabalStatement "\cpackage-url"
|
|
syn match cabalStatement "\cpkgconfig-depends"
|
|
syn match cabalStatement "\cstability"
|
|
syn match cabalStatement "\csubdir"
|
|
syn match cabalStatement "\csynopsis"
|
|
syn match cabalStatement "\ctag"
|
|
syn match cabalStatement "\ctested-with"
|
|
syn match cabalStatement "\ctype"
|
|
syn match cabalStatement "\cversion"
|
|
|
|
" Define the default highlighting.
|
|
" Only when an item doesn't have highlighting yet
|
|
|
|
hi def link cabalVersion Number
|
|
hi def link cabalTruth Boolean
|
|
hi def link cabalComment Comment
|
|
hi def link cabalStatement Statement
|
|
hi def link cabalCategory Type
|
|
hi def link cabalFunction Function
|
|
hi def link cabalConditional Conditional
|
|
hi def link cabalOperator Operator
|
|
hi def link cabalCompiler Constant
|
|
|
|
let b:current_syntax = "cabal"
|
|
|
|
" vim: ts=8
|
|
|
|
endif
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
|
|
|
" syntax highlighting for cabal
|
|
"
|
|
" author: raichoo (raichoo@googlemail.com)
|
|
|
|
if version < 600
|
|
syn clear
|
|
elseif exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
syn match cabalLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=@Spell
|
|
syn match cabalIdentifier "[A-Za-z\-]*" contained
|
|
syn match cabalOperator "[<=>&|!]"
|
|
syn match cabalColon ":" contained
|
|
syn match cabalNumber "\<[0-9][0-9\.*]*\>"
|
|
syn match cabalDelimiter "[,()]"
|
|
syn keyword cabalBool True False
|
|
syn keyword cabalConditional if else
|
|
syn match cabalCompilerFlag "\s\+-[^ -][^ ]*"
|
|
syn match cabalDocBulletPoint "^\s\+\*"
|
|
syn match cabalDocHeadline "^\s\+=.*$"
|
|
syn match cabalDocCode "^\s\+>.*$"
|
|
syn match cabalDocNewline "^\s\+\.\s*$"
|
|
syn match cabalSection "^\c\(executable\|library\|flag\|source-repository\|test-suite\|benchmark\)"
|
|
syn match cabalEntry "^\s*[A-Za-z][a-zA-Z\-]*:" contains=cabalIdentifier,cabalColon
|
|
|
|
syn region cabalDescription start="^\s*[dD]escription:" end="^\<" keepend
|
|
\ contains=
|
|
\ cabalEntry,
|
|
\ cabalLineComment,
|
|
\ cabalDocBulletPoint,
|
|
\ cabalDocHeadline,
|
|
\ cabalDocNewline,
|
|
\ cabalDocCode
|
|
|
|
highlight def link cabalIdentifier Identifier
|
|
highlight def link cabalLineComment Comment
|
|
highlight def link cabalOperator Operator
|
|
highlight def link cabalColon Operator
|
|
highlight def link cabalNumber Number
|
|
highlight def link cabalSection Structure
|
|
highlight def link cabalDelimiter Delimiter
|
|
highlight def link cabalBool Boolean
|
|
highlight def link cabalCompilerFlag Macro
|
|
highlight def link cabalConditional Conditional
|
|
highlight def link cabalDocBulletPoint Structure
|
|
highlight def link cabalDocHeadline Include
|
|
highlight def link cabalDocNewline Operator
|
|
highlight def link cabalDocCode Macro
|
|
|
|
let b:current_syntax = "cabal"
|
|
|
|
endif
|