Remove a bunch of stuff we aren't using

9ddd2161d143a288498711c4e58ca75b6ac01232
Alexis Sellier committed ago 1 parent 15306401
.vim/syntax/haskell.vim +87 -173
1 1
" Vim syntax file
2 2
"
3 3
" Modification of vims Haskell syntax file:
4 4
"   - match types using regular expression
5 -
"   - highlight toplevel functions
6 5
"   - use "syntax keyword" instead of "syntax match" where appropriate
7 6
"   - functions and types in import and module declarations are matched
8 7
"   - removed hs_highlight_more_types (just not needed anymore)
9 8
"   - enable spell checking in comments and strings only
10 9
"   - FFI highlighting
11 10
"   - QuasiQuotation
12 11
"   - top level Template Haskell slices
13 12
"   - PackageImport
14 13
"
15 -
" TODO: find out which vim versions are still supported
16 -
"
17 14
" From Original file:
18 15
" ===================
19 16
"
20 17
" Language:		    Haskell
21 18
" Maintainer:		Haskell Cafe mailinglist <haskell-cafe@haskell.org>
28 25
" of C preprocessor directives, and for pointing out a bug in the
29 26
" end-of-line comment handling.
30 27
"
31 28
" Options-assign a value to these variables to turn the option on:
32 29
"
33 -
" hs_highlight_delimiters - Highlight delimiter characters--users
34 -
"			    with a light-colored background will
35 -
"			    probably want to turn this on.
36 -
" hs_highlight_boolean - Treat True and False as keywords.
37 -
" hs_highlight_types - Treat names of primitive types as keywords.
38 -
" hs_highlight_debug - Highlight names of debugging functions.
39 30
" hs_allow_hash_operator - Don't highlight seemingly incorrect C
40 31
"			   preprocessor directives but assume them to be
41 32
"			   operators
42 -
" 
43 -
" 
33 +
"
44 34
45 -
if version < 600
46 -
  syn clear
47 -
elseif exists("b:current_syntax")
35 +
if exists("b:current_syntax")
48 36
  finish
49 37
endif
50 38
51 39
"syntax sync fromstart "mmhhhh.... is this really ok to do so?
52 40
syntax sync linebreaks=15 minlines=50 maxlines=500
68 56
syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"
69 57
syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
70 58
syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`"
71 59
syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`"
72 60
73 -
" Toplevel Template Haskell support
74 -
"sy match hsTHTopLevel "^[a-z]\(\(.\&[^=]\)\|\(\n[^a-zA-Z0-9]\)\)*"
75 -
sy match hsTHIDTopLevel "^[a-z]\S*" 
76 -
sy match hsTHTopLevel "^\$(\?" nextgroup=hsTHTopLevelName 
77 -
sy match hsTHTopLevelName "[a-z]\S*" contained
78 -
79 61
" Reserved symbols--cannot be overloaded.
80 62
syn match hsDelimiter  "(\|)\|\[\|\]\|,\|;\|_\|{\|}"
81 63
82 64
sy region hsInnerParen start="(" end=")" contained contains=hsInnerParen,hsConSym,hsType,hsVarSym
83 -
sy region hs_InfixOpFunctionName start="^(" end=")\s*[^:`]\(\W\&\S\&[^'\"`()[\]{}@]\)\+"re=s
84 -
    \ contained keepend contains=hsInnerParen,hs_HlInfixOp
85 -
86 -
sy match hs_hlFunctionName "[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained 
87 -
sy match hs_FunctionName "^[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained contains=hs_hlFunctionName
88 -
sy match hs_HighliteInfixFunctionName "`[a-z_][^`]*`" contained
89 -
sy match hs_InfixFunctionName "^\S[^=]*`[a-z_][^`]*`"me=e-1 contained contains=hs_HighliteInfixFunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
90 -
sy match hs_HlInfixOp "\(\W\&\S\&[^`(){}'[\]]\)\+" contained contains=hsString
91 -
sy match hs_InfixOpFunctionName "^\(\(\w\|[[\]{}]\)\+\|\(\".*\"\)\|\('.*'\)\)\s*[^:]=*\(\W\&\S\&[^='\"`()[\]{}@]\)\+"
92 -
    \ contained contains=hs_HlInfixOp,hsCharacter
93 -
94 -
sy match hs_OpFunctionName        "(\(\W\&[^(),\"]\)\+)" contained
95 -
"sy region hs_Function start="^["'a-z_([{]" end="=\(\s\|\n\|\w\|[([]\)" keepend extend
96 -
sy region hs_Function start="^["'a-zA-Z_([{]\(\(.\&[^=]\)\|\(\n\s\)\)*=" end="\(\s\|\n\|\w\|[([]\)" 
97 -
        \ contains=hs_OpFunctionName,hs_InfixOpFunctionName,hs_InfixFunctionName,hs_FunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
98 -
99 -
sy match hs_DeclareFunction "^[a-z_(]\S*\(\s\|\n\)*::" contains=hs_FunctionName,hs_OpFunctionName
100 -
101 -
" hi hs_InfixOpFunctionName guibg=bg
102 -
" hi hs_Function guibg=green
103 -
" hi hs_InfixFunctionName guibg=red
104 -
" hi hs_DeclareFunction guibg=red
105 65
106 66
sy keyword hsStructure data family class where instance default deriving
107 67
sy keyword hsTypedef type newtype
108 68
109 69
sy keyword hsInfix infix infixl infixr
110 70
sy keyword hsStatement  do case of let in
111 71
sy keyword hsConditional if then else
112 72
113 -
"if exists("hs_highlight_types")
114 -
  " Primitive types from the standard prelude and libraries.
115 -
  sy match hsType "\<[A-Z]\(\S\&[^,.]\)*\>"
116 -
  sy match hsType "()"
117 -
"endif
73 +
" Primitive types from the standard prelude and libraries.
74 +
sy match hsType "\<[A-Z]\(\S\&[^,.]\)*\>"
75 +
sy match hsType "()"
118 76
119 -
" Not real keywords, but close.
120 -
if exists("hs_highlight_boolean")
121 -
  " Boolean constants from the standard prelude.
122 -
  syn keyword hsBoolean True False
123 -
endif
77 +
syn keyword hsBoolean True False
124 78
125 79
syn region	hsPackageString	start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
126 -
sy match   hsModuleName  excludenl "\([A-Z]\w*\.\?\)*" contained 
80 +
sy match   hsModuleName  excludenl "\([A-Z]\w*\.\?\)*" contained
127 81
128 -
sy match hsImport "\<import\>\s\+\(qualified\s\+\)\?\(\<\(\w\|\.\)*\>\)" 
82 +
sy match hsImport "\<import\>\s\+\(qualified\s\+\)\?\(\<\(\w\|\.\)*\>\)"
129 83
    \ contains=hsModuleName,hsImportLabel
130 84
    \ nextgroup=hsImportParams,hsImportIllegal skipwhite
131 85
sy keyword hsImportLabel import qualified contained
132 86
133 87
sy match hsImportIllegal "\w\+" contained
138 92
sy match hsImportParams "as\s\+\(\w\+\)" contained
139 93
    \ contains=hsModuleName,hsAsLabel
140 94
    \ nextgroup=hsImportParams,hsImportIllegal skipwhite
141 95
sy match hsImportParams "hiding" contained
142 96
    \ contains=hsHidingLabel
143 -
    \ nextgroup=hsImportParams,hsImportIllegal skipwhite 
97 +
    \ nextgroup=hsImportParams,hsImportIllegal skipwhite
144 98
sy region hsImportParams start="(" end=")" contained
145 99
    \ contains=hsBlockComment,hsLineComment, hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName
146 100
    \ nextgroup=hsImportIllegal skipwhite
147 101
148 -
" hi hsImport guibg=red
149 -
"hi hsImportParams guibg=bg
150 -
"hi hsImportIllegal guibg=bg
151 -
"hi hsModuleName guibg=bg
152 -
153 -
"sy match hsImport		"\<import\>\(.\|[^(]\)*\((.*)\)\?" 
154 -
"         \ contains=hsPackageString,hsImportLabel,hsImportMod,hsModuleName,hsImportList
155 -
"sy keyword hsImportLabel import contained
156 -
"sy keyword hsImportMod		as qualified hiding contained
157 -
"sy region hsImportListInner start="(" end=")" contained keepend extend contains=hs_OpFunctionName
158 -
"sy region  hsImportList matchgroup=hsImportListParens start="("rs=s+1 end=")"re=e-1
159 -
"        \ contained 
160 -
"        \ keepend extend
161 -
"        \ contains=hsType,hsLineComment,hsBlockComment,hs_hlFunctionName,hsImportListInner
162 -
163 -
164 -
165 102
" new module highlighting
166 103
syn region hsDelimTypeExport start="\<[A-Z]\(\S\&[^,.]\)*\>(" end=")" contained
167 104
   \ contains=hsType
168 105
169 106
sy keyword hsExportModuleLabel module contained
170 107
sy match hsExportModule "\<module\>\(\s\|\t\|\n\)*\([A-Z]\w*\.\?\)*" contained contains=hsExportModuleLabel,hsModuleName
171 108
172 109
sy keyword hsModuleStartLabel module contained
173 110
sy keyword hsModuleWhereLabel where contained
174 111
175 -
syn match hsModuleStart "^module\(\s\|\n\)*\(\<\(\w\|\.\)*\>\)\(\s\|\n\)*" 
112 +
syn match hsModuleStart "^module\(\s\|\n\)*\(\<\(\w\|\.\)*\>\)\(\s\|\n\)*"
176 113
  \ contains=hsModuleStartLabel,hsModuleName
177 114
  \ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel
178 115
179 116
syn region hsModuleCommentA start="{-" end="-}"
180 117
  \ contains=hsModuleCommentA,hsCommentTodo,@Spell contained
224 161
sy match hsQQContent ".*" contained
225 162
sy match hsQQEnd "|\]" contained
226 163
sy match hsQQVarID "\[\$\(.\&[^|]\)*|" contained
227 164
sy match hsQQVarIDNew "\[\(.\&[^|]\)*|" contained
228 165
229 -
if exists("hs_highlight_debug")
230 -
  " Debugging functions from the standard prelude.
231 -
  syn keyword hsDebug undefined error trace
232 -
endif
233 -
166 +
" Debugging functions from the standard prelude.
167 +
syn keyword hsDebug undefined error trace
234 168
235 169
" C Preprocessor directives. Shamelessly ripped from c.vim and trimmed
236 170
" First, see whether to flag directive-like lines or not
237 171
if (!exists("hs_allow_hash_operator"))
238 172
    syn match	cError		display "^\s*\(%:\|#\).*$"
239 173
endif
174 +
240 175
" Accept %: for # (C99)
241 176
syn region	cPreCondit	start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCommentError
242 177
syn match	cPreCondit	display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
243 178
syn region	cCppOut		start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
244 179
syn region	cCppOut2	contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cCppSkip
253 188
syn region	cComment	matchgroup=cCommentStart start="/\*" end="\*/" contains=cCommentStartError,cSpaceError contained
254 189
syntax match	cCommentError	display "\*/" contained
255 190
syntax match	cCommentStartError display "/\*"me=e-1 contained
256 191
syn region	cCppString	start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
257 192
258 -
259 -
if version >= 508 || !exists("did_hs_syntax_inits")
260 -
  if version < 508
261 -
    let did_hs_syntax_inits = 1
262 -
    command -nargs=+ HiLink hi link <args>
263 -
  else
264 -
    command -nargs=+ HiLink hi def link <args>
265 -
  endif
266 -
267 -
  HiLink hs_hlFunctionName    Function
268 -
  HiLink hs_HighliteInfixFunctionName Function
269 -
  HiLink hs_HlInfixOp       Function
270 -
  HiLink hs_OpFunctionName  Function
271 -
  HiLink hsTypedef          Typedef
272 -
  HiLink hsVarSym           hsOperator
273 -
  HiLink hsConSym           hsOperator
274 -
  if exists("hs_highlight_delimiters")
275 -
    " Some people find this highlighting distracting.
276 -
	HiLink hsDelimiter        Delimiter
277 -
  endif
278 -
279 -
  HiLink hsModuleStartLabel Structure
280 -
  HiLink hsExportModuleLabel Keyword
281 -
  HiLink hsModuleWhereLabel Structure
282 -
  HiLink hsModuleName       Normal
283 -
  
284 -
  HiLink hsImportIllegal    Error
285 -
  HiLink hsAsLabel          hsImportLabel
286 -
  HiLink hsHidingLabel      hsImportLabel
287 -
  HiLink hsImportLabel      Include
288 -
  HiLink hsImportMod        Include
289 -
  HiLink hsPackageString    hsString
290 -
291 -
  HiLink hsOperator         Operator
292 -
293 -
  HiLink hsInfix            Keyword
294 -
  HiLink hsStructure        Structure
295 -
  HiLink hsStatement        Statement
296 -
  HiLink hsConditional      Conditional
297 -
298 -
  HiLink hsSpecialCharError Error
299 -
  HiLink hsSpecialChar      SpecialChar
300 -
  HiLink hsString           String
301 -
  HiLink hsFFIString        String
302 -
  HiLink hsCharacter        Character
303 -
  HiLink hsNumber           Number
304 -
  HiLink hsFloat            Float
305 -
306 -
  HiLink hsLiterateComment		  hsComment
307 -
  HiLink hsBlockComment     hsComment
308 -
  HiLink hsLineComment      hsComment
309 -
  HiLink hsModuleCommentA   hsComment
310 -
  HiLink hsModuleCommentB   hsComment
311 -
  HiLink hsComment          Comment
312 -
  HiLink hsCommentTodo      Todo
313 -
  HiLink hsPragma           SpecialComment
314 -
  HiLink hsBoolean			  Boolean
315 -
316 -
  if exists("hs_highlight_types")
317 -
      HiLink hsDelimTypeExport  hsType
318 -
      HiLink hsType             Type
319 -
  endif
320 -
321 -
  HiLink hsDebug            Debug
322 -
323 -
  HiLink cCppString         hsString
324 -
  HiLink cCommentStart      hsComment
325 -
  HiLink cCommentError      hsError
326 -
  HiLink cCommentStartError hsError
327 -
  HiLink cInclude           Include
328 -
  HiLink cPreProc           PreProc
329 -
  HiLink cDefine            Macro
330 -
  HiLink cIncluded          hsString
331 -
  HiLink cError             Error
332 -
  HiLink cPreCondit         PreCondit
333 -
  HiLink cComment           Comment
334 -
  HiLink cCppSkip           cCppOut
335 -
  HiLink cCppOut2           cCppOut
336 -
  HiLink cCppOut            Comment
337 -
338 -
  HiLink hsFFIForeign       Keyword
339 -
  HiLink hsFFIImportExport  Structure
340 -
  HiLink hsFFICallConvention Keyword
341 -
  HiLink hsFFISafety         Keyword
342 -
343 -
  HiLink hsTHIDTopLevel   Macro
344 -
  HiLink hsTHTopLevelName Macro
345 -
346 -
  HiLink hsQQVarID Keyword
347 -
  HiLink hsQQVarIDNew Keyword
348 -
  HiLink hsQQEnd   Keyword
349 -
  HiLink hsQQContent String
350 -
351 -
  delcommand HiLink
352 -
endif
193 +
hi def link hsTypedef          Typedef
194 +
hi def link hsVarSym           hsOperator
195 +
hi def link hsConSym           hsOperator
196 +
hi def link hsDelimiter        Delimiter
197 +
198 +
hi def link hsModuleStartLabel Structure
199 +
hi def link hsExportModuleLabel Keyword
200 +
hi def link hsModuleWhereLabel Structure
201 +
hi def link hsModuleName       Normal
202 +
203 +
hi def link hsImportIllegal    Error
204 +
hi def link hsAsLabel          hsImportLabel
205 +
hi def link hsHidingLabel      hsImportLabel
206 +
hi def link hsImportLabel      Include
207 +
hi def link hsImportMod        Include
208 +
hi def link hsPackageString    hsString
209 +
210 +
hi def link hsOperator         Operator
211 +
212 +
hi def link hsInfix            Keyword
213 +
hi def link hsStructure        Structure
214 +
hi def link hsStatement        Statement
215 +
hi def link hsConditional      Conditional
216 +
217 +
hi def link hsSpecialCharError Error
218 +
hi def link hsSpecialChar      SpecialChar
219 +
hi def link hsString           String
220 +
hi def link hsFFIString        String
221 +
hi def link hsCharacter        Character
222 +
hi def link hsNumber           Number
223 +
hi def link hsFloat            Float
224 +
225 +
hi def link hsLiterateComment		  hsComment
226 +
hi def link hsBlockComment     hsComment
227 +
hi def link hsLineComment      hsComment
228 +
hi def link hsModuleCommentA   hsComment
229 +
hi def link hsModuleCommentB   hsComment
230 +
hi def link hsComment          Comment
231 +
hi def link hsCommentTodo      Todo
232 +
hi def link hsPragma           SpecialComment
233 +
hi def link hsBoolean			  Boolean
234 +
235 +
hi def link hsDelimTypeExport  hsType
236 +
hi def link hsType             Type
237 +
238 +
hi def link hsDebug            Debug
239 +
240 +
hi def link cCppString         hsString
241 +
hi def link cCommentStart      hsComment
242 +
hi def link cCommentError      hsError
243 +
hi def link cCommentStartError hsError
244 +
hi def link cInclude           Include
245 +
hi def link cPreProc           PreProc
246 +
hi def link cDefine            Macro
247 +
hi def link cIncluded          hsString
248 +
hi def link cError             Error
249 +
hi def link cPreCondit         PreCondit
250 +
hi def link cComment           Comment
251 +
hi def link cCppSkip           cCppOut
252 +
hi def link cCppOut2           cCppOut
253 +
hi def link cCppOut            Comment
254 +
255 +
hi def link hsFFIForeign       Keyword
256 +
hi def link hsFFIImportExport  Structure
257 +
hi def link hsFFICallConvention Keyword
258 +
hi def link hsFFISafety         Keyword
259 +
260 +
hi def link hsTHIDTopLevel   Macro
261 +
hi def link hsTHTopLevelName Macro
262 +
263 +
hi def link hsQQVarID Keyword
264 +
hi def link hsQQVarIDNew Keyword
265 +
hi def link hsQQEnd   Keyword
266 +
hi def link hsQQContent String
353 267
354 268
let b:current_syntax = "haskell"