Mercurial > vim
annotate runtime/syntax/haskell.vim @ 28380:90d43a367955 v8.2.4715
patch 8.2.4715: Vagrantfile not recognized
Commit: https://github.com/vim/vim/commit/5e1792270a072a96157e5d5e1d6a97414e26d0bf
Author: Julien Voisin <jvoisin@google.com>
Date: Fri Apr 8 19:55:39 2022 +0100
patch 8.2.4715: Vagrantfile not recognized
Problem: Vagrantfile not recognized.
Solution: Recognize Vagrantfile as ruby. (Julien Voisin, closes https://github.com/vim/vim/issues/10119)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 08 Apr 2022 21:00:03 +0200 |
parents | 17c4178f26ea |
children | 8dc97057392b |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: Haskell | |
3 " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org> | |
22565 | 4 " Last Change: 2020 Oct 4 by Marcin Szamotulski <profunctor@pm.me> |
7 | 5 " Original Author: John Williams <jrw@pobox.com> |
6 " | |
7 " Thanks to Ryan Crumley for suggestions and John Meacham for | |
8 " pointing out bugs. Also thanks to Ian Lynagh and Donald Bruce Stewart | |
9 " for providing the inspiration for the inclusion of the handling | |
10 " of C preprocessor directives, and for pointing out a bug in the | |
11 " end-of-line comment handling. | |
12 " | |
13 " Options-assign a value to these variables to turn the option on: | |
14 " | |
15 " hs_highlight_delimiters - Highlight delimiter characters--users | |
16 " with a light-colored background will | |
17 " probably want to turn this on. | |
18 " hs_highlight_boolean - Treat True and False as keywords. | |
19 " hs_highlight_types - Treat names of primitive types as keywords. | |
20 " hs_highlight_more_types - Treat names of other common types as keywords. | |
21 " hs_highlight_debug - Highlight names of debugging functions. | |
22 " hs_allow_hash_operator - Don't highlight seemingly incorrect C | |
23 " preprocessor directives but assume them to be | |
24 " operators | |
25 " | |
26 " 2004 Feb 19: Added C preprocessor directive handling, corrected eol comments | |
27 " cleaned away literate haskell support (should be entirely in | |
28 " lhaskell.vim) | |
29 " 2004 Feb 20: Cleaned up C preprocessor directive handling, fixed single \ | |
30 " in eol comment character class | |
31 " 2004 Feb 23: Made the leading comments somewhat clearer where it comes | |
32 " to attribution of work. | |
2034 | 33 " 2008 Dec 15: Added comments as contained element in import statements |
7 | 34 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
35 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
36 if exists("b:current_syntax") |
7 | 37 finish |
38 endif | |
39 | |
40 " (Qualified) identifiers (no default highlighting) | |
22565 | 41 syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell |
42 syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell | |
7 | 43 |
44 " Infix operators--most punctuation characters and any (qualified) identifier | |
45 " enclosed in `backquotes`. An operator starting with : is a constructor, | |
46 " others are variables (e.g. functions). | |
47 syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*" | |
48 syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*" | |
49 syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`" | |
50 syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`" | |
51 | |
22565 | 52 " (Non-qualified) identifiers which start with # are labels |
53 syn match hsLabel "#[a-z][a-zA-Z0-9_']*\>" | |
54 | |
7 | 55 " Reserved symbols--cannot be overloaded. |
22565 | 56 syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|{\|}" |
7 | 57 |
58 " Strings and constants | |
59 syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" | |
60 syn 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\)" | |
61 syn match hsSpecialCharError contained "\\&\|'''\+" | |
13566 | 62 syn region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar,@NoSpell |
7 | 63 syn match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError |
64 syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError | |
13051 | 65 syn 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])*>" |
66 syn 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])*>" | |
7 | 67 |
22565 | 68 " Keyword definitions. |
69 syn keyword hsModule module | |
70 syn match hsImportGroup "\<import\>.*" contains=hsImport,hsImportModuleName,hsImportMod,hsLineComment,hsBlockComment,hsImportList,@NoSpell nextgroup=hsImport | |
71 syn keyword hsImport import contained nextgroup=hsImportModuleName | |
72 syn match hsImportModuleName '\<[A-Z][A-Za-z.]*' contained | |
73 syn region hsImportList start='(' skip='([^)]\{-})' end=')' keepend contained contains=ConId,VarId,hsDelimiter,hsBlockComment,hsTypedef,@NoSpell | |
74 | |
75 syn keyword hsImportMod contained as qualified hiding | |
76 syn keyword hsInfix infix infixl infixr | |
77 syn keyword hsStructure class data deriving instance default where | |
78 syn keyword hsTypedef type | |
79 syn keyword hsNewtypedef newtype | |
80 syn keyword hsTypeFam family | |
81 syn keyword hsStatement mdo do case of let in | |
82 syn keyword hsConditional if then else | |
7 | 83 |
84 " Not real keywords, but close. | |
85 if exists("hs_highlight_boolean") | |
86 " Boolean constants from the standard prelude. | |
22565 | 87 syn keyword hsBoolean True False |
7 | 88 endif |
89 if exists("hs_highlight_types") | |
90 " Primitive types from the standard prelude and libraries. | |
22565 | 91 syn keyword hsType Int Integer Char Bool Float Double IO Void Addr Array String |
7 | 92 endif |
93 if exists("hs_highlight_more_types") | |
94 " Types from the standard prelude libraries. | |
22565 | 95 syn keyword hsType Maybe Either Ratio Complex Ordering IOError IOResult ExitCode |
96 syn keyword hsMaybe Nothing | |
97 syn keyword hsExitCode ExitSuccess | |
98 syn keyword hsOrdering GT LT EQ | |
7 | 99 endif |
100 if exists("hs_highlight_debug") | |
101 " Debugging functions from the standard prelude. | |
22565 | 102 syn keyword hsDebug undefined error trace |
7 | 103 endif |
104 | |
105 | |
106 " Comments | |
13566 | 107 syn match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=@Spell |
108 syn region hsBlockComment start="{-" end="-}" contains=hsBlockComment,@Spell | |
7 | 109 syn region hsPragma start="{-#" end="#-}" |
110 | |
111 " C Preprocessor directives. Shamelessly ripped from c.vim and trimmed | |
112 " First, see whether to flag directive-like lines or not | |
113 if (!exists("hs_allow_hash_operator")) | |
114 syn match cError display "^\s*\(%:\|#\).*$" | |
115 endif | |
116 " Accept %: for # (C99) | |
117 syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCommentError | |
118 syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>" | |
119 syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2 | |
120 syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cCppSkip | |
121 syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cCppSkip | |
122 syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
123 syn match cIncluded display contained "<[^>]*>" | |
124 syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded | |
125 syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cCppOut,cCppOut2,cCppSkip,cCommentStartError | |
126 syn region cDefine matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" | |
127 syn region cPreProc matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend | |
128 | |
129 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=cCommentStartError,cSpaceError contained | |
130 syntax match cCommentError display "\*/" contained | |
131 syntax match cCommentStartError display "/\*"me=e-1 contained | |
132 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained | |
133 | |
134 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
135 " Only when an item doesn't have highlighting yet |
7 | 136 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
137 hi def link hsModule hsStructure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
138 hi def link hsImport Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
139 hi def link hsImportMod hsImport |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
140 hi def link hsInfix PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
141 hi def link hsStructure Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
142 hi def link hsStatement Statement |
22565 | 143 hi def link hsConditional Conditional |
144 hi def link hsSpecialChar SpecialChar | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
145 hi def link hsTypedef Typedef |
22565 | 146 hi def link hsNewtypedef Typedef |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
147 hi def link hsVarSym hsOperator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
148 hi def link hsConSym hsOperator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
149 hi def link hsOperator Operator |
22565 | 150 hi def link hsTypeFam Structure |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
151 if exists("hs_highlight_delimiters") |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
152 " Some people find this highlighting distracting. |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
153 hi def link hsDelimiter Delimiter |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
154 endif |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
155 hi def link hsSpecialCharError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
156 hi def link hsString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
157 hi def link hsCharacter Character |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
158 hi def link hsNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
159 hi def link hsFloat Float |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
160 hi def link hsConditional Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
161 hi def link hsLiterateComment hsComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
162 hi def link hsBlockComment hsComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
163 hi def link hsLineComment hsComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
164 hi def link hsComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
165 hi def link hsPragma SpecialComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
166 hi def link hsBoolean Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
167 hi def link hsType Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
168 hi def link hsMaybe hsEnumConst |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
169 hi def link hsOrdering hsEnumConst |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
170 hi def link hsEnumConst Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
171 hi def link hsDebug Debug |
22565 | 172 hi def link hsLabel Special |
7 | 173 |
22565 | 174 hi def link cCppString hsString |
175 hi def link cCommentStart hsComment | |
176 hi def link cCommentError hsError | |
177 hi def link cCommentStartError hsError | |
178 hi def link cInclude Include | |
179 hi def link cPreProc PreProc | |
180 hi def link cDefine Macro | |
181 hi def link cIncluded hsString | |
182 hi def link cError Error | |
183 hi def link cPreCondit PreCondit | |
184 hi def link cComment Comment | |
185 hi def link cCppSkip cCppOut | |
186 hi def link cCppOut2 cCppOut | |
187 hi def link cCppOut Comment | |
7 | 188 |
189 let b:current_syntax = "haskell" | |
190 | |
191 " Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim |