Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
haskell.vim197 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:		Haskell3" Maintainer:		Haskell Cafe mailinglist <haskell-cafe@haskell.org>4" 			(need to be subscribed to post)5" Last Change:		2024 Mar 28 by Enrico Maria De Angelis <enricomaria.dean6elis@gmail.com>6"			2025 Nov 20 by Vim Project: Allow spaces in backticks #187767" Original Author:	John Williams <jrw@pobox.com>8"9" Thanks to Ryan Crumley for suggestions and John Meacham for10" pointing out bugs. Also thanks to Ian Lynagh and Donald Bruce Stewart11" for providing the inspiration for the inclusion of the handling12" of C preprocessor directives, and for pointing out a bug in the13" end-of-line comment handling.14"15" Options-assign a value to these variables to turn the option on:16"17" hs_highlight_delimiters - Highlight delimiter characters--users18"			    with a light-colored background will19"			    probably want to turn this on.20" hs_highlight_boolean - Treat True and False as keywords.21" hs_highlight_types - Treat names of primitive types as keywords.22" hs_highlight_more_types - Treat names of other common types as keywords.23" hs_highlight_debug - Highlight names of debugging functions.24" hs_allow_hash_operator - Don't highlight seemingly incorrect C25"			   preprocessor directives but assume them to be26"			   operators27"28" 2004 Feb 19: Added C preprocessor directive handling, corrected eol comments29"	       cleaned away literate haskell support (should be entirely in30"	       lhaskell.vim)31" 2004 Feb 20: Cleaned up C preprocessor directive handling, fixed single \32"	       in eol comment character class33" 2004 Feb 23: Made the leading comments somewhat clearer where it comes34"	       to attribution of work.35" 2008 Dec 15: Added comments as contained element in import statements36 37" quit when a syntax file was already loaded38if exists("b:current_syntax")39  finish40endif41 42" (Qualified) identifiers (no default highlighting)43syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell44syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell45 46" Infix operators--most punctuation characters and any (qualified) identifier47" enclosed in `backquotes`. An operator starting with : is a constructor,48" others are variables (e.g. functions).49syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"50syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"51syn match hsVarSym "` *\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']* *`"52syn match hsConSym "` *\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']* *`"53 54" (Non-qualified) identifiers which start with # are labels55syn match hsLabel "#[a-z][a-zA-Z0-9_']*\>"56 57" Reserved symbols--cannot be overloaded.58syn match hsDelimiter  "(\|)\|\[\|\]\|,\|;\|{\|}"59 60" Strings and constants61syn match   hsSpecialChar	contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"62syn match   hsSpecialChar	contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)"63syn match   hsSpecialCharError	contained "\\&\|'''\+"64syn region  hsString		start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=hsSpecialChar,@NoSpell65syn match   hsCharacter		"[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError66syn match   hsCharacter		"^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError67syn match   hsNumber		"\v<[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*>|<0[oO]_*%(_*[0-7])*>|<0[bB]_*[01]%(_*[01])*>"68syn match   hsFloat		"\v<[0-9]%(_*[0-9])*\.[0-9]%(_*[0-9])*%(_*[eE][-+]?[0-9]%(_*[0-9])*)?>|<[0-9]%(_*[0-9])*_*[eE][-+]?[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*\.[0-9a-fA-F]%(_*[0-9a-fA-F])*%(_*[pP][-+]?[0-9]%(_*[0-9])*)?>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*_*[pP][-+]?[0-9]%(_*[0-9])*>"69 70" Keyword definitions.71syn keyword hsModule		module72syn match   hsImportGroup	"\<import\>.*" contains=hsImport,hsImportModuleName,hsImportMod,hsLineComment,hsBlockComment,hsImportList,@NoSpell nextgroup=hsImport73syn keyword hsImport import contained nextgroup=hsImportModuleName74syn match   hsImportModuleName '\<[A-Z][A-Za-z.]*' contained75syn region  hsImportList start='(' skip='([^)]\{-})' end=')' keepend contained contains=ConId,VarId,hsDelimiter,hsBlockComment,hsTypedef,@NoSpell76 77syn keyword hsImportMod contained as qualified hiding78syn keyword hsInfix infix infixl infixr79syn keyword hsStructure class data deriving instance default where80syn keyword hsTypedef type81syn keyword hsNewtypedef newtype82syn keyword hsTypeFam family83syn keyword hsStatement mdo do case of let in84syn keyword hsConditional if then else85 86" Not real keywords, but close.87if exists("hs_highlight_boolean")88  " Boolean constants from the standard prelude.89  syn keyword hsBoolean True False90endif91if exists("hs_highlight_types")92  " Primitive types from the standard prelude and libraries.93  syn keyword hsType Int Integer Char Bool Float Double IO Void Addr Array String94endif95if exists("hs_highlight_more_types")96  " Types from the standard prelude libraries.97  syn keyword hsType Maybe Either Ratio Complex Ordering IOError IOResult ExitCode98  syn keyword hsMaybe Nothing99  syn keyword hsExitCode ExitSuccess100  syn keyword hsOrdering GT LT EQ101endif102if exists("hs_highlight_debug")103  " Debugging functions from the standard prelude.104  syn keyword hsDebug undefined error trace105endif106 107 108" Comments109syn match   hsLineComment      "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=hsTodo,@Spell110syn region  hsBlockComment     start="{-"  end="-}" contains=hsBlockComment,hsTodo,@Spell111syn region  hsPragma	       start="{-#" end="#-}"112 113syn keyword hsTodo	        contained FIXME TODO XXX NOTE114 115" C Preprocessor directives. Shamelessly ripped from c.vim and trimmed116" First, see whether to flag directive-like lines or not117if (!exists("hs_allow_hash_operator"))118    syn match	cError		display "^\s*\(%:\|#\).*$"119endif120" Accept %: for # (C99)121syn region	cPreCondit	start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCommentError122syn match	cPreCondit	display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"123syn region	cCppOut		start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2124syn region	cCppOut2	contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cCppSkip125syn region	cCppSkip	contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cCppSkip126syn region	cIncluded	display contained start=+"+ skip=+\\\\\|\\"+ end=+"+127syn match	cIncluded	display contained "<[^>]*>"128syn match	cInclude	display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded129syn cluster	cPreProcGroup	contains=cPreCondit,cIncluded,cInclude,cDefine,cCppOut,cCppOut2,cCppSkip,cCommentStartError130syn region	cDefine		matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$"131syn region	cPreProc	matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend132 133syn region	cComment	matchgroup=cCommentStart start="/\*" end="\*/" contains=cCommentStartError,cSpaceError contained134syntax match	cCommentError	display "\*/" contained135syntax match	cCommentStartError display "/\*"me=e-1 contained136syn region	cCppString	start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained137 138" Define the default highlighting.139" Only when an item doesn't have highlighting yet140 141hi def link hsModule			  hsStructure142hi def link hsImport			  Include143hi def link hsImportMod			  hsImport144hi def link hsInfix			  PreProc145hi def link hsStructure			  Structure146hi def link hsStatement			  Statement147hi def link hsConditional		  Conditional148hi def link hsSpecialChar		  SpecialChar149hi def link hsTypedef			  Typedef150hi def link hsNewtypedef		  Typedef151hi def link hsVarSym			  hsOperator152hi def link hsConSym			  hsOperator153hi def link hsOperator			  Operator154hi def link hsTypeFam			  Structure155if exists("hs_highlight_delimiters")156" Some people find this highlighting distracting.157hi def link hsDelimiter			  Delimiter158endif159hi def link hsSpecialCharError		  Error160hi def link hsString			  String161hi def link hsCharacter			  Character162hi def link hsNumber			  Number163hi def link hsFloat			  Float164hi def link hsConditional			  Conditional165hi def link hsLiterateComment		  hsComment166hi def link hsBlockComment		  hsComment167hi def link hsLineComment			  hsComment168hi def link hsComment			  Comment169hi def link hsTodo			  Todo170hi def link hsPragma			  SpecialComment171hi def link hsBoolean			  Boolean172hi def link hsType			  Type173hi def link hsMaybe			  hsEnumConst174hi def link hsOrdering			  hsEnumConst175hi def link hsEnumConst			  Constant176hi def link hsDebug			  Debug177hi def link hsLabel			  Special178 179hi def link cCppString			  hsString180hi def link cCommentStart		  hsComment181hi def link cCommentError		  hsError182hi def link cCommentStartError		  hsError183hi def link cInclude			  Include184hi def link cPreProc			  PreProc185hi def link cDefine			  Macro186hi def link cIncluded			  hsString187hi def link cError			  Error188hi def link cPreCondit			  PreCondit189hi def link cComment			  Comment190hi def link cCppSkip			  cCppOut191hi def link cCppOut2			  cCppOut192hi def link cCppOut			  Comment193 194let b:current_syntax = "haskell"195 196" Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim197 
codekingpro/portable-devtools · Team Ai