Install vim73
[git/jnareb-git.git] / share / vim / vim73 / syntax / perl6.vim
blob6a3baba747919c2a04ee888d6a2c36b57b385221
1 " Vim syntax file
2 " Language:     Perl 6
3 " Maintainer:   Andy Lester <andy@petdance.com>
4 " Homepage:     http://github.com/petdance/vim-perl/tree/master
5 " Last Change:  2009-07-04
7 " Contributors: Luke Palmer <fibonaci@babylonia.flatirons.org>
8 "               Moritz Lenz <moritz@faui2k3.org>
9 "               Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
11 " This is a big undertaking. Perl 6 is the sort of language that only Perl
12 " can parse. But I'll do my best to get vim to.
14 " You can associate the extension ".pl" with the filetype "perl6" by setting
15 "     autocmd BufNewFile,BufRead *.pl setf perl6
16 " in your ~/.vimrc. But that will infringe on Perl 5, so you might want to
17 " put a modeline near the beginning or end of your Perl 6 files instead:
18 "     # vim: filetype=perl6
20 " TODO:
21 "   * Deal with s:Perl5//
22 "   * m:s// is a match, not a substitution
23 "   * Make these highlight as strings, not operators:
24 "       <==> <=:=> <===> <=~> <« »> «>» «<»
25 "   * Allow more keywords to match as function calls(leave() is export(), etc)
26 "   * Optimization: use nextgroup instead of lookaround (:help syn-nextgroup)
27 "   * Fix s''' substitutions being matched as package names
28 "   * Match s/// and m/// better, so things like "$s/" won't match
29 "   * Add more support for folding (:help syn-fold)
30 "   * Add more syntax syncing hooks (:help syn-sync)
31 "   * Q//:
32 "       :to, :heredoc
33 "       interpolate \q:s{$scalar} (though the spec isn't very clear on it)
35 " Impossible TODO?:
36 "   * Unspace
37 "   * Unicode bracketing characters for quoting (there are so many)
38 "   * Various tricks depending on context. I.e. we can't know when Perl
39 "     expects «*» to be a string or a hyperoperator. The latter is presumably
40 "     more common, so that's what we assume.
41 "   * Selective highlighting of Pod formatting codes with the :allow option
42 "   * Arbitrary number, order, and negation of adverbs to Q//, q//, qq//.
43 "     Currently only the first adverb is considered significant. Anything
44 "     more would require an exponential amount of regexes, making this
45 "     already slow syntax file even slower.
47 " If you want to have Pir code inside Q:PIR// strings highlighted, do:
48 "  let perl6_embedded_pir=1
50 " The above requires pir.vim, which you can find in Parrot's repository:
51 " https://svn.parrot.org/parrot/trunk/editor/
53 " Some less than crucial things have been made optional to speed things up.
54 " Look at the comments near the if/else branches in this file to see exactly
55 " which features are affected. "perl6_extended_all" enables everything.
57 " The defaults are:
59 "  unlet perl6_extended_comments
60 "  unlet perl6_extended_q
61 "  unlet perl6_extended_all
63 " For version 5.x: Clear all syntax items
64 " For version 6.x: Quit when a syntax file was already loaded
65 if version < 600
66     syntax clear
67 elseif exists("b:current_syntax")
68     finish
69 endif
71 " identifiers
72 syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*"
74 " This is used in the for loops below
75 " Don't use the "syn keyword" construct because that always has higher
76 " priority than matches/regions, so the words can't be autoquoted with
77 " the "=>" and "p5=>" operators. All the lookaround stuff is to make sure
78 " we don't match them as part of some other identifier.
79 let s:before_keyword = " display \"\\%(\\k\\|\\K\\@<=[-']\\)\\@<!\\%("
80 let s:after_keyword = "\\)\\%(\\k\\|[-']\\K\\@=\\)\\@!\""
82 " Billions of keywords
83 let s:keywords = {
84  \ "p6Attention": [
85  \   "ACHTUNG ATTN ATTENTION FIXME NB TODO TBD WTF XXX NOTE",
86  \ ],
87  \ "p6DeclareRoutine": [
88  \   "macro sub submethod method multi proto only rule token regex category",
89  \ ],
90  \ "p6Module": [
91  \   "module class role package enum grammar slang subset",
92  \ ],
93  \ "p6Variable": [
94  \   "self",
95  \ ],
96  \ "p6Include": [
97  \   "use require",
98  \ ],
99  \ "p6Conditional": [
100  \   "if else elsif unless",
101  \ ],
102  \ "p6VarStorage": [
103  \   "let my our state temp has constant",
104  \ ],
105  \ "p6Repeat": [
106  \   "for loop repeat while until gather given",
107  \ ],
108  \ "p6FlowControl": [
109  \   "take do when next last redo return contend maybe defer",
110  \   "default exit make continue break goto leave async lift",
111  \ ],
112  \ "p6TypeConstraint": [
113  \   "is as but trusts of returns handles where augment supersede",
114  \ ],
115  \ "p6ClosureTrait": [
116  \   "BEGIN CHECK INIT START FIRST ENTER LEAVE KEEP",
117  \   "UNDO NEXT LAST PRE POST END CATCH CONTROL TEMP",
118  \ ],
119  \ "p6Exception": [
120  \   "die fail try warn",
121  \ ],
122  \ "p6Property": [
123  \   "prec irs ofs ors export deep binary unary reparsed rw parsed cached",
124  \   "readonly defequiv will ref copy inline tighter looser equiv assoc",
125  \   "required",
126  \ ],
127  \ "p6Number": [
128  \   "NaN Inf",
129  \ ],
130  \ "p6Pragma": [
131  \   "oo fatal",
132  \ ],
133  \ "p6Type": [
134  \   "Object Any Junction Whatever Capture Match",
135  \   "Signature Proxy Matcher Package Module Class",
136  \   "Grammar Scalar Array Hash KeyHash KeySet KeyBag",
137  \   "Pair List Seq Range Set Bag Mapping Void Undef",
138  \   "Failure Exception Code Block Routine Sub Macro",
139  \   "Method Submethod Regex Str Blob Char Byte",
140  \   "Codepoint Grapheme StrPos StrLen Version Num",
141  \   "Complex num complex Bit bit bool True False",
142  \   "Increasing Decreasing Ordered Callable AnyChar",
143  \   "Positional Associative Ordering KeyExtractor",
144  \   "Comparator OrderingPair IO KitchenSink Role",
145  \   "Int int int1 int2 int4 int8 int16 int32 int64",
146  \   "Rat rat rat1 rat2 rat4 rat8 rat16 rat32 rat64",
147  \   "Buf buf buf1 buf2 buf4 buf8 buf16 buf32 buf64",
148  \   "UInt uint uint1 uint2 uint4 uint8 uint16 uint32",
149  \   "uint64 Abstraction utf8 utf16 utf32",
150  \ ],
151  \ "p6Operator": [
152  \   "div x xx mod also leg cmp before after eq ne le lt",
153  \   "gt ge eqv ff fff and andthen Z X or xor",
154  \   "orelse extra m mm rx s tr",
155  \ ],
156 \ }
158 for [group, words] in items(s:keywords)
159     let s:words_space = join(words, " ")
160     let s:temp = split(s:words_space)
161     let s:words = join(s:temp, "\\|")
162     exec "syn match ". group ." ". s:before_keyword . s:words . s:after_keyword
163 endfor
164 unlet s:keywords s:words_space s:temp s:words
166 " More operators
167 " Don't put a "\+" at the end of the character class. That makes it so
168 " greedy that the "%" " in "+%foo" won't be allowed to match as a sigil,
169 " among other things
170 syn match p6Operator display "[-+/*~?|=^!%&,<>.;\\]"
171 syn match p6Operator display "\%(:\@<!::\@!\|::=\|\.::\)"
172 " these require whitespace on the left side
173 syn match p6Operator display "\%(\s\|^\)\@<=\%(xx=\|p5=>\)"
174 " "i" requires a digit to the left, and no keyword char to the right
175 syn match p6Operator display "\d\@<=i\k\@!"
176 " index overloading
177 syn match p6Operator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)"
179 " all infix operators except nonassocative ones
180 let s:infix_a = [
181     \ "div % mod +& +< +> \\~& ?& \\~< \\~> +| +\\^ \\~| \\~\\^ ?| ?\\^ xx x",
182     \ "\\~ && & also <== ==> <<== ==>> == != < <= > >= \\~\\~ eq ne lt le gt",
183     \ "ge =:= === eqv before after \\^\\^ min max \\^ff ff\\^ \\^ff\\^",
184     \ "\\^fff fff\\^ \\^fff\\^ fff ff ::= := \\.= => , : p5=> Z minmax",
185     \ "\\.\\.\\. and andthen or orelse xor \\^ += -= /= \\*= \\~= //= ||=",
186     \ "+ - \\*\\* \\* // / \\~ || |",
187 \ ]
188 " nonassociative infix operators
189 let s:infix_n = "but does <=> leg cmp \\.\\. \\.\\.\\^\\^ \\^\\.\\. \\^\\.\\.\\^"
191 let s:infix_a_long = join(s:infix_a, " ")
192 let s:infix_a_words = split(s:infix_a_long)
193 let s:infix_a_pattern = join(s:infix_a_words, "\\|")
195 let s:infix_n_words = split(s:infix_n)
196 let s:infix_n_pattern = join(s:infix_n_words, "\\|")
198 let s:both = [s:infix_a_pattern, s:infix_n_pattern]
199 let s:infix = join(s:both, "\\|")
201 let s:infix_assoc = "!\\?\\%(" . s:infix_a_pattern . "\\)"
202 let s:infix = "!\\?\\%(" . s:infix . "\\)"
204 unlet s:infix_a s:infix_a_long s:infix_a_words s:infix_a_pattern
205 unlet s:infix_n s:infix_n_pattern s:both
207 " [+] reduce
208 exec "syn match p6ReduceOp display \"\\k\\@<!\\[[R\\\\]\\?!\\?". s:infix_assoc ."]\\%(«\\|<<\\)\\?\""
209 unlet s:infix_assoc
211 " Reverse and cross operators (Rop, Xop)
212 exec "syn match p6ReverseCrossOp display \"[RX]". s:infix ."\""
214 " q() or whatever() is always a function call
215 syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*(\@="
217 " basically all builtins that can be followed by parentheses
218 let s:routines = [
219  \ "eager hyper substr index rindex grep map sort join lines hints chmod",
220  \ "split reduce min max reverse truncate zip cat roundrobin classify",
221  \ "first sum keys values pairs defined delete exists elems end kv any",
222  \ "all one wrap shape key value name pop push shift splice unshift floor",
223  \ "ceiling abs exp log log10 rand sign sqrt sin cos tan round strand",
224  \ "roots cis unpolar polar atan2 pick chop p5chop chomp p5chomp lc",
225  \ "lcfirst uc ucfirst capitalize normalize pack unpack quotemeta comb",
226  \ "samecase sameaccent chars nfd nfc nfkd nfkc printf sprintf caller",
227  \ "evalfile run runinstead nothing want bless chr ord gmtime time eof",
228  \ "localtime gethost getpw chroot getlogin getpeername kill fork wait",
229  \ "perl graphs codes bytes clone print open read write readline say seek",
230  \ "close opendir readdir slurp pos fmt vec link unlink symlink uniq pair",
231  \ "asin atan sec cosec cotan asec acosec acotan sinh cosh tanh asinh",
232  \ "acos acosh atanh sech cosech cotanh sech acosech acotanh asech ok",
233  \ "plan_ok dies_ok lives_ok skip todo pass flunk force_todo use_ok isa_ok",
234  \ "diag is_deeply isnt like skip_rest unlike cmp_ok eval_dies_ok nok_error",
235  \ "eval_lives_ok approx is_approx throws_ok version_lt plan eval succ pred",
236  \ "times nonce once signature new connect operator undef undefine sleep",
237  \ "from to infix postfix prefix circumfix postcircumfix minmax lazy count",
238  \ "unwrap getc pi e context void quasi body each contains rewinddir subst",
239  \ "can isa flush arity assuming rewind callwith callsame nextwith nextsame",
240  \ "attr eval_elsewhere none srand trim trim_start trim_end lastcall WHAT",
241  \ "WHERE HOW WHICH VAR WHO WHENCE ACCEPTS REJECTS does not true iterator by",
242  \ "re im invert flip",
243 \ ]
245 " we want to highlight builtins like split() though, so this comes afterwards
246 " TODO: check if this would be faster as one big regex
247 let s:words_space = join(s:routines, " ")
248 let s:temp = split(s:words_space)
249 let s:words = join(s:temp, "\\|")
250 exec "syn match p6Routine ". s:before_keyword . s:words . s:after_keyword
251 unlet s:before_keyword s:after_keyword s:words_space s:temp s:words s:routines
253 " packages, must come after all the keywords
254 syn match p6Normal display "\%(::\)\@<=\K\%(\k\|[-']\K\@=\)*"
255 syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*\%(::\)\@="
257 " some standard packages
258 syn match p6Type display "\%(::\|\k\|\K\@<=[-']\)\@<!\%(Order\%(::Same\|::Increase\|::Decrease\)\?\)\%(\k\|[-']\K\@=\)\@!"
259 syn match p6Type display "\%(::\|\k\|\K\@<=[-']\)\@<!\%(Bool\%(::True\|::False\)\?\)\%(\k\|[-']\K\@=\)\@!"
262 syn match p6Shebang    display "\%^#!.*"
263 syn match p6BlockLabel display "\%(^\s*\)\@<=\h\w*\s*::\@!\_s\@="
264 syn match p6Number     display "\k\@<!_\@!\%(\d\|__\@!\)\+_\@<!\%([eE]_\@!+\?\%(\d\|_\)\+\)\?_\@<!"
265 syn match p6Float      display "\k\@<!_\@!\%(\d\|__\@!\)\+_\@<![eE]_\@!-\%(\d\|_\)\+"
266 syn match p6Float      display "\k\@<!_\@<!\%(\d\|__\@!\)*_\@<!\.\@<!\._\@!\.\@!\a\@!\%(\d\|_\)\+_\@<!\%([eE]_\@!\%(\d\|_\)\+\)\?"
268 syn match p6NumberBase display "[obxd]" contained
269 syn match p6Number     display "\<0\%(o[0-7][0-7_]*\)\@="     nextgroup=p6NumberBase
270 syn match p6Number     display "\<0\%(b[01][01_]*\)\@="       nextgroup=p6NumberBase
271 syn match p6Number     display "\<0\%(x\x[[:xdigit:]_]*\)\@=" nextgroup=p6NumberBase
272 syn match p6Number     display "\<0\%(d\d[[:digit:]_]*\)\@="  nextgroup=p6NumberBase
273 syn match p6Number     display "\%(\<0o\)\@<=[0-7][0-7_]*"
274 syn match p6Number     display "\%(\<0b\)\@<=[01][01_]*"
275 syn match p6Number     display "\%(\<0x\)\@<=\x[[:xdigit:]_]*"
276 syn match p6Number     display "\%(\<0d\)\@<=\d[[:digit:]_]*"
278 syn match p6Version    display "\<v\d\@=" nextgroup=p6VersionNum
279 syn match p6VersionNum display "\d\+" nextgroup=p6VersionDot contained
280 syn match p6VersionDot display "\.\%(\d\|\*\)\@=" nextgroup=p6VersionNum contained
282 " try to distinguish the "is" function from the "is" trail auxiliary
283 syn match p6Routine     display "\%(\%(\S\k\@<!\|^\)\s*\)\@<=is\>"
285 " does is a type constraint sometimes
286 syn match p6TypeConstraint display "does\%(\s*\%(\k\|[-']\K\@=\)\)\@="
288 " int is a type sometimes
289 syn match p6Type        display "\<int\>\%(\s*(\|\s\+\d\)\@!"
291 " these Routine names are also Properties, if preceded by "is"
292 syn match p6Property    display "\%(is\s\+\)\@<=\%(signature\|context\|also\|shape\)"
294 " The sigil in ::*Package
295 syn match p6PackageTwigil display "\%(::\)\@<=\*"
297 " $<match>
298 syn region p6MatchVarSigil
299     \ matchgroup=p6Variable
300     \ start="\$\%(<<\@!\)\@="
301     \ end=">\@<="
302     \ contains=p6MatchVar
304 syn region p6MatchVar
305     \ matchgroup=p6Twigil
306     \ start="<"
307     \ end=">"
308     \ contained
310 " Contextualizers
311 syn match p6Context display "\<\%(item\|list\|slice\|hash\)\>"
312 syn match p6Context display "\%(\$\|@\|%\|&\|@@\)(\@="
314 " the "$" placeholder in "$var1, $, var2 = @list"
315 syn match p6Placeholder display "\%(,\s*\)\@<=\$\%(\K\|\%([.^*?=!~]\|:\@<!::\@!\)\)\@!"
316 syn match p6Placeholder display "\$\%(\K\|\%([.^*?=!~]\|:\@<!::\@!\)\)\@!\%(,\s*\)\@="
318 " Quoting
320 " one cluster for every quote adverb
321 syn cluster p6Interp_s
322     \ add=p6InterpScalar
323 syn cluster p6Interp_scalar
324     \ add=p6InterpScalar
326 syn cluster p6Interp_a
327     \ add=p6InterpArray
328 syn cluster p6Interp_array
329     \ add=p6InterpArray
331 syn cluster p6Interp_h
332     \ add=p6InterpHash
333 syn cluster p6Interp_hash
334     \ add=p6InterpHash
336 syn cluster p6Interp_f
337     \ add=p6InterpFunction
338 syn cluster p6Interp_f
339     \ add=p6InterpFunction
341 syn cluster p6Interp_c
342     \ add=p6InterpClosure
343 syn cluster p6Interp_closure
344     \ add=p6InterpClosure
347 if exists("perl6_extended_q") || exists("perl6_extended_all")
348     syn cluster p6Interp_ww
349         \ add=p6StringSQ
350         \ add=p6StringDQ
351     syn cluster p6Interp_quotewords
352         \ add=p6StringSQ
353         \ add=p6StringDQ
354 endif
356 syn cluster p6Interp_q
357     \ add=p6EscQQ
358     \ add=p6EscBackSlash
359 syn cluster p6Interp_single
360     \ add=p6EscQQ
361     \ add=p6EscBackSlash
363 syn cluster p6Interp_b
364     \ add=@p6Interp_q
365     \ add=p6Escape
366     \ add=p6EscOpenCurly
367     \ add=p6EscCodePoint
368     \ add=p6EscHex
369     \ add=p6EscOct
370     \ add=p6EscOctOld
371     \ add=p6EscNull
372 syn cluster p6Interp_backslash
373     \ add=@p6Interp_q
374     \ add=p6Escape
375     \ add=p6EscOpenCurly
376     \ add=p6EscCodePoint
377     \ add=p6EscHex
378     \ add=p6EscOct
379     \ add=p6EscOctOld
380     \ add=p6EscNull
382 syn cluster p6Interp_qq
383     \ add=@p6Interp_scalar
384     \ add=@p6Interp_array
385     \ add=@p6Interp_hash
386     \ add=@p6Interp_function
387     \ add=@p6Interp_closure
388     \ add=@p6Interp_backslash
389 syn cluster p6Interp_double
390     \ add=@p6Interp_scalar
391     \ add=@p6Interp_array
392     \ add=@p6Interp_hash
393     \ add=@p6Interp_function
394     \ add=@p6Interp_closure
395     \ add=@p6Interp_backslash
397 syn region p6InterpScalar
398     \ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
399     \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\|\%(\d\+\|!\|/\|¢\)\)\)"
400     \ end="\z1\zs"
401     \ contained
402     \ contains=TOP
403     \ keepend
405 syn region p6InterpScalar
406     \ matchgroup=p6Context
407     \ start="\$\ze()\@!"
408     \ skip="([^)]*)"
409     \ end=")\zs"
410     \ contained
411     \ contains=TOP
413 syn region p6InterpArray
414     \ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
415     \ end="\z1\zs"
416     \ contained
417     \ contains=TOP
418     \ keepend
420 syn region p6InterpArray
421     \ matchgroup=p6Context
422     \ start="@\ze()\@!"
423     \ start="@@\ze()\@!"
424     \ skip="([^)]*)"
425     \ end=")\zs"
426     \ contained
427     \ contains=TOP
429 syn region p6InterpHash
430     \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
431     \ end="\z1\zs"
432     \ contained
433     \ contains=TOP
434     \ keepend
436 syn region p6InterpHash
437     \ matchgroup=p6Context
438     \ start="%\ze()\@!"
439     \ skip="([^)]*)"
440     \ end=")\zs"
441     \ contained
442     \ contains=TOP
444 syn region p6InterpFunction
445     \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
446     \ end="\z1\zs"
447     \ contained
448     \ contains=TOP
449     \ keepend
451 syn region p6InterpFunction
452     \ matchgroup=p6Context
453     \ start="&\ze()\@!"
454     \ skip="([^)]*)"
455     \ end=")\zs"
456     \ contained
457     \ contains=TOP
459 syn region p6InterpClosure
460     \ start="\\\@<!{}\@!"
461     \ skip="{[^}]*}"
462     \ end="}"
463     \ contained
464     \ contains=TOP
465     \ keepend
467 " generic escape
468 syn match p6Escape          display "\\\S" contained
470 " escaped closing delimiters
471 syn match p6EscQuote        display "\\'" contained
472 syn match p6EscDoubleQuote  display "\\\"" contained
473 syn match p6EscCloseAngle   display "\\>" contained
474 syn match p6EscCloseFrench  display "\\»" contained
475 syn match p6EscBackTick     display "\\`" contained
476 syn match p6EscForwardSlash display "\\/" contained
477 syn match p6EscVerticalBar  display "\\|" contained
478 syn match p6EscExclamation  display "\\!" contained
479 syn match p6EscComma        display "\\," contained
480 syn match p6EscDollar       display "\\\$" contained
481 syn match p6EscCloseCurly   display "\\}" contained
482 syn match p6EscCloseBracket display "\\\]" contained
484 " misc escapes
485 syn match p6EscOctOld    display "\\\d\{1,3}" contained
486 syn match p6EscNull      display "\\0\d\@!" contained
487 syn match p6EscCodePoint display "\%(\\c\)\@<=\%(\d\|\S\|\[\)\@=" contained nextgroup=p6CodePoint
488 syn match p6EscHex       display "\%(\\x\)\@<=\%(\x\|\[\)\@=" contained nextgroup=p6HexSequence
489 syn match p6EscOct       display "\%(\\o\)\@<=\%(\o\|\[\)\@=" contained nextgroup=p6OctSequence
490 syn match p6EscQQ        display "\\qq" contained nextgroup=p6QQSequence
491 syn match p6EscOpenCurly display "\\{" contained
492 syn match p6EscHash      display "\\#" contained
493 syn match p6EscBackSlash display "\\\\" contained
495 syn region p6QQSequence
496     \ matchgroup=p6Escape
497     \ start="\["
498     \ skip="\[[^\]]*]"
499     \ end="]"
500     \ contained
501     \ transparent
502     \ contains=@p6Interp_qq
504 syn match p6CodePoint   display "\%(\d\+\|\S\)" contained
505 syn region p6CodePoint
506     \ matchgroup=p6Escape
507     \ start="\["
508     \ end="]"
509     \ contained
511 syn match p6HexSequence display "\x\+" contained
512 syn region p6HexSequence
513     \ matchgroup=p6Escape
514     \ start="\["
515     \ end="]"
516     \ contained
518 syn match p6OctSequence display "\o\+" contained
519 syn region p6OctSequence
520     \ matchgroup=p6Escape
521     \ start="\["
522     \ end="]"
523     \ contained
525 " matches :key, :!key, :$var, :key<var>, etc
526 " Since we don't know in advance how the adverb ends, we use a trick.
527 " Consume nothing with the start pattern (\ze at the beginning),
528 " while capturing the whole adverb into \z1 and then putting it before
529 " the match start (\zs) of the end pattern.
530 syn region p6Adverb
531     \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)"
532     \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\)\|\%(\K\%(\k\|[-']\K\@=\)*\)\)\)"
533     \ end="\z1\zs"
534     \ contained
535     \ contains=TOP
536     \ keepend
538 " <words>
539 " FIXME: not sure how to distinguish this from the "less than" operator
540 " in all cases. For now, it matches if any of the following is true:
542 " * There is whitespace missing on either side of the "<", since
543 "   people tend to put spaces around "less than"
544 " * It comes after "enum", "for", "any", "all", or "none"
545 " * It's the first or last thing on a line (ignoring whitespace)
546 " * It's preceded by "= "
548 " It never matches when:
550 " * Preceded by [<+~=] (e.g. <<foo>>, =<$foo>)
551 " * Followed by [-=] (e.g. <--, <=, <==)
552 syn region p6StringAngle
553     \ matchgroup=p6Quote
554     \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
555     \ start="\%(\s\|[<+~=]\)\@<!<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
556     \ start="[<+~=]\@<!<\%(\s\|<\|=>\|[-=]\{1,2}>\@!\)\@!"
557     \ start="\%(^\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
558     \ start="[<+~=]\@<!<\%(\s*$\)\@="
559     \ start="\%(=\s\+\)\@=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!"
560     \ skip="\\\@<!\\>"
561     \ end=">"
562     \ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle
564 syn region p6InnerAnglesOne
565     \ matchgroup=p6StringAngle
566     \ start="<"
567     \ skip="\\\@<!\\>"
568     \ end=">"
569     \ transparent
570     \ contained
571     \ contains=p6InnerAnglesOne
573 " <<words>>
574 syn region p6StringAngles
575     \ matchgroup=p6Quote
576     \ start="<<=\@!"
577     \ skip="\\\@<!\\>"
578     \ end=">>"
579     \ contains=p6InnerAnglesTwo,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseAngle,p6Adverb,p6StringSQ,p6StringDQ
581 syn region p6InnerAnglesTwo
582     \ matchgroup=p6StringAngles
583     \ start="<<"
584     \ skip="\\\@<!\\>"
585     \ end=">>"
586     \ transparent
587     \ contained
588     \ contains=p6InnerAnglesTwo
590 " «words»
591 syn region p6StringFrench
592     \ matchgroup=p6Quote
593     \ start="«"
594     \ skip="\\\@<!\\»"
595     \ end="»"
596     \ contains=p6InnerFrench,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseFrench,p6Adverb,p6StringSQ,p6StringDQ
598 syn region p6InnerFrench
599     \ matchgroup=p6StringFrench
600     \ start="«"
601     \ skip="\\\@<!\\»"
602     \ end="»"
603     \ transparent
604     \ contained
605     \ contains=p6InnerFrench
607 " 'string'
608 syn region p6StringSQ
609     \ matchgroup=p6Quote
610     \ start="'"
611     \ skip="\\\@<!\\'"
612     \ end="'"
613     \ contains=@p6Interp_q,p6EscQuote
615 " "string"
616 syn region p6StringDQ
617     \ matchgroup=p6Quote
618     \ start=+"+
619     \ skip=+\\\@<!\\"+
620     \ end=+"+
621     \ contains=@p6Interp_qq,p6EscDoubleQuote
623 " Q// and friends.
625 syn match p6QuoteQ display "\%([Qq]\%(ww\|to\|[qwxsahfcb]\)\?\)\>" nextgroup=p6QPairs skipwhite skipempty
626 syn match p6QPairs contained transparent skipwhite skipempty nextgroup=p6StringQ,p6StringQ_PIR "\%(\_s*:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)*"
628 if exists("perl6_embedded_pir")
629     syn include @p6PIR syntax/pir.vim
630 endif
632 " hardcoded set of delimiters
633 let s:delims = [
634   \ ["\\\"",         "\\\"", "p6EscDoubleQuote",  "\\\\\\@<!\\\\\\\""],
635   \ ["'",            "'",    "p6EscQuote",        "\\\\\\@<!\\\\'"],
636   \ ["/",            "/",    "p6EscForwardSlash", "\\\\\\@<!\\\\/"],
637   \ ["`",            "`",    "p6EscBackTick",     "\\\\\\@<!\\\\`"],
638   \ ["|",            "|",    "p6EscVerticalBar",  "\\\\\\@<!\\\\|"],
639   \ ["!",            "!",    "p6EscExclamation",  "\\\\\\@<!\\\\!"],
640   \ [",",            ",",    "p6EscComma",        "\\\\\\@<!\\\\,"],
641   \ ["\\$",          "\\$",  "p6EscDollar",       "\\\\\\@<!\\\\\\$"],
642   \ ["{",            "}",    "p6EscCloseCurly",   "\\%(\\\\\\@<!\\\\}\\|{[^}]*}\\)"],
643   \ ["<",            ">",    "p6EscCloseAngle",   "\\%(\\\\\\@<!\\\\>\\|<[^>]*>\\)"],
644   \ ["«",            "»",    "p6EscCloseFrench",  "\\%(\\\\\\@<!\\\\»\\|«[^»]*»\\)"],
645   \ ["\\\[",         "]",    "p6EscCloseBracket", "\\%(\\\\\\@<!\\\\]\\|\\[^\\]]*]\\)"],
646   \ ["\\s\\@<=(",    ")",    "p6EscCloseParen",   "\\%(\\\\\\@<!\\\\)\\|([^)]*)\\)"],
647 \ ]
649 " double and triple delimiters too
650 if exists("perl6_extended_q") || exists("perl6_extended_all")
651     call add(s:delims, ["««",           "»»",  "p6EscCloseFrench",  "\\%(\\\\\\@<!\\\\»»\\|««\\%([^»]\\|»»\\@!\\)*»»\\)"])
652     call add(s:delims, ["«««",          "»»»", "p6EscCloseFrench",  "\\%(\\\\\\@<!\\\\»»»\\|«««\\%([^»]\\|»\\%(»»\\)\\@!\\)*»»»\\)"])
653     call add(s:delims, ["{{",           "}}",  "p6EscCloseCurly",   "\\%(\\\\\\@<!\\\\}}\\|{{\\%([^}]\\|}}\\@!\\)*}}\\)"])
654     call add(s:delims, ["{{{",          "}}}", "p6EscCloseCurly",   "\\%(\\\\\\@<!\\\\}}}\\|{{{\\%([^}]\\|}\\%(}}\\)\\@!\\)*}}}\\)"])
655     call add(s:delims, ["\\\[\\\[",     "]]",  "p6EscCloseBracket", "\\%(\\\\\\@<!\\\\]]\\|\\[\\[\\%([^\\]]\\|]]\\@!\\)*]]\\)"])
656     call add(s:delims, ["\\\[\\\[\\\[", "]]]", "p6EscCloseBracket", "\\%(\\\\\\@<!\\\\]]]\\|\\[\\[\\[\\%([^\\]]\\|]\\%(]]\\)\\@!\\)*]]]\\)"])
657     call add(s:delims, ["\\s\\@<=((",   "))",  "p6EscCloseParen",   "\\%(\\\\\\@<!\\\\))\\|((\\%([^)]\\|))\\@!\\)*))\\)"])
658     call add(s:delims, ["\\s\\@<=(((",  ")))", "p6EscCloseParen",   "\\%(\\\\\\@<!\\\\)))\\|(((\\%([^)]\\|)\\%())\\)\\@!\\)*)))\\)"])
659     call add(s:delims, ["\\s\\@<=<<",   ">>",  "p6EscCloseAngle",   "\\%(\\\\\\@<!\\\\>>\\|<<\\%([^>]\\|>>\\@!\\)*>>\\)"])
660     call add(s:delims, ["\\s\\@<=<<<",  ">>>", "p6EscCloseAngle",   "\\%(\\\\\\@<!\\\\>>>\\|<<<\\%([^>]\\|>\\%(>>\\)\\@!\\)*>>>\\)"])
661 endif
663 if !exists("perl6_extended_q") && !exists("perl6_extended_all")
664     " simple version, no special highlighting within the string
665     for [start_delim, end_delim, end_group, skip] in s:delims
666         exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=".end_group." contained"
667     endfor
669     if exists("perl6_embedded_pir")
670         " highlight embedded PIR code
671         for [start_delim, end_delim, end_group, skip] in s:delims
672             exec "syn region p6StringQ_PIR matchgroup=p6Quote start=\"\\%(Q\\s*:PIR\\s*\\)\\@<=".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6PIR,".end_group." contained"
673         endfor
674     endif
675 else
676     let s:before = "syn region p6StringQ matchgroup=p6Quote start=\"\\%("
677     let s:after  = "\\%(\\_s*:!\\?\\K\\%(\\k\\|[-']\\K\\@=\\)*\\%(([^)]*)\\|\\[[^\\]]*]\\|<[^>]*>\\|«[^»]*»\\|{[^}]*}\\)\\?\\)*\\_s*\\)\\@<="
679     let s:adverbs = [
680         \ ["s", "scalar"],
681         \ ["a", "array"],
682         \ ["h", "hash"],
683         \ ["f", "function"],
684         \ ["c", "closure"],
685         \ ["b", "backslash"],
686         \ ["w", "words"],
687         \ ["ww", "quotewords"],
688         \ ["x", "exec"],
689     \ ]
691     " these can't be conjoined with q and qq (e.g. as qqq and qqqq)
692     let s:q_adverbs = [
693         \ ["q", "single"],
694         \ ["qq", "double"],
695     \ ]
697     for [start_delim, end_delim, end_group, skip] in s:delims
698         " Q, q, and qq with any number of (ignored) adverbs
699         exec s:before ."Q". s:after .start_delim."\" end=\"". end_delim ."\""." contained"
700         exec s:before ."q". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q"." contained"
701         exec s:before ."qq". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq"." contained"
703         for [short, long] in s:adverbs
704             " Qs, qs, qqs, Qa, qa, qqa, etc, with ignored adverbs
705             exec s:before ."Q".short. s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long." contained"
706             exec s:before ."q".short. s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long." contained"
707             exec s:before ."qq".short. s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long." contained"
709             " Q, q, and qq, with one significant adverb
710             exec s:before ."Q\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long." contained"
711             for [q_short, q_long] in s:q_adverbs
712                 exec s:before ."Q\\s*:\\%(".q_short."\\|".q_long."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".q_long." contained"
713             endfor
714             exec s:before ."q\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long." contained"
715             exec s:before ."qq\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long." contained"
717             for [short2, long2] in s:adverbs
718                 " Qs, qs, qqs, Qa, qa, qqa, etc, with one significant adverb
719                 exec s:before ."Q".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long.",@p6Interp_".long2." contained"
720                 for [q_short2, q_long2] in s:q_adverbs
721                     exec s:before ."Q".short."\\s*:\\%(".q_short2."\\|".q_long2."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long.",@p6Interp_".q_long2." contained"
722                 endfor
723                 exec s:before ."q".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long.",@p6Interp_".long2." contained"
724                 exec s:before ."qq".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long.",@p6Interp_".long2." contained"
725             endfor
726         endfor
727     endfor
728     unlet s:before s:after s:adverbs s:q_adverbs
729 endif
730 unlet s:delims
732 " Match these so something else above can't. E.g. the "q" in "role q { }"
733 " should not be considered a string
734 syn match p6Normal display "\%(\<\%(role\|grammar\|slang\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*"
736 " :key
737 syn match p6Operator display ":\@<!::\@!!\?" nextgroup=p6Key
738 syn match p6Key display "\k\%(\k\|[-']\K\@=\)*" contained
740 " => and p5=> autoquoting
741 syn match p6StringP5Auto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+p5=>"
742 syn match p6StringAuto   display "\K\%(\k\|[-']\K\@=\)*\ze\%(p5\)\@<!=>"
743 syn match p6StringAuto   display "\K\%(\k\|[-']\K\@=\)*\ze\s\+=>"
744 syn match p6StringAuto   display "\K\%(\k\|[-']\K\@=\)*p5\ze=>"
746 " Hyperoperators. Needs to come after the quoting operators (<>, «», etc)
747 exec "syn match p6HyperOp display \"»"   .s:infix."»\\?\""
748 exec "syn match p6HyperOp display \"«\\?".s:infix."«\""
749 exec "syn match p6HyperOp display \"»"   .s:infix."«\""
750 exec "syn match p6HyperOp display \"«"   .s:infix. "»\""
752 exec "syn match p6HyperOp display \">>"          .s:infix."\\%(>>\\)\\?\""
753 exec "syn match p6HyperOp display \"\\%(<<\\)\\?".s:infix."<<\""
754 exec "syn match p6HyperOp display \">>"          .s:infix."<<\""
755 exec "syn match p6HyperOp display \"<<"          .s:infix.">>\""
756 unlet s:infix
758 " Regexes and grammars
760 syn match p6RegexName display "\%(\<\%(regex\|rule\|token\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*" nextgroup=p6RegexBlockCrap skipwhite skipempty
761 syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained
763 syn region p6RegexBlock
764     \ matchgroup=p6Normal
765     \ start="{"
766     \ end="}"
767     \ contained
768     \ contains=@p6Regexen,@p6Variables
770 " Perl 6 regex bits
772 syn cluster p6Regexen
773     \ add=p6RxMeta
774     \ add=p6RxEscape
775     \ add=p6EscHex
776     \ add=p6EscOct
777     \ add=p6EscNull
778     \ add=p6RxAnchor
779     \ add=p6RxCapture
780     \ add=p6RxGroup
781     \ add=p6RxAlternation
782     \ add=p6RxAdverb
783     \ add=p6RxAdverbArg
784     \ add=p6RxStorage
785     \ add=p6RxAssertion
786     \ add=p6RxQuoteWords
787     \ add=p6RxClosure
788     \ add=p6RxStringSQ
789     \ add=p6RxStringDQ
790     \ add=p6Comment
792 syn match p6RxMeta        display contained ".\%(\k\|\s\)\@<!"
793 syn match p6RxAnchor      display contained "[$^]"
794 syn match p6RxEscape      display contained "\\\S"
795 syn match p6RxCapture     display contained "[()]"
796 syn match p6RxAlternation display contained "|"
797 syn match p6RxRange       display contained "\.\."
799 syn region p6RxClosure
800     \ matchgroup=p6Normal
801     \ start="{"
802     \ end="}"
803     \ contained
804     \ containedin=p6RxClosure
805     \ contains=TOP
806 syn region p6RxGroup
807     \ matchgroup=p6StringSpecial2
808     \ start="\["
809     \ end="]"
810     \ contained
811     \ contains=@p6Regexen,@p6Variables
812 syn region p6RxAssertion
813     \ matchgroup=p6StringSpecial2
814     \ start="<"
815     \ end=">"
816     \ contained
817     \ contains=@p6Regexen,@p6Variables,p6RxCharClass,p6RxAssertCall
818 syn region p6RxAssertCall
819     \ matchgroup=p6Normal
820     \ start="\%(::\|\%(\K\%(\k\|[-']\K\@=\)*\)\)\@<=(\@="
821     \ end=")\@<="
822     \ contained
823     \ contains=TOP
824 syn region p6RxCharClass
825     \ matchgroup=p6StringSpecial2
826     \ start="\%(<[-!+?]\?\)\@<=\["
827     \ skip="\\]"
828     \ end="]"
829     \ contained
830     \ contains=p6RxRange,p6RxEscape,p6EscHex,p6EscOct,p6EscNull
831 syn region p6RxQuoteWords
832     \ matchgroup=p6StringSpecial2
833     \ start="< "
834     \ end=">"
835     \ contained
836 syn region p6RxAdverb
837     \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\)"
838     \ end="\z1\zs"
839     \ contained
840     \ contains=TOP
841     \ keepend
842 syn region p6RxAdverbArg
843     \ start="\%(:!\?\K\%(\k\|[-']\K\@=\)*\)\@<=("
844     \ skip="([^)]*)"
845     \ end=")"
846     \ contained
847     \ contains=TOP
848 syn region p6RxStorage
849     \ matchgroup=p6Operator
850     \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@="
851     \ end="$"
852     \ contains=TOP
853     \ contained
855 " Perl 5 regex bits
857 syn cluster p6RegexP5Base
858     \ add=p6RxP5Escape
859     \ add=p6RxP5Oct
860     \ add=p6RxP5Hex
861     \ add=p6RxP5EscMeta
862     \ add=p6RxP5CodePoint
863     \ add=p6RxP5Prop
865 " normal regex stuff
866 syn cluster p6RegexP5
867     \ add=@p6RegexP5Base
868     \ add=p6RxP5Quantifier
869     \ add=p6RxP5Meta
870     \ add=p6RxP5QuoteMeta
871     \ add=p6RxP5ParenMod
872     \ add=p6RxP5Verb
873     \ add=p6RxP5Count
874     \ add=p6RxP5Named
875     \ add=p6RxP5ReadRef
876     \ add=p6RxP5WriteRef
877     \ add=p6RxP5CharClass
878     \ add=p6RxP5Anchor
880 " inside character classes
881 syn cluster p6RegexP5Class
882     \ add=@p6RegexP5Base
883     \ add=p6RxP5Posix
884     \ add=p6RxP5Range
886 syn match p6RxP5Escape     display contained "\\\S"
887 syn match p6RxP5CodePoint  display contained "\\c\S\@=" nextgroup=p6RxP5CPId
888 syn match p6RxP5CPId       display contained "\S"
889 syn match p6RxP5Oct        display contained "\\\%(\o\{1,3}\)\@=" nextgroup=p6RxP5OctSeq
890 syn match p6RxP5OctSeq     display contained "\o\{1,3}"
891 syn match p6RxP5Anchor     display contained "[\^$]"
892 syn match p6RxP5Hex        display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=p6RxP5HexSeq
893 syn match p6RxP5HexSeq     display contained "\x\{1,2}"
894 syn region p6RxP5HexSeq
895     \ matchgroup=p6RxP5Escape
896     \ start="{"
897     \ end="}"
898     \ contained
899 syn region p6RxP5Named
900     \ matchgroup=p6RxP5Escape
901     \ start="\%(\\N\)\@<={"
902     \ end="}"
903     \ contained
904 syn match p6RxP5Quantifier display contained "\%([+*]\|(\@<!?\)"
905 syn match p6RxP5ReadRef    display contained "\\[1-9]\d\@!"
906 syn match p6RxP5ReadRef    display contained "\\k<\@=" nextgroup=p6RxP5ReadRefId
907 syn region p6RxP5ReadRefId
908     \ matchgroup=p6RxP5Escape
909     \ start="<"
910     \ end=">"
911     \ contained
912 syn match p6RxP5WriteRef   display contained "\\g\%(\d\|{\)\@=" nextgroup=p6RxP5WriteRefId
913 syn match p6RxP5WriteRefId display contained "\d\+"
914 syn region p6RxP5WriteRefId
915     \ matchgroup=p6RxP5Escape
916     \ start="{"
917     \ end="}"
918     \ contained
919 syn match p6RxP5Prop       display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=p6RxP5PropId
920 syn match p6RxP5PropId     display contained "\a"
921 syn region p6RxP5PropId
922     \ matchgroup=p6RxP5Escape
923     \ start="{"
924     \ end="}"
925     \ contained
926 syn match p6RxP5Meta       display contained "[(|).]"
927 syn match p6RxP5ParenMod   display contained "(\@<=?\@=" nextgroup=p6RxP5Mod,p6RxP5ModName,p6RxP5Code
928 syn match p6RxP5Mod        display contained "?\%(<\?=\|<\?!\|[#:|]\)"
929 syn match p6RxP5Mod        display contained "?-\?[impsx]\+"
930 syn match p6RxP5Mod        display contained "?\%([-+]\?\d\+\|R\)"
931 syn match p6RxP5Mod        display contained "?(DEFINE)"
932 syn match p6RxP5Mod        display contained "?\%(&\|P[>=]\)" nextgroup=p6RxP5ModDef
933 syn match p6RxP5ModDef     display contained "\h\w*"
934 syn region p6RxP5ModName
935     \ matchgroup=p6StringSpecial
936     \ start="?'"
937     \ end="'"
938     \ contained
939 syn region p6RxP5ModName
940     \ matchgroup=p6StringSpecial
941     \ start="?P\?<"
942     \ end=">"
943     \ contained
944 syn region p6RxP5Code
945     \ matchgroup=p6StringSpecial
946     \ start="??\?{"
947     \ end="})\@="
948     \ contained
949     \ contains=TOP
950 syn match p6RxP5EscMeta    display contained "\\[?*.{}()[\]|\^$]"
951 syn match p6RxP5Count      display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=p6RxP5CountId
952 syn region p6RxP5CountId
953     \ matchgroup=p6RxP5Escape
954     \ start="{"
955     \ end="}"
956     \ contained
957 syn match p6RxP5Verb       display contained "(\@<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)"
958 syn region p6RxP5QuoteMeta
959     \ matchgroup=p6RxP5Escape
960     \ start="\\Q"
961     \ end="\\E"
962     \ contained
963     \ contains=@p6Variables,p6EscBackSlash
964 syn region p6RxP5CharClass
965     \ matchgroup=p6StringSpecial
966     \ start="\[\^\?"
967     \ skip="\\]"
968     \ end="]"
969     \ contained
970     \ contains=@p6RegexP5Class
971 syn region p6RxP5Posix
972     \ matchgroup=p6RxP5Escape
973     \ start="\[:"
974     \ end=":]"
975     \ contained
976 syn match p6RxP5Range      display contained "-"
978 " 'string' inside a regex
979 syn region p6RxStringSQ
980     \ matchgroup=p6Quote
981     \ start="'"
982     \ skip="\\\@<!\\'"
983     \ end="'"
984     \ contained
985     \ contains=p6EscQuote,p6EscBackSlash
987 " "string" inside a regex
988 syn region p6RxStringDQ
989     \ matchgroup=p6Quote
990     \ start=+"+
991     \ skip=+\\\@<!\\"+
992     \ end=+"+
993     \ contained
994     \ contains=p6EscDoubleQuote,p6EscBackSlash
996 " $!, $var, $!var, $::var, $package::var $*::package::var, etc
997 " Thus must come after the matches for the "$" regex anchor, but before
998 " the match for the $ regex delimiter
999 syn cluster p6Variables
1000     \ add=p6VarSlash
1001     \ add=p6VarExclam
1002     \ add=p6VarMatch
1003     \ add=p6VarNum
1004     \ add=p6Variable
1006 syn match p6VarSlash     display "\$/"
1007 syn match p6VarExclam    display "\$!"
1008 syn match p6VarMatch     display "\$¢"
1009 syn match p6VarNum       display "\$\d\+"
1010 syn match p6Variable     display "\%(@@\|[@&$%]\$*\)\%(::\|\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\)\|\K\)\@=" nextgroup=p6Twigil,p6VarName,p6PackageScope
1011 syn match p6VarName      display "\K\%(\k\|[-']\K\@=\)*" contained
1012 syn match p6Twigil       display "\%([.^*?=!~]\|:\@<!::\@!\)\K\@=" nextgroup=p6PackageScope,p6VarName contained
1013 syn match p6PackageScope display "\%(\K\%(\k\|[-']\K\@=\)*\)\?::" nextgroup=p6PackageScope,p6VarName contained
1015 " Perl 6 regex regions
1017 " /foo/
1018 " Below some hacks to recognise the // variant. This is virtually impossible
1019 " to catch in all cases as the / is used in so many other ways, but these
1020 " should be the most obvious ones.
1021 " TODO: mostly stolen from perl.vim, might need more work
1022 syn region p6Match
1023     \ matchgroup=p6Quote
1024     \ start="\%([$@%&*]\@<!\%(\<\%(split\|while\|until\|if\|unless\)\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=//\@!"
1025     \ start="^//\@!"
1026     \ start=+\s\@<=/[^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!/\@!+
1027     \ skip="\\/"
1028     \ end="/"
1029     \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1031 " m/foo/, mm/foo/, rx/foo/
1032 syn region p6Match
1033     \ matchgroup=p6Quote
1034     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=//\@!"
1035     \ skip="\\/"
1036     \ end="/"
1037     \ keepend
1038     \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1040 " m!foo!, mm!foo!, rx!foo!
1041 syn region p6Match
1042     \ matchgroup=p6Quote
1043     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=!!\@!"
1044     \ skip="\\!"
1045     \ end="!"
1046     \ keepend
1047     \ contains=@p6Regexen,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
1049 " m$foo$, mm$foo$, rx$foo$, m|foo|, mm|foo|, rx|foo|, etc
1050 syn region p6Match
1051     \ matchgroup=p6Quote
1052     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([\"'`|,$]\)\$\@!"
1053     \ skip="\\\z1"
1054     \ end="\z1"
1055     \ keepend
1056     \ contains=@p6Regexen,@p6Variables
1058 " m (foo), mm (foo), rx (foo)
1059 syn region p6Match
1060     \ matchgroup=p6Quote
1061     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s\+\)\@<=()\@!)\@!"
1062     \ skip="\\)"
1063     \ end=")"
1064     \ contains=@p6Regexen,@p6Variables
1066 " m[foo], mm[foo], rx[foo]
1067 syn region p6Match
1068     \ matchgroup=p6Quote
1069     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\[]\@!]\@!"
1070     \ skip="\\]"
1071     \ end="]"
1072     \ contains=@p6Regexen,@p6Variables
1074 " m{foo}, mm{foo}, rx{foo}
1075 syn region p6Match
1076     \ matchgroup=p6Quote
1077     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<={}\@!}\@!"
1078     \ skip="\\}"
1079     \ end="}"
1080     \ contains=@p6Regexen,@p6Variables
1082 " m<foo>, mm<foo>, rx<foo>
1083 syn region p6Match
1084     \ matchgroup=p6Quote
1085     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=<>\@!>\@!"
1086     \ skip="\\>"
1087     \ end=">"
1088     \ contains=@p6Regexen,@p6Variables
1090 " m«foo», mm«foo», rx«foo»
1091 syn region p6Match
1092     \ matchgroup=p6Quote
1093     \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=«»\@!»\@!"
1094     \ skip="\\»"
1095     \ end="»"
1096     \ contains=@p6Regexen,@p6Variables
1098 " Substitutions
1100 " s/foo/bar/
1101 syn region p6Match
1102     \ matchgroup=p6Quote
1103     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=/"
1104     \ skip="\\/"
1105     \ end="/"me=e-1
1106     \ keepend
1107     \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1108     \ nextgroup=p6Substitution
1110 syn region p6Substitution
1111     \ matchgroup=p6Quote
1112     \ start="/"
1113     \ skip="\\/"
1114     \ end="/"
1115     \ contained
1116     \ keepend
1117     \ contains=@p6Interp_qq
1119 " s!foo!bar!
1120 syn region p6Match
1121     \ matchgroup=p6Quote
1122     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=!"
1123     \ skip="\\!"
1124     \ end="!"me=e-1
1125     \ keepend
1126     \ contains=@p6Regexen,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
1127     \ nextgroup=p6Substitution
1129 syn region p6Substitution
1130     \ matchgroup=p6Quote
1131     \ start="!"
1132     \ skip="\\!"
1133     \ end="!"
1134     \ contained
1135     \ keepend
1136     \ contains=@p6Interp_qq
1138 " s$foo$bar$, s|foo|bar, etc
1139 syn region p6Match
1140     \ matchgroup=p6Quote
1141     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([\"'`|,$]\)"
1142     \ skip="\\\z1"
1143     \ end="\z1"me=e-1
1144     \ keepend
1145     \ contains=@p6Regexen,@p6Variables
1146     \ nextgroup=p6Substitution
1148 syn region p6Substitution
1149     \ matchgroup=p6Quote
1150     \ start="\z([\"'`|,$]\)"
1151     \ skip="\\\z1"
1152     \ end="\z1"
1153     \ contained
1154     \ keepend
1155     \ contains=@p6Interp_qq
1157 " s{foo}
1158 syn region p6Match
1159     \ matchgroup=p6Quote
1160     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<={}\@!"
1161     \ skip="\\}"
1162     \ end="}"
1163     \ contains=@p6Regexen,@p6Variables
1165 " s[foo]
1166 syn region p6Match
1167     \ matchgroup=p6Quote
1168     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\[]\@!"
1169     \ skip="\\]"
1170     \ end="]"
1171     \ contains=@p6Regexen,@p6Variables
1173 " s<foo>
1174 syn region p6Match
1175     \ matchgroup=p6Quote
1176     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=<>\@!"
1177     \ skip="\\>"
1178     \ end=">"
1179     \ contains=@p6Regexen,@p6Variables
1181 " s«foo»
1182 syn region p6Match
1183     \ matchgroup=p6Quote
1184     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=«»\@!"
1185     \ skip="\\»"
1186     \ end="»"
1187     \ contains=@p6Regexen,@p6Variables
1189 " s (foo)
1190 syn region p6Match
1191     \ matchgroup=p6Quote
1192     \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s\+\)\@<=()\@!"
1193     \ skip="\\)"
1194     \ end=")"
1195     \ contains=@p6Regexen,@p6Variables
1197 " Perl 5 regex regions
1199 " m:P5//
1200 syn region p6Match
1201     \ matchgroup=p6Quote
1202     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=/"
1203     \ skip="\\/"
1204     \ end="/"
1205     \ contains=@p6RegexP5,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1207 " m:P5!!
1208 syn region p6Match
1209     \ matchgroup=p6Quote
1210     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=!"
1211     \ skip="\\!"
1212     \ end="!"
1213     \ contains=@p6RegexP5,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
1215 " m:P5$$, m:P5||, etc
1216 syn region p6Match
1217     \ matchgroup=p6Quote
1218     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=\z([\"'`|,$]\)"
1219     \ skip="\\\z1"
1220     \ end="\z1"
1221     \ contains=@p6RegexP5,@p6Variables
1223 " m:P5 ()
1224 syn region p6Match
1225     \ matchgroup=p6Quote
1226     \ start="\%(\<m\s*:P\%(erl\)\?5\s\+\)\@<=()\@!"
1227     \ skip="\\)"
1228     \ end=")"
1229     \ contains=@p6RegexP5,@p6Variables
1231 " m:P5[]
1232 syn region p6Match
1233     \ matchgroup=p6Quote
1234     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=[]\@!"
1235     \ skip="\\]"
1236     \ end="]"
1237     \ contains=@p6RegexP5,@p6Variables
1239 " m:P5{}
1240 syn region p6Match
1241     \ matchgroup=p6Quote
1242     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<={}\@!"
1243     \ skip="\\}"
1244     \ end="}"
1245     \ contains=@p6RegexP5,p6Variables
1247 " m:P5<>
1248 syn region p6Match
1249     \ matchgroup=p6Quote
1250     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=<>\@!"
1251     \ skip="\\>"
1252     \ end=">"
1253     \ contains=@p6RegexP5,p6Variables
1255 " m:P5«»
1256 syn region p6Match
1257     \ matchgroup=p6Quote
1258     \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=«»\@!"
1259     \ skip="\\»"
1260     \ end="»"
1261     \ contains=@p6RegexP5,p6Variables
1263 " Transliteration
1265 " tr/foo/bar/, tr|foo|bar, etc
1266 syn region p6String
1267     \ matchgroup=p6Quote
1268     \ start="\%(\<tr\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([/\"'`|!,$]\)"
1269     \ skip="\\\z1"
1270     \ end="\z1"me=e-1
1271     \ contains=p6RxRange
1272     \ nextgroup=p6Transliteration
1274 syn region p6Transliteration
1275     \ matchgroup=p6Quote
1276     \ start="\z([/\"'`|!,$]\)"
1277     \ skip="\\\z1"
1278     \ end="\z1"
1279     \ contained
1280     \ contains=@p6Interp_qq
1282 " Comments
1284 " normal end-of-line comment
1285 syn match p6Comment display "#.*" contains=p6Attention
1287 " Multiline comments. Arbitrary numbers of opening brackets are allowed,
1288 " but we only define regions for 1 to 3
1289 syn region p6Comment
1290     \ matchgroup=p6Comment
1291     \ start="^\@<!#("
1292     \ skip="([^)]*)"
1293     \ end=")"
1294     \ matchgroup=p6Error
1295     \ start="^#("
1296     \ contains=p6Attention,p6Comment
1297 syn region p6Comment
1298     \ matchgroup=p6Comment
1299     \ start="^\@<!#\["
1300     \ skip="\[[^\]]*]"
1301     \ end="]"
1302     \ matchgroup=p6Error
1303     \ start="^#\["
1304     \ contains=p6Attention,p6Comment
1305 syn region p6Comment
1306     \ matchgroup=p6Comment
1307     \ start="^\@<!#{"
1308     \ skip="{[^}]*}"
1309     \ end="}"
1310     \ matchgroup=p6Error
1311     \ start="^#{"
1312     \ contains=p6Attention,p6Comment
1313 syn region p6Comment
1314     \ matchgroup=p6Comment
1315     \ start="^\@<!#<"
1316     \ skip="<[^>]*>"
1317     \ end=">"
1318     \ matchgroup=p6Error
1319     \ start="^#<"
1320     \ contains=p6Attention,p6Comment
1321 syn region p6Comment
1322     \ matchgroup=p6Comment
1323     \ start="^\@<!#«"
1324     \ skip="«[^»]*»"
1325     \ end="»"
1326     \ matchgroup=p6Error
1327     \ start="^#«"
1328     \ contains=p6Attention,p6Comment
1330 " double and triple delimiters
1331 if exists("perl6_extended_comments") || exists("perl6_extended_all")
1332     syn region p6Comment
1333         \ matchgroup=p6Comment
1334         \ start="^\@<!#(("
1335         \ skip="((\%([^)\|))\@!]\)*))"
1336         \ end="))"
1337         \ matchgroup=p6Error
1338         \ start="^#(("
1339         \ contains=p6Attention,p6Comment
1340     syn region p6Comment
1341         \ matchgroup=p6Comment
1342         \ start="^\@<!#((("
1343         \ skip="(((\%([^)]\|)\%())\)\@!\)*)))"
1344         \ end=")))"
1345         \ matchgroup=p6Error
1346         \ start="^#((("
1347         \ contains=p6Attention,p6Comment
1349     syn region p6Comment
1350         \ matchgroup=p6Comment
1351         \ start="^\@<!#\[\["
1352         \ skip="\[\[\%([^\]]\|]]\@!\)*]]"
1353         \ end="]]"
1354         \ matchgroup=p6Error
1355         \ start="^#\[\["
1356         \ contains=p6Attention,p6Comment
1357     syn region p6Comment
1358         \ matchgroup=p6Comment
1359         \ start="^\@<!#\[\[\["
1360         \ skip="\[\[\[\%([^\]]\|]\%(]]\)\@!\)*]]]"
1361         \ end="]]]"
1362         \ matchgroup=p6Error
1363         \ start="^#\[\[\["
1364         \ contains=p6Attention,p6Comment
1366     syn region p6Comment
1367         \ matchgroup=p6Comment
1368         \ start="^\@<!#{{"
1369         \ skip="{{\%([^}]\|}}\@!\)*}}"
1370         \ end="}}"
1371         \ matchgroup=p6Error
1372         \ start="^#{{"
1373         \ contains=p6Attention,p6Comment
1374     syn region p6Comment
1375         \ matchgroup=p6Comment
1376         \ start="^\@<!#{{{"
1377         \ skip="{{{\%([^}]\|}\%(}}\)\@!\)*}}}"
1378         \ end="}}}"
1379         \ matchgroup=p6Error
1380         \ start="^#{{{"
1381         \ contains=p6Attention,p6Comment
1383     syn region p6Comment
1384         \ matchgroup=p6Comment
1385         \ start="^\@<!#<<"
1386         \ skip="<<\%([^>]\|>>\@!\)*>>"
1387         \ end=">>"
1388         \ matchgroup=p6Error
1389         \ start="^#<<"
1390         \ contains=p6Attention,p6Comment
1391     syn region p6Comment
1392         \ matchgroup=p6Comment
1393         \ start="^\@<!#<<<"
1394         \ skip="<<<\%([^>]\|>\%(>>\)\@!\)*>>>"
1395         \ end=">>>"
1396         \ matchgroup=p6Error
1397         \ start="^#<<<"
1398         \ contains=p6Attention,p6Comment
1400     syn region p6Comment
1401         \ matchgroup=p6Comment
1402         \ start="^\@<!#««"
1403         \ skip="««\%([^»]\|»»\@!\)*»»"
1404         \ end="»»"
1405         \ matchgroup=p6Error
1406         \ start="^#««"
1407         \ contains=p6Attention,p6Comment
1408     syn region p6Comment
1409         \ matchgroup=p6Comment
1410         \ start="^\@<!#«««"
1411         \ skip="«««\%([^»]\|»\%(»»\)\@!\)*»»»"
1412         \ end="»»»"
1413         \ matchgroup=p6Error
1414         \ start="^#«««"
1415         \ contains=p6Attention,p6Comment
1416 endif
1418 " Pod
1420 " Abbreviated blocks (implicit code forbidden)
1421 syn region p6PodAbbrRegion
1422     \ matchgroup=p6PodPrefix
1423     \ start="^=\ze\K\k*"
1424     \ end="^\ze\%(\s*$\|=\K\)"
1425     \ contains=p6PodAbbrNoCodeType
1426     \ keepend
1428 syn region p6PodAbbrNoCodeType
1429     \ matchgroup=p6PodType
1430     \ start="\K\k*"
1431     \ end="^\ze\%(\s*$\|=\K\)"
1432     \ contained
1433     \ contains=p6PodName,p6PodAbbrNoCode
1435 syn match p6PodName contained ".\+" contains=@p6PodFormat
1436 syn match p6PodComment contained ".\+"
1438 syn region p6PodAbbrNoCode
1439     \ start="^"
1440     \ end="^\ze\%(\s*$\|=\K\)"
1441     \ contained
1442     \ contains=@p6PodFormat
1444 " Abbreviated blocks (everything is code)
1445 syn region p6PodAbbrRegion
1446     \ matchgroup=p6PodPrefix
1447     \ start="^=\zecode\>"
1448     \ end="^\ze\%(\s*$\|=\K\)"
1449     \ contains=p6PodAbbrCodeType
1450     \ keepend
1452 syn region p6PodAbbrCodeType
1453     \ matchgroup=p6PodType
1454     \ start="\K\k*"
1455     \ end="^\ze\%(\s*$\|=\K\)"
1456     \ contained
1457     \ contains=p6PodName,p6PodAbbrCode
1459 syn region p6PodAbbrCode
1460     \ start="^"
1461     \ end="^\ze\%(\s*$\|=\K\)"
1462     \ contained
1464 " Abbreviated blocks (everything is a comment)
1465 syn region p6PodAbbrRegion
1466     \ matchgroup=p6PodPrefix
1467     \ start="^=\zecomment\>"
1468     \ end="^\ze\%(\s*$\|=\K\)"
1469     \ contains=p6PodAbbrCommentType
1470     \ keepend
1472 syn region p6PodAbbrCommentType
1473     \ matchgroup=p6PodType
1474     \ start="\K\k*"
1475     \ end="^\ze\%(\s*$\|=\K\)"
1476     \ contained
1477     \ contains=p6PodComment,p6PodAbbrNoCode
1479 " Abbreviated blocks (implicit code allowed)
1480 syn region p6PodAbbrRegion
1481     \ matchgroup=p6PodPrefix
1482     \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>"
1483     \ end="^\ze\%(\s*$\|=\K\)"
1484     \ contains=p6PodAbbrType
1485     \ keepend
1487 syn region p6PodAbbrType
1488     \ matchgroup=p6PodType
1489     \ start="\K\k*"
1490     \ end="^\ze\%(\s*$\|=\K\)"
1491     \ contained
1492     \ contains=p6PodName,p6PodAbbr
1494 syn region p6PodAbbr
1495     \ start="^"
1496     \ end="^\ze\%(\s*$\|=\K\)"
1497     \ contained
1498     \ contains=@p6PodFormat,p6PodImplicitCode
1500 " Abbreviated block to end-of-file
1501 syn region p6PodAbbrRegion
1502     \ matchgroup=p6PodPrefix
1503     \ start="^=\zeEND\>"
1504     \ end="\%$"
1505     \ contains=p6PodAbbrEOFType
1506     \ keepend
1508 syn region p6PodAbbrEOFType
1509     \ matchgroup=p6PodType
1510     \ start="\K\k*"
1511     \ end="\%$"
1512     \ contained
1513     \ contains=p6PodName,p6PodAbbrEOF
1515 syn region p6PodAbbrEOF
1516     \ start="^"
1517     \ end="\%$"
1518     \ contained
1519     \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1521 " Directives
1522 syn region p6PodDirectRegion
1523     \ matchgroup=p6PodPrefix
1524     \ start="^=\%(config\|use\)\>"
1525     \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1526     \ contains=p6PodDirectArgRegion
1527     \ keepend
1529 syn region p6PodDirectArgRegion
1530     \ matchgroup=p6PodType
1531     \ start="\S\+"
1532     \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1533     \ contained
1534     \ contains=p6PodDirectConfigRegion
1536 syn region p6PodDirectConfigRegion
1537     \ start=""
1538     \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1539     \ contained
1540     \ contains=@p6PodConfig
1542 " =encoding is a special directive
1543 syn region p6PodDirectRegion
1544     \ matchgroup=p6PodPrefix
1545     \ start="^=encoding\>"
1546     \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1547     \ contains=p6PodEncodingArgRegion
1548     \ keepend
1550 syn region p6PodEncodingArgRegion
1551     \ matchgroup=p6PodName
1552     \ start="\S\+"
1553     \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1554     \ contained
1556 " Paragraph blocks (implicit code forbidden)
1557 syn region p6PodParaRegion
1558     \ matchgroup=p6PodPrefix
1559     \ start="^=for\>"
1560     \ end="^\ze\%(\s*$\|=\K\)"
1561     \ contains=p6PodParaNoCodeTypeRegion
1562     \ keepend
1563     \ extend
1565 syn region p6PodParaNoCodeTypeRegion
1566     \ matchgroup=p6PodType
1567     \ start="\K\k*"
1568     \ end="^\ze\%(\s*$\|=\K\)"
1569     \ contained
1570     \ contains=p6PodParaNoCode,p6PodParaConfigRegion
1572 syn region p6PodParaConfigRegion
1573     \ start=""
1574     \ end="^\ze\%([^=]\|=\k\@<!\)"
1575     \ contained
1576     \ contains=@p6PodConfig
1578 syn region p6PodParaNoCode
1579     \ start="^[^=]"
1580     \ end="^\ze\%(\s*$\|=\K\)"
1581     \ contained
1582     \ contains=@p6PodFormat
1584 " Paragraph blocks (everything is code)
1585 syn region p6PodParaRegion
1586     \ matchgroup=p6PodPrefix
1587     \ start="^=for\>\ze\s*code\>"
1588     \ end="^\ze\%(\s*$\|=\K\)"
1589     \ contains=p6PodParaCodeTypeRegion
1590     \ keepend
1591     \ extend
1593 syn region p6PodParaCodeTypeRegion
1594     \ matchgroup=p6PodType
1595     \ start="\K\k*"
1596     \ end="^\ze\%(\s*$\|=\K\)"
1597     \ contained
1598     \ contains=p6PodParaCode,p6PodParaConfigRegion
1600 syn region p6PodParaCode
1601     \ start="^[^=]"
1602     \ end="^\ze\%(\s*$\|=\K\)"
1603     \ contained
1605 " Paragraph blocks (implicit code allowed)
1606 syn region p6PodParaRegion
1607     \ matchgroup=p6PodPrefix
1608     \ start="^=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>"
1609     \ end="^\ze\%(\s*$\|=\K\)"
1610     \ contains=p6PodParaTypeRegion
1611     \ keepend
1612     \ extend
1614 syn region p6PodParaTypeRegion
1615     \ matchgroup=p6PodType
1616     \ start="\K\k*"
1617     \ end="^\ze\%(\s*$\|=\K\)"
1618     \ contained
1619     \ contains=p6PodPara,p6PodParaConfigRegion
1621 syn region p6PodPara
1622     \ start="^[^=]"
1623     \ end="^\ze\%(\s*$\|=\K\)"
1624     \ contained
1625     \ contains=@p6PodFormat,p6PodImplicitCode
1627 " Paragraph block to end-of-file
1628 syn region p6PodParaRegion
1629     \ matchgroup=p6PodPrefix
1630     \ start="^=for\>\ze\s\+END\>"
1631     \ end="\%$"
1632     \ contains=p6PodParaEOFTypeRegion
1633     \ keepend
1634     \ extend
1636 syn region p6PodParaEOFTypeRegion
1637     \ matchgroup=p6PodType
1638     \ start="\K\k*"
1639     \ end="\%$"
1640     \ contained
1641     \ contains=p6PodParaEOF,p6PodParaConfigRegion
1643 syn region p6PodParaEOF
1644     \ start="^[^=]"
1645     \ end="\%$"
1646     \ contained
1647     \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1649 " Delimited blocks (implicit code forbidden)
1650 syn region p6PodDelimRegion
1651     \ matchgroup=p6PodPrefix
1652     \ start="^=begin\>"
1653     \ end="^=end\>"
1654     \ contains=p6PodDelimNoCodeTypeRegion
1655     \ keepend
1656     \ extend
1658 syn region p6PodDelimNoCodeTypeRegion
1659     \ matchgroup=p6PodType
1660     \ start="\K\k*"
1661     \ end="^\ze=end\>"
1662     \ contained
1663     \ contains=p6PodDelimNoCode,p6PodDelimConfigRegion
1665 syn region p6PodDelimConfigRegion
1666     \ start=""
1667     \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1668     \ contained
1669     \ contains=@p6PodConfig
1671 syn region p6PodDelimNoCode
1672     \ start="^"
1673     \ end="^\ze=end\>"
1674     \ contained
1675     \ contains=@p6PodNestedBlocks,@p6PodFormat
1677 " Delimited blocks (everything is code)
1678 syn region p6PodDelimRegion
1679     \ matchgroup=p6PodPrefix
1680     \ start="^=begin\>\ze\s*code\>"
1681     \ end="^=end\>"
1682     \ contains=p6PodDelimCodeTypeRegion
1683     \ keepend
1684     \ extend
1686 syn region p6PodDelimCodeTypeRegion
1687     \ matchgroup=p6PodType
1688     \ start="\K\k*"
1689     \ end="^\ze=end\>"
1690     \ contained
1691     \ contains=p6PodDelimCode,p6PodDelimConfigRegion
1693 syn region p6PodDelimCode
1694     \ start="^"
1695     \ end="^\ze=end\>"
1696     \ contained
1697     \ contains=@p6PodNestedBlocks
1699 " Delimited blocks (implicit code allowed)
1700 syn region p6PodDelimRegion
1701     \ matchgroup=p6PodPrefix
1702     \ start="^=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>"
1703     \ end="^=end\>"
1704     \ contains=p6PodDelimTypeRegion
1705     \ keepend
1706     \ extend
1708 syn region p6PodDelimTypeRegion
1709     \ matchgroup=p6PodType
1710     \ start="\K\k*"
1711     \ end="^\ze=end\>"
1712     \ contained
1713     \ contains=p6PodDelim,p6PodDelimConfigRegion
1715 syn region p6PodDelim
1716     \ start="^"
1717     \ end="^\ze=end\>"
1718     \ contained
1719     \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1721 " Delimited block to end-of-file
1722 syn region p6PodDelimRegion
1723     \ matchgroup=p6PodPrefix
1724     \ start="^=begin\>\ze\s\+END\>"
1725     \ end="\%$"
1726     \ contains=p6PodDelimEOFTypeRegion
1727     \ extend
1729 syn region p6PodDelimEOFTypeRegion
1730     \ matchgroup=p6PodType
1731     \ start="\K\k*"
1732     \ end="\%$"
1733     \ contained
1734     \ contains=p6PodDelimEOF,p6PodDelimConfigRegion
1736 syn region p6PodDelimEOF
1737     \ start="^"
1738     \ end="\%$"
1739     \ contained
1740     \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1742 syn cluster p6PodConfig
1743     \ add=p6PodConfigOperator
1744     \ add=p6PodExtraConfig
1745     \ add=p6StringAuto
1746     \ add=p6PodAutoQuote
1747     \ add=p6StringSQ
1749 syn region p6PodParens
1750     \ start="("
1751     \ end=")"
1752     \ contained
1753     \ contains=p6Number,p6StringSQ
1755 syn match p6PodAutoQuote      display contained "=>"
1756 syn match p6PodConfigOperator display contained ":!\?" nextgroup=p6PodConfigOption
1757 syn match p6PodConfigOption   display contained "[^[:space:](<]\+" nextgroup=p6PodParens,p6StringAngle
1758 syn match p6PodExtraConfig    display contained "^="
1759 syn match p6PodVerticalBar    display contained "|"
1760 syn match p6PodColon          display contained ":"
1761 syn match p6PodSemicolon      display contained ";"
1762 syn match p6PodComma          display contained ","
1763 syn match p6PodImplicitCode   display contained "^\s.*"
1765 syn region p6PodDelimEndRegion
1766     \ matchgroup=p6PodType
1767     \ start="\%(^=end\>\)\@<="
1768     \ end="\K\k*"
1770 " These may appear inside delimited blocks
1771 syn cluster p6PodNestedBlocks
1772     \ add=p6PodAbbrRegion
1773     \ add=p6PodDirectRegion
1774     \ add=p6PodParaRegion
1775     \ add=p6PodDelimRegion
1776     \ add=p6PodDelimEndRegion
1778 " Pod formatting codes
1780 syn cluster p6PodFormat
1781     \ add=p6PodFormatOne
1782     \ add=p6PodFormatTwo
1783     \ add=p6PodFormatThree
1784     \ add=p6PodFormatFrench
1786 " Balanced angles found inside formatting codes. Ensures proper nesting.
1788 syn region p6PodFormatAnglesOne
1789     \ matchgroup=p6PodFormat
1790     \ start="<"
1791     \ skip="<[^>]*>"
1792     \ end=">"
1793     \ transparent
1794     \ contained
1795     \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne
1797 syn region p6PodFormatAnglesTwo
1798     \ matchgroup=p6PodFormat
1799     \ start="<<"
1800     \ skip="<<[^>]*>>"
1801     \ end=">>"
1802     \ transparent
1803     \ contained
1804     \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo
1806 syn region p6PodFormatAnglesThree
1807     \ matchgroup=p6PodFormat
1808     \ start="<<<"
1809     \ skip="<<<[^>]*>>>"
1810     \ end=">>>"
1811     \ transparent
1812     \ contained
1813     \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree
1815 syn region p6PodFormatAnglesFrench
1816     \ matchgroup=p6PodFormat
1817     \ start="«"
1818     \ skip="«[^»]*»"
1819     \ end="»"
1820     \ transparent
1821     \ contained
1822     \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree
1824 " All formatting codes
1826 syn region p6PodFormatOne
1827     \ matchgroup=p6PodFormatCode
1828     \ start="\u<"
1829     \ skip="<[^>]*>"
1830     \ end=">"
1831     \ contained
1832     \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne
1834 syn region p6PodFormatTwo
1835     \ matchgroup=p6PodFormatCode
1836     \ start="\u<<"
1837     \ skip="<<[^>]*>>"
1838     \ end=">>"
1839     \ contained
1840     \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo
1842 syn region p6PodFormatThree
1843     \ matchgroup=p6PodFormatCode
1844     \ start="\u<<<"
1845     \ skip="<<<[^>]*>>>"
1846     \ end=">>>"
1847     \ contained
1848     \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree
1850 syn region p6PodFormatFrench
1851     \ matchgroup=p6PodFormatCode
1852     \ start="\u«"
1853     \ skip="«[^»]*»"
1854     \ end="»"
1855     \ contained
1856     \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree
1858 " C<> and V<> don't allow nested formatting formatting codes
1860 syn region p6PodFormatOne
1861     \ matchgroup=p6PodFormatCode
1862     \ start="[CV]<"
1863     \ skip="<[^>]*>"
1864     \ end=">"
1865     \ contained
1866     \ contains=p6PodFormatAnglesOne
1868 syn region p6PodFormatTwo
1869     \ matchgroup=p6PodFormatCode
1870     \ start="[CV]<<"
1871     \ skip="<<[^>]*>>"
1872     \ end=">>"
1873     \ contained
1874     \ contains=p6PodFormatAnglesTwo
1876 syn region p6PodFormatThree
1877     \ matchgroup=p6PodFormatCode
1878     \ start="[CV]<<<"
1879     \ skip="<<<[^>]*>>>"
1880     \ end=">>>"
1881     \ contained
1882     \ contains=p6PodFormatAnglesThree
1884 syn region p6PodFormatFrench
1885     \ matchgroup=p6PodFormatCode
1886     \ start="[CV]«"
1887     \ skip="«[^»]*»"
1888     \ end="»"
1889     \ contained
1890     \ contains=p6PodFormatAnglesFrench
1892 " L<> can have a "|" separator
1894 syn region p6PodFormatOne
1895     \ matchgroup=p6PodFormatCode
1896     \ start="L<"
1897     \ skip="<[^>]*>"
1898     \ end=">"
1899     \ contained
1900     \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar
1902 syn region p6PodFormatTwo
1903     \ matchgroup=p6PodFormatCode
1904     \ start="L<<"
1905     \ skip="<<[^>]*>>"
1906     \ end=">>"
1907     \ contained
1908     \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar
1910 syn region p6PodFormatThree
1911     \ matchgroup=p6PodFormatCode
1912     \ start="L<<<"
1913     \ skip="<<<[^>]*>>>"
1914     \ end=">>>"
1915     \ contained
1916     \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar
1918 syn region p6PodFormatFrench
1919     \ matchgroup=p6PodFormatCode
1920     \ start="L«"
1921     \ skip="«[^»]*»"
1922     \ end="»"
1923     \ contained
1924     \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar
1926 " E<> can have a ";" separator
1928 syn region p6PodFormatOne
1929     \ matchgroup=p6PodFormatCode
1930     \ start="E<"
1931     \ skip="<[^>]*>"
1932     \ end=">"
1933     \ contained
1934     \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodSemiColon
1936 syn region p6PodFormatTwo
1937     \ matchgroup=p6PodFormatCode
1938     \ start="E<<"
1939     \ skip="<<[^>]*>>"
1940     \ end=">>"
1941     \ contained
1942     \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodSemiColon
1944 syn region p6PodFormatThree
1945     \ matchgroup=p6PodFormatCode
1946     \ start="E<<<"
1947     \ skip="<<<[^>]*>>>"
1948     \ end=">>>"
1949     \ contained
1950     \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon
1952 syn region p6PodFormatFrench
1953     \ matchgroup=p6PodFormatCode
1954     \ start="E«"
1955     \ skip="«[^»]*»"
1956     \ end="»"
1957     \ contained
1958     \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon
1960 " M<> can have a ":" separator
1962 syn region p6PodFormatOne
1963     \ matchgroup=p6PodFormatCode
1964     \ start="M<"
1965     \ skip="<[^>]*>"
1966     \ end=">"
1967     \ contained
1968     \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodColon
1970 syn region p6PodFormatTwo
1971     \ matchgroup=p6PodFormatCode
1972     \ start="M<<"
1973     \ skip="<<[^>]*>>"
1974     \ end=">>"
1975     \ contained
1976     \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodColon
1978 syn region p6PodFormatThree
1979     \ matchgroup=p6PodFormatCode
1980     \ start="M<<<"
1981     \ skip="<<<[^>]*>>>"
1982     \ end=">>>"
1983     \ contained
1984     \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon
1986 syn region p6PodFormatFrench
1987     \ matchgroup=p6PodFormatCode
1988     \ start="M«"
1989     \ skip="«[^»]*»"
1990     \ end="»"
1991     \ contained
1992     \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon
1994 " D<> can have "|" and ";" separators
1996 syn region p6PodFormatOne
1997     \ matchgroup=p6PodFormatCode
1998     \ start="D<"
1999     \ skip="<[^>]*>"
2000     \ end=">"
2001     \ contained
2002     \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon
2004 syn region p6PodFormatTwo
2005     \ matchgroup=p6PodFormatCode
2006     \ start="D<<"
2007     \ skip="<<[^>]*>>"
2008     \ end=">>"
2009     \ contained
2010     \ contains=p6PodFormatAngleTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon
2012 syn region p6PodFormatThree
2013     \ matchgroup=p6PodFormatCode
2014     \ start="D<<<"
2015     \ skip="<<<[^>]*>>>"
2016     \ end=">>>"
2017     \ contained
2018     \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon
2020 syn region p6PodFormatFrench
2021     \ matchgroup=p6PodFormatCode
2022     \ start="D«"
2023     \ skip="«[^»]*»"
2024     \ end="»"
2025     \ contained
2026     \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon
2028 " X<> can have "|", "," and ";" separators
2030 syn region p6PodFormatOne
2031     \ matchgroup=p6PodFormatCode
2032     \ start="X<"
2033     \ skip="<[^>]*>"
2034     \ end=">"
2035     \ contained
2036     \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2038 syn region p6PodFormatTwo
2039     \ matchgroup=p6PodFormatCode
2040     \ start="X<<"
2041     \ skip="<<[^>]*>>"
2042     \ end=">>"
2043     \ contained
2044     \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2046 syn region p6PodFormatThree
2047     \ matchgroup=p6PodFormatCode
2048     \ start="X<<<"
2049     \ skip="<<<[^>]*>>>"
2050     \ end=">>>"
2051     \ contained
2052     \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2054 syn region p6PodFormatFrench
2055     \ matchgroup=p6PodFormatCode
2056     \ start="X«"
2057     \ skip="«[^»]*»"
2058     \ end="»"
2059     \ contained
2060     \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2062 " Define the default highlighting.
2063 " For version 5.7 and earlier: only when not done already
2064 " For version 5.8 and later: only when an item doesn't have highlighting yet
2065 if version >= 508 || !exists("did_perl6_syntax_inits")
2066     if version < 508
2067         let did_perl6_syntax_inits = 1
2068         command -nargs=+ HiLink hi link <args>
2069     else
2070         command -nargs=+ HiLink hi def link <args>
2071     endif
2073     HiLink p6EscOctOld       p6Error
2074     HiLink p6PackageTwigil   p6Twigil
2075     HiLink p6StringAngle     p6String
2076     HiLink p6StringFrench    p6String
2077     HiLink p6StringAngles    p6String
2078     HiLink p6StringSQ        p6String
2079     HiLink p6StringDQ        p6String
2080     HiLink p6StringQ         p6String
2081     HiLink p6RxStringSQ      p6String
2082     HiLink p6RxStringDQ      p6String
2083     HiLink p6Substitution    p6String
2084     HiLink p6Transliteration p6String
2085     HiLink p6StringAuto      p6String
2086     HiLink p6StringP5Auto    p6String
2087     HiLink p6Key             p6String
2088     HiLink p6Match           p6String
2089     HiLink p6RegexBlock      p6String
2090     HiLink p6RxP5CharClass   p6String
2091     HiLink p6RxP5QuoteMeta   p6String
2092     HiLink p6RxCharClass     p6String
2093     HiLink p6RxQuoteWords    p6String
2094     HiLink p6ReduceOp        p6Operator
2095     HiLink p6ReverseCrossOp  p6Operator
2096     HiLink p6HyperOp         p6Operator
2097     HiLink p6QuoteQ          p6Operator
2098     HiLink p6RxRange         p6StringSpecial
2099     HiLink p6RxAnchor        p6StringSpecial
2100     HiLink p6RxP5Anchor      p6StringSpecial
2101     HiLink p6CodePoint       p6StringSpecial
2102     HiLink p6RxMeta          p6StringSpecial
2103     HiLink p6RxP5Range       p6StringSpecial
2104     HiLink p6RxP5CPId        p6StringSpecial
2105     HiLink p6RxP5Posix       p6StringSpecial
2106     HiLink p6RxP5Mod         p6StringSpecial
2107     HiLink p6RxP5HexSeq      p6StringSpecial
2108     HiLink p6RxP5OctSeq      p6StringSpecial
2109     HiLink p6RxP5WriteRefId  p6StringSpecial
2110     HiLink p6HexSequence     p6StringSpecial
2111     HiLink p6OctSequence     p6StringSpecial
2112     HiLink p6RxP5Named       p6StringSpecial
2113     HiLink p6RxP5PropId      p6StringSpecial
2114     HiLink p6RxP5Quantifier  p6StringSpecial
2115     HiLink p6RxP5CountId     p6StringSpecial
2116     HiLink p6RxP5Verb        p6StringSpecial
2117     HiLink p6Escape          p6StringSpecial2
2118     HiLink p6EscNull         p6StringSpecial2
2119     HiLink p6EscHash         p6StringSpecial2
2120     HiLink p6EscQQ           p6StringSpecial2
2121     HiLink p6EscQuote        p6StringSpecial2
2122     HiLink p6EscDoubleQuote  p6StringSpecial2
2123     HiLink p6EscBackTick     p6StringSpecial2
2124     HiLink p6EscForwardSlash p6StringSpecial2
2125     HiLink p6EscVerticalBar  p6StringSpecial2
2126     HiLink p6EscExclamation  p6StringSpecial2
2127     HiLink p6EscDollar       p6StringSpecial2
2128     HiLink p6EscOpenCurly    p6StringSpecial2
2129     HiLink p6EscCloseCurly   p6StringSpecial2
2130     HiLink p6EscCloseBracket p6StringSpecial2
2131     HiLink p6EscCloseAngle   p6StringSpecial2
2132     HiLink p6EscCloseFrench  p6StringSpecial2
2133     HiLink p6EscBackSlash    p6StringSpecial2
2134     HiLink p6RxEscape        p6StringSpecial2
2135     HiLink p6RxCapture       p6StringSpecial2
2136     HiLink p6RxAlternation   p6StringSpecial2
2137     HiLink p6RxP5            p6StringSpecial2
2138     HiLink p6RxP5ReadRef     p6StringSpecial2
2139     HiLink p6RxP5Oct         p6StringSpecial2
2140     HiLink p6RxP5Hex         p6StringSpecial2
2141     HiLink p6RxP5EscMeta     p6StringSpecial2
2142     HiLink p6RxP5Meta        p6StringSpecial2
2143     HiLink p6RxP5Escape      p6StringSpecial2
2144     HiLink p6RxP5CodePoint   p6StringSpecial2
2145     HiLink p6RxP5WriteRef    p6StringSpecial2
2146     HiLink p6RxP5Prop        p6StringSpecial2
2148     HiLink p6Property       Tag
2149     HiLink p6Attention      Todo
2150     HiLink p6Type           Type
2151     HiLink p6Error          Error
2152     HiLink p6BlockLabel     Label
2153     HiLink p6Float          Float
2154     HiLink p6Normal         Normal
2155     HiLink p6Package        Normal
2156     HiLink p6PackageScope   Normal
2157     HiLink p6Number         Number
2158     HiLink p6VersionNum     Number
2159     HiLink p6String         String
2160     HiLink p6Repeat         Repeat
2161     HiLink p6Keyword        Keyword
2162     HiLink p6Pragma         Keyword
2163     HiLink p6Module         Keyword
2164     HiLink p6DeclareRoutine Keyword
2165     HiLink p6VarStorage     Special
2166     HiLink p6FlowControl    Special
2167     HiLink p6NumberBase     Special
2168     HiLink p6Twigil         Special
2169     HiLink p6StringSpecial2 Special
2170     HiLink p6VersionDot     Special
2171     HiLink p6Comment        Comment
2172     HiLink p6Include        Include
2173     HiLink p6Shebang        PreProc
2174     HiLink p6ClosureTrait   PreProc
2175     HiLink p6Routine        Function
2176     HiLink p6Operator       Operator
2177     HiLink p6Version        Operator
2178     HiLink p6Context        Operator
2179     HiLink p6Quote          Delimiter
2180     HiLink p6TypeConstraint PreCondit
2181     HiLink p6Exception      Exception
2182     HiLink p6Placeholder    Identifier
2183     HiLink p6Variable       Identifier
2184     HiLink p6VarSlash       Identifier
2185     HiLink p6VarNum         Identifier
2186     HiLink p6VarExclam      Identifier
2187     HiLink p6VarMatch       Identifier
2188     HiLink p6VarName        Identifier
2189     HiLink p6MatchVar       Identifier
2190     HiLink p6RxP5ReadRefId  Identifier
2191     HiLink p6RxP5ModDef     Identifier
2192     HiLink p6RxP5ModName    Identifier
2193     HiLink p6Conditional    Conditional
2194     HiLink p6StringSpecial  SpecialChar
2196     HiLink p6PodAbbr         p6Pod
2197     HiLink p6PodAbbrEOF      p6Pod
2198     HiLink p6PodAbbrNoCode   p6Pod
2199     HiLink p6PodAbbrCode     p6PodCode
2200     HiLink p6PodPara         p6Pod
2201     HiLink p6PodParaEOF      p6Pod
2202     HiLink p6PodParaNoCode   p6Pod
2203     HiLink p6PodParaCode     p6PodCode
2204     HiLink p6PodDelim        p6Pod
2205     HiLink p6PodDelimEOF     p6Pod
2206     HiLink p6PodDelimNoCode  p6Pod
2207     HiLink p6PodDelimCode    p6PodCode
2208     HiLink p6PodImplicitCode p6PodCode
2209     HiLink p6PodExtraConfig  p6PodPrefix
2210     HiLink p6PodVerticalBar  p6PodFormatCode
2211     HiLink p6PodColon        p6PodFormatCode
2212     HiLink p6PodSemicolon    p6PodFormatCode
2213     HiLink p6PodComma        p6PodFormatCode
2214     HiLink p6PodFormatOne    p6PodFormat
2215     HiLink p6PodFormatTwo    p6PodFormat
2216     HiLink p6PodFormatThree  p6PodFormat
2217     HiLink p6PodFormatFrench p6PodFormat
2219     HiLink p6PodType           Type
2220     HiLink p6PodConfigOption   String
2221     HiLink p6PodCode           PreProc
2222     HiLink p6Pod               Comment
2223     HiLink p6PodComment        Comment
2224     HiLink p6PodAutoQuote      Operator
2225     HiLink p6PodConfigOperator Operator
2226     HiLink p6PodPrefix         Statement
2227     HiLink p6PodName           Identifier
2228     HiLink p6PodFormatCode     SpecialChar
2229     HiLink p6PodFormat         SpecialComment
2231     delcommand HiLink
2232 endif
2234 " Syncing to speed up processing
2235 "syn sync match p6SyncPod groupthere p6PodAbbrRegion     "^=\K\k*\>"
2236 "syn sync match p6SyncPod groupthere p6PodDirectRegion   "^=\%(config\|use\|encoding\)\>"
2237 "syn sync match p6SyncPod groupthere p6PodParaRegion     "^=for\>"
2238 "syn sync match p6SyncPod groupthere p6PodDelimRegion    "^=begin\>"
2239 "syn sync match p6SyncPod groupthere p6PodDelimEndRegion "^=end\>"
2241 " Let's just sync whole file, the other methods aren't reliable (or I don't
2242 " know how to use them reliably)
2243 syn sync fromstart
2245 setlocal foldmethod=syntax
2247 let b:current_syntax = "perl6"
2249 " vim:ts=8:sts=4:sw=4:expandtab:ft=vim