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