blob: 62ddc456e2768b3771868fda5ae677379e39e83e [file] [log] [blame]
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001" Vim syntax file
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02002" Language: Perl 6
3" Maintainer: vim-perl <vim-perl@googlegroups.com>
Bram Moolenaar2c7f8c52020-04-20 19:52:53 +02004" Homepage: https://github.com/vim-perl/vim-perl/tree/master
5" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
6" Last Change: 2020 Apr 15
Bram Moolenaar00a927d2010-05-14 23:24:24 +02007
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02008" Contributors: Luke Palmer <fibonaci@babylonia.flatirons.org>
9" Moritz Lenz <moritz@faui2k3.org>
10" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Bram Moolenaar00a927d2010-05-14 23:24:24 +020011"
12" This is a big undertaking. Perl 6 is the sort of language that only Perl
13" can parse. But I'll do my best to get vim to.
14"
15" You can associate the extension ".pl" with the filetype "perl6" by setting
16" autocmd BufNewFile,BufRead *.pl setf perl6
17" in your ~/.vimrc. But that will infringe on Perl 5, so you might want to
18" put a modeline near the beginning or end of your Perl 6 files instead:
19" # vim: filetype=perl6
20
21" TODO:
22" * Deal with s:Perl5//
23" * m:s// is a match, not a substitution
24" * Make these highlight as strings, not operators:
25" <==> <=:=> <===> <=~> <« »> «>» «<»
26" * Allow more keywords to match as function calls(leave() is export(), etc)
27" * Optimization: use nextgroup instead of lookaround (:help syn-nextgroup)
28" * Fix s''' substitutions being matched as package names
29" * Match s/// and m/// better, so things like "$s/" won't match
30" * Add more support for folding (:help syn-fold)
31" * Add more syntax syncing hooks (:help syn-sync)
32" * Q//:
33" :to, :heredoc
34" interpolate \q:s{$scalar} (though the spec isn't very clear on it)
35"
36" Impossible TODO?:
37" * Unspace
38" * Unicode bracketing characters for quoting (there are so many)
39" * Various tricks depending on context. I.e. we can't know when Perl
40" expects «*» to be a string or a hyperoperator. The latter is presumably
41" more common, so that's what we assume.
42" * Selective highlighting of Pod formatting codes with the :allow option
43" * Arbitrary number, order, and negation of adverbs to Q//, q//, qq//.
44" Currently only the first adverb is considered significant. Anything
45" more would require an exponential amount of regexes, making this
46" already slow syntax file even slower.
47"
48" If you want to have Pir code inside Q:PIR// strings highlighted, do:
49" let perl6_embedded_pir=1
50"
51" The above requires pir.vim, which you can find in Parrot's repository:
52" https://svn.parrot.org/parrot/trunk/editor/
53"
54" Some less than crucial things have been made optional to speed things up.
55" Look at the comments near the if/else branches in this file to see exactly
56" which features are affected. "perl6_extended_all" enables everything.
57"
58" The defaults are:
59"
60" unlet perl6_extended_comments
61" unlet perl6_extended_q
62" unlet perl6_extended_all
63
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020064" quit when a syntax file was already loaded
65if exists("b:current_syntax")
Bram Moolenaar00a927d2010-05-14 23:24:24 +020066 finish
67endif
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020068let s:keepcpo= &cpo
69set cpo&vim
Bram Moolenaar00a927d2010-05-14 23:24:24 +020070
71" identifiers
72syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*"
73
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.
79let s:before_keyword = " display \"\\%(\\k\\|\\K\\@<=[-']\\)\\@<!\\%("
80let s:after_keyword = "\\)\\%(\\k\\|[-']\\K\\@=\\)\\@!\""
81
82" Billions of keywords
83let 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\ }
157
158for [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
163endfor
164unlet s:keywords s:words_space s:temp s:words
165
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
170syn match p6Operator display "[-+/*~?|=^!%&,<>.;\\]"
171syn match p6Operator display "\%(:\@<!::\@!\|::=\|\.::\)"
172" these require whitespace on the left side
173syn match p6Operator display "\%(\s\|^\)\@<=\%(xx=\|p5=>\)"
174" "i" requires a digit to the left, and no keyword char to the right
175syn match p6Operator display "\d\@<=i\k\@!"
176" index overloading
177syn match p6Operator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)"
178
179" all infix operators except nonassocative ones
180let 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
189let s:infix_n = "but does <=> leg cmp \\.\\. \\.\\.\\^\\^ \\^\\.\\. \\^\\.\\.\\^"
190
191let s:infix_a_long = join(s:infix_a, " ")
192let s:infix_a_words = split(s:infix_a_long)
193let s:infix_a_pattern = join(s:infix_a_words, "\\|")
194
195let s:infix_n_words = split(s:infix_n)
196let s:infix_n_pattern = join(s:infix_n_words, "\\|")
197
198let s:both = [s:infix_a_pattern, s:infix_n_pattern]
199let s:infix = join(s:both, "\\|")
200
201let s:infix_assoc = "!\\?\\%(" . s:infix_a_pattern . "\\)"
202let s:infix = "!\\?\\%(" . s:infix . "\\)"
203
204unlet s:infix_a s:infix_a_long s:infix_a_words s:infix_a_pattern
205unlet s:infix_n s:infix_n_pattern s:both
206
207" [+] reduce
208exec "syn match p6ReduceOp display \"\\k\\@<!\\[[R\\\\]\\?!\\?". s:infix_assoc ."]\\%(«\\|<<\\)\\?\""
209unlet s:infix_assoc
210
211" Reverse and cross operators (Rop, Xop)
212exec "syn match p6ReverseCrossOp display \"[RX]". s:infix ."\""
213
214" q() or whatever() is always a function call
215syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*(\@="
216
217" basically all builtins that can be followed by parentheses
218let 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\ ]
244
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
247let s:words_space = join(s:routines, " ")
248let s:temp = split(s:words_space)
249let s:words = join(s:temp, "\\|")
250exec "syn match p6Routine ". s:before_keyword . s:words . s:after_keyword
251unlet s:before_keyword s:after_keyword s:words_space s:temp s:words s:routines
252
253" packages, must come after all the keywords
254syn match p6Normal display "\%(::\)\@<=\K\%(\k\|[-']\K\@=\)*"
255syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*\%(::\)\@="
256
257" some standard packages
258syn match p6Type display "\%(::\|\k\|\K\@<=[-']\)\@<!\%(Order\%(::Same\|::Increase\|::Decrease\)\?\)\%(\k\|[-']\K\@=\)\@!"
259syn match p6Type display "\%(::\|\k\|\K\@<=[-']\)\@<!\%(Bool\%(::True\|::False\)\?\)\%(\k\|[-']\K\@=\)\@!"
260
261
262syn match p6Shebang display "\%^#!.*"
263syn match p6BlockLabel display "\%(^\s*\)\@<=\h\w*\s*::\@!\_s\@="
264syn match p6Number display "\k\@<!_\@!\%(\d\|__\@!\)\+_\@<!\%([eE]_\@!+\?\%(\d\|_\)\+\)\?_\@<!"
265syn match p6Float display "\k\@<!_\@!\%(\d\|__\@!\)\+_\@<![eE]_\@!-\%(\d\|_\)\+"
266syn match p6Float display "\k\@<!_\@<!\%(\d\|__\@!\)*_\@<!\.\@<!\._\@!\.\@!\a\@!\%(\d\|_\)\+_\@<!\%([eE]_\@!\%(\d\|_\)\+\)\?"
267
268syn match p6NumberBase display "[obxd]" contained
269syn match p6Number display "\<0\%(o[0-7][0-7_]*\)\@=" nextgroup=p6NumberBase
270syn match p6Number display "\<0\%(b[01][01_]*\)\@=" nextgroup=p6NumberBase
271syn match p6Number display "\<0\%(x\x[[:xdigit:]_]*\)\@=" nextgroup=p6NumberBase
272syn match p6Number display "\<0\%(d\d[[:digit:]_]*\)\@=" nextgroup=p6NumberBase
273syn match p6Number display "\%(\<0o\)\@<=[0-7][0-7_]*"
274syn match p6Number display "\%(\<0b\)\@<=[01][01_]*"
275syn match p6Number display "\%(\<0x\)\@<=\x[[:xdigit:]_]*"
276syn match p6Number display "\%(\<0d\)\@<=\d[[:digit:]_]*"
277
278syn match p6Version display "\<v\d\@=" nextgroup=p6VersionNum
279syn match p6VersionNum display "\d\+" nextgroup=p6VersionDot contained
280syn match p6VersionDot display "\.\%(\d\|\*\)\@=" nextgroup=p6VersionNum contained
281
282" try to distinguish the "is" function from the "is" trail auxiliary
283syn match p6Routine display "\%(\%(\S\k\@<!\|^\)\s*\)\@<=is\>"
284
285" does is a type constraint sometimes
286syn match p6TypeConstraint display "does\%(\s*\%(\k\|[-']\K\@=\)\)\@="
287
288" int is a type sometimes
289syn match p6Type display "\<int\>\%(\s*(\|\s\+\d\)\@!"
290
291" these Routine names are also Properties, if preceded by "is"
292syn match p6Property display "\%(is\s\+\)\@<=\%(signature\|context\|also\|shape\)"
293
294" The sigil in ::*Package
295syn match p6PackageTwigil display "\%(::\)\@<=\*"
296
297" $<match>
298syn region p6MatchVarSigil
299 \ matchgroup=p6Variable
300 \ start="\$\%(<<\@!\)\@="
301 \ end=">\@<="
302 \ contains=p6MatchVar
303
304syn region p6MatchVar
305 \ matchgroup=p6Twigil
306 \ start="<"
307 \ end=">"
308 \ contained
309
310" Contextualizers
311syn match p6Context display "\<\%(item\|list\|slice\|hash\)\>"
312syn match p6Context display "\%(\$\|@\|%\|&\|@@\)(\@="
313
314" the "$" placeholder in "$var1, $, var2 = @list"
315syn match p6Placeholder display "\%(,\s*\)\@<=\$\%(\K\|\%([.^*?=!~]\|:\@<!::\@!\)\)\@!"
316syn match p6Placeholder display "\$\%(\K\|\%([.^*?=!~]\|:\@<!::\@!\)\)\@!\%(,\s*\)\@="
317
318" Quoting
319
320" one cluster for every quote adverb
321syn cluster p6Interp_s
322 \ add=p6InterpScalar
323syn cluster p6Interp_scalar
324 \ add=p6InterpScalar
325
326syn cluster p6Interp_a
327 \ add=p6InterpArray
328syn cluster p6Interp_array
329 \ add=p6InterpArray
330
331syn cluster p6Interp_h
332 \ add=p6InterpHash
333syn cluster p6Interp_hash
334 \ add=p6InterpHash
335
336syn cluster p6Interp_f
337 \ add=p6InterpFunction
338syn cluster p6Interp_f
339 \ add=p6InterpFunction
340
341syn cluster p6Interp_c
342 \ add=p6InterpClosure
343syn cluster p6Interp_closure
344 \ add=p6InterpClosure
345
346
347if 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
354endif
355
356syn cluster p6Interp_q
357 \ add=p6EscQQ
358 \ add=p6EscBackSlash
359syn cluster p6Interp_single
360 \ add=p6EscQQ
361 \ add=p6EscBackSlash
362
363syn 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
372syn 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
381
382syn 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
389syn 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
396
397syn 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
404
405syn region p6InterpScalar
406 \ matchgroup=p6Context
407 \ start="\$\ze()\@!"
408 \ skip="([^)]*)"
409 \ end=")\zs"
410 \ contained
411 \ contains=TOP
412
413syn region p6InterpArray
414 \ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
415 \ end="\z1\zs"
416 \ contained
417 \ contains=TOP
418 \ keepend
419
420syn region p6InterpArray
421 \ matchgroup=p6Context
422 \ start="@\ze()\@!"
423 \ start="@@\ze()\@!"
424 \ skip="([^)]*)"
425 \ end=")\zs"
426 \ contained
427 \ contains=TOP
428
429syn region p6InterpHash
430 \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
431 \ end="\z1\zs"
432 \ contained
433 \ contains=TOP
434 \ keepend
435
436syn region p6InterpHash
437 \ matchgroup=p6Context
438 \ start="%\ze()\@!"
439 \ skip="([^)]*)"
440 \ end=")\zs"
441 \ contained
442 \ contains=TOP
443
444syn region p6InterpFunction
445 \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
446 \ end="\z1\zs"
447 \ contained
448 \ contains=TOP
449 \ keepend
450
451syn region p6InterpFunction
452 \ matchgroup=p6Context
453 \ start="&\ze()\@!"
454 \ skip="([^)]*)"
455 \ end=")\zs"
456 \ contained
457 \ contains=TOP
458
459syn region p6InterpClosure
460 \ start="\\\@<!{}\@!"
461 \ skip="{[^}]*}"
462 \ end="}"
463 \ contained
464 \ contains=TOP
465 \ keepend
466
467" generic escape
468syn match p6Escape display "\\\S" contained
469
470" escaped closing delimiters
471syn match p6EscQuote display "\\'" contained
472syn match p6EscDoubleQuote display "\\\"" contained
473syn match p6EscCloseAngle display "\\>" contained
474syn match p6EscCloseFrench display "\\»" contained
475syn match p6EscBackTick display "\\`" contained
476syn match p6EscForwardSlash display "\\/" contained
477syn match p6EscVerticalBar display "\\|" contained
478syn match p6EscExclamation display "\\!" contained
479syn match p6EscComma display "\\," contained
480syn match p6EscDollar display "\\\$" contained
481syn match p6EscCloseCurly display "\\}" contained
482syn match p6EscCloseBracket display "\\\]" contained
483
484" misc escapes
485syn match p6EscOctOld display "\\\d\{1,3}" contained
486syn match p6EscNull display "\\0\d\@!" contained
487syn match p6EscCodePoint display "\%(\\c\)\@<=\%(\d\|\S\|\[\)\@=" contained nextgroup=p6CodePoint
488syn match p6EscHex display "\%(\\x\)\@<=\%(\x\|\[\)\@=" contained nextgroup=p6HexSequence
489syn match p6EscOct display "\%(\\o\)\@<=\%(\o\|\[\)\@=" contained nextgroup=p6OctSequence
490syn match p6EscQQ display "\\qq" contained nextgroup=p6QQSequence
491syn match p6EscOpenCurly display "\\{" contained
492syn match p6EscHash display "\\#" contained
493syn match p6EscBackSlash display "\\\\" contained
494
495syn region p6QQSequence
496 \ matchgroup=p6Escape
497 \ start="\["
498 \ skip="\[[^\]]*]"
499 \ end="]"
500 \ contained
501 \ transparent
502 \ contains=@p6Interp_qq
503
504syn match p6CodePoint display "\%(\d\+\|\S\)" contained
505syn region p6CodePoint
506 \ matchgroup=p6Escape
507 \ start="\["
508 \ end="]"
509 \ contained
510
511syn match p6HexSequence display "\x\+" contained
512syn region p6HexSequence
513 \ matchgroup=p6Escape
514 \ start="\["
515 \ end="]"
516 \ contained
517
518syn match p6OctSequence display "\o\+" contained
519syn region p6OctSequence
520 \ matchgroup=p6Escape
521 \ start="\["
522 \ end="]"
523 \ contained
524
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.
530syn 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
537
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:
541"
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 "= "
547"
548" It never matches when:
549"
550" * Preceded by [<+~=] (e.g. <<foo>>, =<$foo>)
551" * Followed by [-=] (e.g. <--, <=, <==)
552syn 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
563
564syn region p6InnerAnglesOne
565 \ matchgroup=p6StringAngle
566 \ start="<"
567 \ skip="\\\@<!\\>"
568 \ end=">"
569 \ transparent
570 \ contained
571 \ contains=p6InnerAnglesOne
572
573" <<words>>
574syn region p6StringAngles
575 \ matchgroup=p6Quote
576 \ start="<<=\@!"
577 \ skip="\\\@<!\\>"
578 \ end=">>"
579 \ contains=p6InnerAnglesTwo,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseAngle,p6Adverb,p6StringSQ,p6StringDQ
580
581syn region p6InnerAnglesTwo
582 \ matchgroup=p6StringAngles
583 \ start="<<"
584 \ skip="\\\@<!\\>"
585 \ end=">>"
586 \ transparent
587 \ contained
588 \ contains=p6InnerAnglesTwo
589
590" «words»
591syn region p6StringFrench
592 \ matchgroup=p6Quote
593 \ start="«"
594 \ skip="\\\@<!\\»"
595 \ end="»"
596 \ contains=p6InnerFrench,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseFrench,p6Adverb,p6StringSQ,p6StringDQ
597
598syn region p6InnerFrench
599 \ matchgroup=p6StringFrench
600 \ start="«"
601 \ skip="\\\@<!\\»"
602 \ end="»"
603 \ transparent
604 \ contained
605 \ contains=p6InnerFrench
606
607" 'string'
608syn region p6StringSQ
609 \ matchgroup=p6Quote
610 \ start="'"
611 \ skip="\\\@<!\\'"
612 \ end="'"
613 \ contains=@p6Interp_q,p6EscQuote
614
615" "string"
616syn region p6StringDQ
617 \ matchgroup=p6Quote
618 \ start=+"+
619 \ skip=+\\\@<!\\"+
620 \ end=+"+
621 \ contains=@p6Interp_qq,p6EscDoubleQuote
622
623" Q// and friends.
624
625syn match p6QuoteQ display "\%([Qq]\%(ww\|to\|[qwxsahfcb]\)\?\)\>" nextgroup=p6QPairs skipwhite skipempty
626syn match p6QPairs contained transparent skipwhite skipempty nextgroup=p6StringQ,p6StringQ_PIR "\%(\_s*:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)*"
627
628if exists("perl6_embedded_pir")
629 syn include @p6PIR syntax/pir.vim
630endif
631
632" hardcoded set of delimiters
633let 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\ ]
648
649" double and triple delimiters too
650if 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", "\\%(\\\\\\@<!\\\\>>>\\|<<<\\%([^>]\\|>\\%(>>\\)\\@!\\)*>>>\\)"])
661endif
662
663if !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
668
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
675else
676 let s:before = "syn region p6StringQ matchgroup=p6Quote start=\"\\%("
677 let s:after = "\\%(\\_s*:!\\?\\K\\%(\\k\\|[-']\\K\\@=\\)*\\%(([^)]*)\\|\\[[^\\]]*]\\|<[^>]*>\\|«[^»]*»\\|{[^}]*}\\)\\?\\)*\\_s*\\)\\@<="
678
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 \ ]
690
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 \ ]
696
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"
702
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"
708
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"
716
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
729endif
730unlet s:delims
731
732" Match these so something else above can't. E.g. the "q" in "role q { }"
733" should not be considered a string
734syn match p6Normal display "\%(\<\%(role\|grammar\|slang\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*"
735
736" :key
737syn match p6Operator display ":\@<!::\@!!\?" nextgroup=p6Key
738syn match p6Key display "\k\%(\k\|[-']\K\@=\)*" contained
739
740" => and p5=> autoquoting
741syn match p6StringP5Auto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+p5=>"
742syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*\ze\%(p5\)\@<!=>"
743syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+=>"
744syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*p5\ze=>"
745
746" Hyperoperators. Needs to come after the quoting operators (<>, «», etc)
747exec "syn match p6HyperOp display \"»" .s:infix."»\\?\""
748exec "syn match p6HyperOp display \"«\\?".s:infix."«\""
749exec "syn match p6HyperOp display \"»" .s:infix."«\""
750exec "syn match p6HyperOp display \"«" .s:infix. "»\""
751
752exec "syn match p6HyperOp display \">>" .s:infix."\\%(>>\\)\\?\""
753exec "syn match p6HyperOp display \"\\%(<<\\)\\?".s:infix."<<\""
754exec "syn match p6HyperOp display \">>" .s:infix."<<\""
755exec "syn match p6HyperOp display \"<<" .s:infix.">>\""
756unlet s:infix
757
758" Regexes and grammars
759
760syn match p6RegexName display "\%(\<\%(regex\|rule\|token\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*" nextgroup=p6RegexBlockCrap skipwhite skipempty
761syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained
762
763syn region p6RegexBlock
764 \ matchgroup=p6Normal
765 \ start="{"
766 \ end="}"
767 \ contained
768 \ contains=@p6Regexen,@p6Variables
769
770" Perl 6 regex bits
771
772syn 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
791
792syn match p6RxMeta display contained ".\%(\k\|\s\)\@<!"
793syn match p6RxAnchor display contained "[$^]"
794syn match p6RxEscape display contained "\\\S"
795syn match p6RxCapture display contained "[()]"
796syn match p6RxAlternation display contained "|"
797syn match p6RxRange display contained "\.\."
798
799syn region p6RxClosure
800 \ matchgroup=p6Normal
801 \ start="{"
802 \ end="}"
803 \ contained
804 \ containedin=p6RxClosure
805 \ contains=TOP
806syn region p6RxGroup
807 \ matchgroup=p6StringSpecial2
808 \ start="\["
809 \ end="]"
810 \ contained
811 \ contains=@p6Regexen,@p6Variables
812syn region p6RxAssertion
813 \ matchgroup=p6StringSpecial2
814 \ start="<"
815 \ end=">"
816 \ contained
817 \ contains=@p6Regexen,@p6Variables,p6RxCharClass,p6RxAssertCall
818syn region p6RxAssertCall
819 \ matchgroup=p6Normal
820 \ start="\%(::\|\%(\K\%(\k\|[-']\K\@=\)*\)\)\@<=(\@="
821 \ end=")\@<="
822 \ contained
823 \ contains=TOP
824syn region p6RxCharClass
825 \ matchgroup=p6StringSpecial2
826 \ start="\%(<[-!+?]\?\)\@<=\["
827 \ skip="\\]"
828 \ end="]"
829 \ contained
830 \ contains=p6RxRange,p6RxEscape,p6EscHex,p6EscOct,p6EscNull
831syn region p6RxQuoteWords
832 \ matchgroup=p6StringSpecial2
833 \ start="< "
834 \ end=">"
835 \ contained
836syn region p6RxAdverb
837 \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\)"
838 \ end="\z1\zs"
839 \ contained
840 \ contains=TOP
841 \ keepend
842syn region p6RxAdverbArg
843 \ start="\%(:!\?\K\%(\k\|[-']\K\@=\)*\)\@<=("
844 \ skip="([^)]*)"
845 \ end=")"
846 \ contained
847 \ contains=TOP
848syn region p6RxStorage
849 \ matchgroup=p6Operator
850 \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@="
851 \ end="$"
852 \ contains=TOP
853 \ contained
854
855" Perl 5 regex bits
856
857syn cluster p6RegexP5Base
858 \ add=p6RxP5Escape
859 \ add=p6RxP5Oct
860 \ add=p6RxP5Hex
861 \ add=p6RxP5EscMeta
862 \ add=p6RxP5CodePoint
863 \ add=p6RxP5Prop
864
865" normal regex stuff
866syn 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
879
880" inside character classes
881syn cluster p6RegexP5Class
882 \ add=@p6RegexP5Base
883 \ add=p6RxP5Posix
884 \ add=p6RxP5Range
885
886syn match p6RxP5Escape display contained "\\\S"
887syn match p6RxP5CodePoint display contained "\\c\S\@=" nextgroup=p6RxP5CPId
888syn match p6RxP5CPId display contained "\S"
889syn match p6RxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=p6RxP5OctSeq
890syn match p6RxP5OctSeq display contained "\o\{1,3}"
891syn match p6RxP5Anchor display contained "[\^$]"
892syn match p6RxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=p6RxP5HexSeq
893syn match p6RxP5HexSeq display contained "\x\{1,2}"
894syn region p6RxP5HexSeq
895 \ matchgroup=p6RxP5Escape
896 \ start="{"
897 \ end="}"
898 \ contained
899syn region p6RxP5Named
900 \ matchgroup=p6RxP5Escape
901 \ start="\%(\\N\)\@<={"
902 \ end="}"
903 \ contained
904syn match p6RxP5Quantifier display contained "\%([+*]\|(\@<!?\)"
905syn match p6RxP5ReadRef display contained "\\[1-9]\d\@!"
906syn match p6RxP5ReadRef display contained "\\k<\@=" nextgroup=p6RxP5ReadRefId
907syn region p6RxP5ReadRefId
908 \ matchgroup=p6RxP5Escape
909 \ start="<"
910 \ end=">"
911 \ contained
912syn match p6RxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=p6RxP5WriteRefId
913syn match p6RxP5WriteRefId display contained "\d\+"
914syn region p6RxP5WriteRefId
915 \ matchgroup=p6RxP5Escape
916 \ start="{"
917 \ end="}"
918 \ contained
919syn match p6RxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=p6RxP5PropId
920syn match p6RxP5PropId display contained "\a"
921syn region p6RxP5PropId
922 \ matchgroup=p6RxP5Escape
923 \ start="{"
924 \ end="}"
925 \ contained
926syn match p6RxP5Meta display contained "[(|).]"
927syn match p6RxP5ParenMod display contained "(\@<=?\@=" nextgroup=p6RxP5Mod,p6RxP5ModName,p6RxP5Code
928syn match p6RxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)"
929syn match p6RxP5Mod display contained "?-\?[impsx]\+"
930syn match p6RxP5Mod display contained "?\%([-+]\?\d\+\|R\)"
931syn match p6RxP5Mod display contained "?(DEFINE)"
932syn match p6RxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=p6RxP5ModDef
933syn match p6RxP5ModDef display contained "\h\w*"
934syn region p6RxP5ModName
935 \ matchgroup=p6StringSpecial
936 \ start="?'"
937 \ end="'"
938 \ contained
939syn region p6RxP5ModName
940 \ matchgroup=p6StringSpecial
941 \ start="?P\?<"
942 \ end=">"
943 \ contained
944syn region p6RxP5Code
945 \ matchgroup=p6StringSpecial
946 \ start="??\?{"
947 \ end="})\@="
948 \ contained
949 \ contains=TOP
950syn match p6RxP5EscMeta display contained "\\[?*.{}()[\]|\^$]"
951syn match p6RxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=p6RxP5CountId
952syn region p6RxP5CountId
953 \ matchgroup=p6RxP5Escape
954 \ start="{"
955 \ end="}"
956 \ contained
957syn match p6RxP5Verb display contained "(\@<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)"
958syn region p6RxP5QuoteMeta
959 \ matchgroup=p6RxP5Escape
960 \ start="\\Q"
961 \ end="\\E"
962 \ contained
963 \ contains=@p6Variables,p6EscBackSlash
964syn region p6RxP5CharClass
965 \ matchgroup=p6StringSpecial
966 \ start="\[\^\?"
967 \ skip="\\]"
968 \ end="]"
969 \ contained
970 \ contains=@p6RegexP5Class
971syn region p6RxP5Posix
972 \ matchgroup=p6RxP5Escape
973 \ start="\[:"
974 \ end=":]"
975 \ contained
976syn match p6RxP5Range display contained "-"
977
978" 'string' inside a regex
979syn region p6RxStringSQ
980 \ matchgroup=p6Quote
981 \ start="'"
982 \ skip="\\\@<!\\'"
983 \ end="'"
984 \ contained
985 \ contains=p6EscQuote,p6EscBackSlash
986
987" "string" inside a regex
988syn region p6RxStringDQ
989 \ matchgroup=p6Quote
990 \ start=+"+
991 \ skip=+\\\@<!\\"+
992 \ end=+"+
993 \ contained
994 \ contains=p6EscDoubleQuote,p6EscBackSlash
995
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
999syn cluster p6Variables
1000 \ add=p6VarSlash
1001 \ add=p6VarExclam
1002 \ add=p6VarMatch
1003 \ add=p6VarNum
1004 \ add=p6Variable
1005
1006syn match p6VarSlash display "\$/"
1007syn match p6VarExclam display "\$!"
1008syn match p6VarMatch display "\$¢"
1009syn match p6VarNum display "\$\d\+"
1010syn match p6Variable display "\%(@@\|[@&$%]\$*\)\%(::\|\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\)\|\K\)\@=" nextgroup=p6Twigil,p6VarName,p6PackageScope
1011syn match p6VarName display "\K\%(\k\|[-']\K\@=\)*" contained
1012syn match p6Twigil display "\%([.^*?=!~]\|:\@<!::\@!\)\K\@=" nextgroup=p6PackageScope,p6VarName contained
1013syn match p6PackageScope display "\%(\K\%(\k\|[-']\K\@=\)*\)\?::" nextgroup=p6PackageScope,p6VarName contained
1014
1015" Perl 6 regex regions
1016
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
1022syn region p6Match
1023 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001024 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\%(\<\%(split\|while\|until\|if\|unless\)\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=//\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001025 \ 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
1030
1031" m/foo/, mm/foo/, rx/foo/
1032syn region p6Match
1033 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001034 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=//\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001035 \ skip="\\/"
1036 \ end="/"
1037 \ keepend
1038 \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1039
1040" m!foo!, mm!foo!, rx!foo!
1041syn region p6Match
1042 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001043 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=!!\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001044 \ skip="\\!"
1045 \ end="!"
1046 \ keepend
1047 \ contains=@p6Regexen,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
1048
1049" m$foo$, mm$foo$, rx$foo$, m|foo|, mm|foo|, rx|foo|, etc
1050syn region p6Match
1051 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001052 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([\"'`|,$]\)\$\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001053 \ skip="\\\z1"
1054 \ end="\z1"
1055 \ keepend
1056 \ contains=@p6Regexen,@p6Variables
1057
1058" m (foo), mm (foo), rx (foo)
1059syn region p6Match
1060 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001061 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s\+\)\@<=()\@!)\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001062 \ skip="\\)"
1063 \ end=")"
1064 \ contains=@p6Regexen,@p6Variables
1065
1066" m[foo], mm[foo], rx[foo]
1067syn region p6Match
1068 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001069 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\[]\@!]\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001070 \ skip="\\]"
1071 \ end="]"
1072 \ contains=@p6Regexen,@p6Variables
1073
1074" m{foo}, mm{foo}, rx{foo}
1075syn region p6Match
1076 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001077 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<={}\@!}\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001078 \ skip="\\}"
1079 \ end="}"
1080 \ contains=@p6Regexen,@p6Variables
1081
1082" m<foo>, mm<foo>, rx<foo>
1083syn region p6Match
1084 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001085 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=<>\@!>\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001086 \ skip="\\>"
1087 \ end=">"
1088 \ contains=@p6Regexen,@p6Variables
1089
1090" m«foo», mm«foo», rx«foo»
1091syn region p6Match
1092 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001093 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=«»\@!»\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001094 \ skip="\\»"
1095 \ end="»"
1096 \ contains=@p6Regexen,@p6Variables
1097
1098" Substitutions
1099
1100" s/foo/bar/
1101syn region p6Match
1102 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001103 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=/"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001104 \ skip="\\/"
1105 \ end="/"me=e-1
1106 \ keepend
1107 \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1108 \ nextgroup=p6Substitution
1109
1110syn region p6Substitution
1111 \ matchgroup=p6Quote
1112 \ start="/"
1113 \ skip="\\/"
1114 \ end="/"
1115 \ contained
1116 \ keepend
1117 \ contains=@p6Interp_qq
1118
1119" s!foo!bar!
1120syn region p6Match
1121 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001122 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001123 \ skip="\\!"
1124 \ end="!"me=e-1
1125 \ keepend
1126 \ contains=@p6Regexen,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
1127 \ nextgroup=p6Substitution
1128
1129syn region p6Substitution
1130 \ matchgroup=p6Quote
1131 \ start="!"
1132 \ skip="\\!"
1133 \ end="!"
1134 \ contained
1135 \ keepend
1136 \ contains=@p6Interp_qq
1137
1138" s$foo$bar$, s|foo|bar, etc
1139syn region p6Match
1140 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001141 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([\"'`|,$]\)"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001142 \ skip="\\\z1"
1143 \ end="\z1"me=e-1
1144 \ keepend
1145 \ contains=@p6Regexen,@p6Variables
1146 \ nextgroup=p6Substitution
1147
1148syn region p6Substitution
1149 \ matchgroup=p6Quote
1150 \ start="\z([\"'`|,$]\)"
1151 \ skip="\\\z1"
1152 \ end="\z1"
1153 \ contained
1154 \ keepend
1155 \ contains=@p6Interp_qq
1156
1157" s{foo}
1158syn region p6Match
1159 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001160 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<={}\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001161 \ skip="\\}"
1162 \ end="}"
1163 \ contains=@p6Regexen,@p6Variables
1164
1165" s[foo]
1166syn region p6Match
1167 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001168 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\[]\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001169 \ skip="\\]"
1170 \ end="]"
1171 \ contains=@p6Regexen,@p6Variables
1172
1173" s<foo>
1174syn region p6Match
1175 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001176 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=<>\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001177 \ skip="\\>"
1178 \ end=">"
1179 \ contains=@p6Regexen,@p6Variables
1180
1181" s«foo»
1182syn region p6Match
1183 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001184 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=«»\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001185 \ skip="\\»"
1186 \ end="»"
1187 \ contains=@p6Regexen,@p6Variables
1188
1189" s (foo)
1190syn region p6Match
1191 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001192 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s\+\)\@<=()\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001193 \ skip="\\)"
1194 \ end=")"
1195 \ contains=@p6Regexen,@p6Variables
1196
1197" Perl 5 regex regions
1198
1199" m:P5//
1200syn region p6Match
1201 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001202 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<=/"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001203 \ skip="\\/"
1204 \ end="/"
1205 \ contains=@p6RegexP5,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
1206
1207" m:P5!!
1208syn region p6Match
1209 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001210 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<=!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001211 \ skip="\\!"
1212 \ end="!"
1213 \ contains=@p6RegexP5,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
1214
1215" m:P5$$, m:P5||, etc
1216syn region p6Match
1217 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001218 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<=\z([\"'`|,$]\)"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001219 \ skip="\\\z1"
1220 \ end="\z1"
1221 \ contains=@p6RegexP5,@p6Variables
1222
1223" m:P5 ()
1224syn region p6Match
1225 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001226 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s\+\)\@<=()\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001227 \ skip="\\)"
1228 \ end=")"
1229 \ contains=@p6RegexP5,@p6Variables
1230
1231" m:P5[]
1232syn region p6Match
1233 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001234 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<=[]\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001235 \ skip="\\]"
1236 \ end="]"
1237 \ contains=@p6RegexP5,@p6Variables
1238
1239" m:P5{}
1240syn region p6Match
1241 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001242 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<={}\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001243 \ skip="\\}"
1244 \ end="}"
1245 \ contains=@p6RegexP5,p6Variables
1246
1247" m:P5<>
1248syn region p6Match
1249 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001250 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<=<>\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001251 \ skip="\\>"
1252 \ end=">"
1253 \ contains=@p6RegexP5,p6Variables
1254
1255" m:P5«»
1256syn region p6Match
1257 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001258 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<m\s*:P\%(erl\)\?5\s*\)\@<=«»\@!"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001259 \ skip="\\»"
1260 \ end="»"
1261 \ contains=@p6RegexP5,p6Variables
1262
1263" Transliteration
1264
1265" tr/foo/bar/, tr|foo|bar, etc
1266syn region p6String
1267 \ matchgroup=p6Quote
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001268 \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@<!\<tr\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([/\"'`|!,$]\)"
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001269 \ skip="\\\z1"
1270 \ end="\z1"me=e-1
1271 \ contains=p6RxRange
1272 \ nextgroup=p6Transliteration
1273
1274syn region p6Transliteration
1275 \ matchgroup=p6Quote
1276 \ start="\z([/\"'`|!,$]\)"
1277 \ skip="\\\z1"
1278 \ end="\z1"
1279 \ contained
1280 \ contains=@p6Interp_qq
1281
1282" Comments
1283
1284" normal end-of-line comment
1285syn match p6Comment display "#.*" contains=p6Attention
1286
1287" Multiline comments. Arbitrary numbers of opening brackets are allowed,
1288" but we only define regions for 1 to 3
1289syn region p6Comment
1290 \ matchgroup=p6Comment
1291 \ start="^\@<!#("
1292 \ skip="([^)]*)"
1293 \ end=")"
1294 \ matchgroup=p6Error
1295 \ start="^#("
1296 \ contains=p6Attention,p6Comment
1297syn region p6Comment
1298 \ matchgroup=p6Comment
1299 \ start="^\@<!#\["
1300 \ skip="\[[^\]]*]"
1301 \ end="]"
1302 \ matchgroup=p6Error
1303 \ start="^#\["
1304 \ contains=p6Attention,p6Comment
1305syn region p6Comment
1306 \ matchgroup=p6Comment
1307 \ start="^\@<!#{"
1308 \ skip="{[^}]*}"
1309 \ end="}"
1310 \ matchgroup=p6Error
1311 \ start="^#{"
1312 \ contains=p6Attention,p6Comment
1313syn region p6Comment
1314 \ matchgroup=p6Comment
1315 \ start="^\@<!#<"
1316 \ skip="<[^>]*>"
1317 \ end=">"
1318 \ matchgroup=p6Error
1319 \ start="^#<"
1320 \ contains=p6Attention,p6Comment
1321syn region p6Comment
1322 \ matchgroup=p6Comment
1323 \ start="^\@<!#«"
1324 \ skip="«[^»]*»"
1325 \ end="»"
1326 \ matchgroup=p6Error
1327 \ start="^#«"
1328 \ contains=p6Attention,p6Comment
1329
1330" double and triple delimiters
1331if 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
1348
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
1365
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
1382
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
1399
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
1416endif
1417
1418" Pod
1419
1420" Abbreviated blocks (implicit code forbidden)
1421syn region p6PodAbbrRegion
1422 \ matchgroup=p6PodPrefix
1423 \ start="^=\ze\K\k*"
1424 \ end="^\ze\%(\s*$\|=\K\)"
1425 \ contains=p6PodAbbrNoCodeType
1426 \ keepend
1427
1428syn region p6PodAbbrNoCodeType
1429 \ matchgroup=p6PodType
1430 \ start="\K\k*"
1431 \ end="^\ze\%(\s*$\|=\K\)"
1432 \ contained
1433 \ contains=p6PodName,p6PodAbbrNoCode
1434
1435syn match p6PodName contained ".\+" contains=@p6PodFormat
1436syn match p6PodComment contained ".\+"
1437
1438syn region p6PodAbbrNoCode
1439 \ start="^"
1440 \ end="^\ze\%(\s*$\|=\K\)"
1441 \ contained
1442 \ contains=@p6PodFormat
1443
1444" Abbreviated blocks (everything is code)
1445syn region p6PodAbbrRegion
1446 \ matchgroup=p6PodPrefix
1447 \ start="^=\zecode\>"
1448 \ end="^\ze\%(\s*$\|=\K\)"
1449 \ contains=p6PodAbbrCodeType
1450 \ keepend
1451
1452syn region p6PodAbbrCodeType
1453 \ matchgroup=p6PodType
1454 \ start="\K\k*"
1455 \ end="^\ze\%(\s*$\|=\K\)"
1456 \ contained
1457 \ contains=p6PodName,p6PodAbbrCode
1458
1459syn region p6PodAbbrCode
1460 \ start="^"
1461 \ end="^\ze\%(\s*$\|=\K\)"
1462 \ contained
1463
1464" Abbreviated blocks (everything is a comment)
1465syn region p6PodAbbrRegion
1466 \ matchgroup=p6PodPrefix
1467 \ start="^=\zecomment\>"
1468 \ end="^\ze\%(\s*$\|=\K\)"
1469 \ contains=p6PodAbbrCommentType
1470 \ keepend
1471
1472syn region p6PodAbbrCommentType
1473 \ matchgroup=p6PodType
1474 \ start="\K\k*"
1475 \ end="^\ze\%(\s*$\|=\K\)"
1476 \ contained
1477 \ contains=p6PodComment,p6PodAbbrNoCode
1478
1479" Abbreviated blocks (implicit code allowed)
1480syn region p6PodAbbrRegion
1481 \ matchgroup=p6PodPrefix
1482 \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>"
1483 \ end="^\ze\%(\s*$\|=\K\)"
1484 \ contains=p6PodAbbrType
1485 \ keepend
1486
1487syn region p6PodAbbrType
1488 \ matchgroup=p6PodType
1489 \ start="\K\k*"
1490 \ end="^\ze\%(\s*$\|=\K\)"
1491 \ contained
1492 \ contains=p6PodName,p6PodAbbr
1493
1494syn region p6PodAbbr
1495 \ start="^"
1496 \ end="^\ze\%(\s*$\|=\K\)"
1497 \ contained
1498 \ contains=@p6PodFormat,p6PodImplicitCode
1499
1500" Abbreviated block to end-of-file
1501syn region p6PodAbbrRegion
1502 \ matchgroup=p6PodPrefix
1503 \ start="^=\zeEND\>"
1504 \ end="\%$"
1505 \ contains=p6PodAbbrEOFType
1506 \ keepend
1507
1508syn region p6PodAbbrEOFType
1509 \ matchgroup=p6PodType
1510 \ start="\K\k*"
1511 \ end="\%$"
1512 \ contained
1513 \ contains=p6PodName,p6PodAbbrEOF
1514
1515syn region p6PodAbbrEOF
1516 \ start="^"
1517 \ end="\%$"
1518 \ contained
1519 \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1520
1521" Directives
1522syn region p6PodDirectRegion
1523 \ matchgroup=p6PodPrefix
1524 \ start="^=\%(config\|use\)\>"
1525 \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1526 \ contains=p6PodDirectArgRegion
1527 \ keepend
1528
1529syn region p6PodDirectArgRegion
1530 \ matchgroup=p6PodType
1531 \ start="\S\+"
1532 \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1533 \ contained
1534 \ contains=p6PodDirectConfigRegion
1535
1536syn region p6PodDirectConfigRegion
1537 \ start=""
1538 \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1539 \ contained
1540 \ contains=@p6PodConfig
1541
1542" =encoding is a special directive
1543syn region p6PodDirectRegion
1544 \ matchgroup=p6PodPrefix
1545 \ start="^=encoding\>"
1546 \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1547 \ contains=p6PodEncodingArgRegion
1548 \ keepend
1549
1550syn region p6PodEncodingArgRegion
1551 \ matchgroup=p6PodName
1552 \ start="\S\+"
1553 \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1554 \ contained
1555
1556" Paragraph blocks (implicit code forbidden)
1557syn region p6PodParaRegion
1558 \ matchgroup=p6PodPrefix
1559 \ start="^=for\>"
1560 \ end="^\ze\%(\s*$\|=\K\)"
1561 \ contains=p6PodParaNoCodeTypeRegion
1562 \ keepend
1563 \ extend
1564
1565syn region p6PodParaNoCodeTypeRegion
1566 \ matchgroup=p6PodType
1567 \ start="\K\k*"
1568 \ end="^\ze\%(\s*$\|=\K\)"
1569 \ contained
1570 \ contains=p6PodParaNoCode,p6PodParaConfigRegion
1571
1572syn region p6PodParaConfigRegion
1573 \ start=""
1574 \ end="^\ze\%([^=]\|=\k\@<!\)"
1575 \ contained
1576 \ contains=@p6PodConfig
1577
1578syn region p6PodParaNoCode
1579 \ start="^[^=]"
1580 \ end="^\ze\%(\s*$\|=\K\)"
1581 \ contained
1582 \ contains=@p6PodFormat
1583
1584" Paragraph blocks (everything is code)
1585syn region p6PodParaRegion
1586 \ matchgroup=p6PodPrefix
1587 \ start="^=for\>\ze\s*code\>"
1588 \ end="^\ze\%(\s*$\|=\K\)"
1589 \ contains=p6PodParaCodeTypeRegion
1590 \ keepend
1591 \ extend
1592
1593syn region p6PodParaCodeTypeRegion
1594 \ matchgroup=p6PodType
1595 \ start="\K\k*"
1596 \ end="^\ze\%(\s*$\|=\K\)"
1597 \ contained
1598 \ contains=p6PodParaCode,p6PodParaConfigRegion
1599
1600syn region p6PodParaCode
1601 \ start="^[^=]"
1602 \ end="^\ze\%(\s*$\|=\K\)"
1603 \ contained
1604
1605" Paragraph blocks (implicit code allowed)
1606syn 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
1613
1614syn region p6PodParaTypeRegion
1615 \ matchgroup=p6PodType
1616 \ start="\K\k*"
1617 \ end="^\ze\%(\s*$\|=\K\)"
1618 \ contained
1619 \ contains=p6PodPara,p6PodParaConfigRegion
1620
1621syn region p6PodPara
1622 \ start="^[^=]"
1623 \ end="^\ze\%(\s*$\|=\K\)"
1624 \ contained
1625 \ contains=@p6PodFormat,p6PodImplicitCode
1626
1627" Paragraph block to end-of-file
1628syn region p6PodParaRegion
1629 \ matchgroup=p6PodPrefix
1630 \ start="^=for\>\ze\s\+END\>"
1631 \ end="\%$"
1632 \ contains=p6PodParaEOFTypeRegion
1633 \ keepend
1634 \ extend
1635
1636syn region p6PodParaEOFTypeRegion
1637 \ matchgroup=p6PodType
1638 \ start="\K\k*"
1639 \ end="\%$"
1640 \ contained
1641 \ contains=p6PodParaEOF,p6PodParaConfigRegion
1642
1643syn region p6PodParaEOF
1644 \ start="^[^=]"
1645 \ end="\%$"
1646 \ contained
1647 \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1648
1649" Delimited blocks (implicit code forbidden)
1650syn region p6PodDelimRegion
1651 \ matchgroup=p6PodPrefix
1652 \ start="^=begin\>"
1653 \ end="^=end\>"
1654 \ contains=p6PodDelimNoCodeTypeRegion
1655 \ keepend
1656 \ extend
1657
1658syn region p6PodDelimNoCodeTypeRegion
1659 \ matchgroup=p6PodType
1660 \ start="\K\k*"
1661 \ end="^\ze=end\>"
1662 \ contained
1663 \ contains=p6PodDelimNoCode,p6PodDelimConfigRegion
1664
1665syn region p6PodDelimConfigRegion
1666 \ start=""
1667 \ end="^\ze\%([^=]\|=\K\|\s*$\)"
1668 \ contained
1669 \ contains=@p6PodConfig
1670
1671syn region p6PodDelimNoCode
1672 \ start="^"
1673 \ end="^\ze=end\>"
1674 \ contained
1675 \ contains=@p6PodNestedBlocks,@p6PodFormat
1676
1677" Delimited blocks (everything is code)
1678syn region p6PodDelimRegion
1679 \ matchgroup=p6PodPrefix
1680 \ start="^=begin\>\ze\s*code\>"
1681 \ end="^=end\>"
1682 \ contains=p6PodDelimCodeTypeRegion
1683 \ keepend
1684 \ extend
1685
1686syn region p6PodDelimCodeTypeRegion
1687 \ matchgroup=p6PodType
1688 \ start="\K\k*"
1689 \ end="^\ze=end\>"
1690 \ contained
1691 \ contains=p6PodDelimCode,p6PodDelimConfigRegion
1692
1693syn region p6PodDelimCode
1694 \ start="^"
1695 \ end="^\ze=end\>"
1696 \ contained
1697 \ contains=@p6PodNestedBlocks
1698
1699" Delimited blocks (implicit code allowed)
1700syn region p6PodDelimRegion
1701 \ matchgroup=p6PodPrefix
1702 \ start="^=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>"
1703 \ end="^=end\>"
1704 \ contains=p6PodDelimTypeRegion
1705 \ keepend
1706 \ extend
1707
1708syn region p6PodDelimTypeRegion
1709 \ matchgroup=p6PodType
1710 \ start="\K\k*"
1711 \ end="^\ze=end\>"
1712 \ contained
1713 \ contains=p6PodDelim,p6PodDelimConfigRegion
1714
1715syn region p6PodDelim
1716 \ start="^"
1717 \ end="^\ze=end\>"
1718 \ contained
1719 \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1720
1721" Delimited block to end-of-file
1722syn region p6PodDelimRegion
1723 \ matchgroup=p6PodPrefix
1724 \ start="^=begin\>\ze\s\+END\>"
1725 \ end="\%$"
1726 \ contains=p6PodDelimEOFTypeRegion
1727 \ extend
1728
1729syn region p6PodDelimEOFTypeRegion
1730 \ matchgroup=p6PodType
1731 \ start="\K\k*"
1732 \ end="\%$"
1733 \ contained
1734 \ contains=p6PodDelimEOF,p6PodDelimConfigRegion
1735
1736syn region p6PodDelimEOF
1737 \ start="^"
1738 \ end="\%$"
1739 \ contained
1740 \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode
1741
1742syn cluster p6PodConfig
1743 \ add=p6PodConfigOperator
1744 \ add=p6PodExtraConfig
1745 \ add=p6StringAuto
1746 \ add=p6PodAutoQuote
1747 \ add=p6StringSQ
1748
1749syn region p6PodParens
1750 \ start="("
1751 \ end=")"
1752 \ contained
1753 \ contains=p6Number,p6StringSQ
1754
1755syn match p6PodAutoQuote display contained "=>"
1756syn match p6PodConfigOperator display contained ":!\?" nextgroup=p6PodConfigOption
1757syn match p6PodConfigOption display contained "[^[:space:](<]\+" nextgroup=p6PodParens,p6StringAngle
1758syn match p6PodExtraConfig display contained "^="
1759syn match p6PodVerticalBar display contained "|"
1760syn match p6PodColon display contained ":"
1761syn match p6PodSemicolon display contained ";"
1762syn match p6PodComma display contained ","
1763syn match p6PodImplicitCode display contained "^\s.*"
1764
1765syn region p6PodDelimEndRegion
1766 \ matchgroup=p6PodType
1767 \ start="\%(^=end\>\)\@<="
1768 \ end="\K\k*"
1769
1770" These may appear inside delimited blocks
1771syn cluster p6PodNestedBlocks
1772 \ add=p6PodAbbrRegion
1773 \ add=p6PodDirectRegion
1774 \ add=p6PodParaRegion
1775 \ add=p6PodDelimRegion
1776 \ add=p6PodDelimEndRegion
1777
1778" Pod formatting codes
1779
1780syn cluster p6PodFormat
1781 \ add=p6PodFormatOne
1782 \ add=p6PodFormatTwo
1783 \ add=p6PodFormatThree
1784 \ add=p6PodFormatFrench
1785
1786" Balanced angles found inside formatting codes. Ensures proper nesting.
1787
1788syn region p6PodFormatAnglesOne
1789 \ matchgroup=p6PodFormat
1790 \ start="<"
1791 \ skip="<[^>]*>"
1792 \ end=">"
1793 \ transparent
1794 \ contained
1795 \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne
1796
1797syn region p6PodFormatAnglesTwo
1798 \ matchgroup=p6PodFormat
1799 \ start="<<"
1800 \ skip="<<[^>]*>>"
1801 \ end=">>"
1802 \ transparent
1803 \ contained
1804 \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo
1805
1806syn region p6PodFormatAnglesThree
1807 \ matchgroup=p6PodFormat
1808 \ start="<<<"
1809 \ skip="<<<[^>]*>>>"
1810 \ end=">>>"
1811 \ transparent
1812 \ contained
1813 \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree
1814
1815syn region p6PodFormatAnglesFrench
1816 \ matchgroup=p6PodFormat
1817 \ start="«"
1818 \ skip="«[^»]*»"
1819 \ end="»"
1820 \ transparent
1821 \ contained
1822 \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree
1823
1824" All formatting codes
1825
1826syn region p6PodFormatOne
1827 \ matchgroup=p6PodFormatCode
1828 \ start="\u<"
1829 \ skip="<[^>]*>"
1830 \ end=">"
1831 \ contained
1832 \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne
1833
1834syn region p6PodFormatTwo
1835 \ matchgroup=p6PodFormatCode
1836 \ start="\u<<"
1837 \ skip="<<[^>]*>>"
1838 \ end=">>"
1839 \ contained
1840 \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo
1841
1842syn region p6PodFormatThree
1843 \ matchgroup=p6PodFormatCode
1844 \ start="\u<<<"
1845 \ skip="<<<[^>]*>>>"
1846 \ end=">>>"
1847 \ contained
1848 \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree
1849
1850syn region p6PodFormatFrench
1851 \ matchgroup=p6PodFormatCode
1852 \ start="\u«"
1853 \ skip="«[^»]*»"
1854 \ end="»"
1855 \ contained
1856 \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree
1857
1858" C<> and V<> don't allow nested formatting formatting codes
1859
1860syn region p6PodFormatOne
1861 \ matchgroup=p6PodFormatCode
1862 \ start="[CV]<"
1863 \ skip="<[^>]*>"
1864 \ end=">"
1865 \ contained
1866 \ contains=p6PodFormatAnglesOne
1867
1868syn region p6PodFormatTwo
1869 \ matchgroup=p6PodFormatCode
1870 \ start="[CV]<<"
1871 \ skip="<<[^>]*>>"
1872 \ end=">>"
1873 \ contained
1874 \ contains=p6PodFormatAnglesTwo
1875
1876syn region p6PodFormatThree
1877 \ matchgroup=p6PodFormatCode
1878 \ start="[CV]<<<"
1879 \ skip="<<<[^>]*>>>"
1880 \ end=">>>"
1881 \ contained
1882 \ contains=p6PodFormatAnglesThree
1883
1884syn region p6PodFormatFrench
1885 \ matchgroup=p6PodFormatCode
1886 \ start="[CV]«"
1887 \ skip="«[^»]*»"
1888 \ end="»"
1889 \ contained
1890 \ contains=p6PodFormatAnglesFrench
1891
1892" L<> can have a "|" separator
1893
1894syn region p6PodFormatOne
1895 \ matchgroup=p6PodFormatCode
1896 \ start="L<"
1897 \ skip="<[^>]*>"
1898 \ end=">"
1899 \ contained
1900 \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar
1901
1902syn region p6PodFormatTwo
1903 \ matchgroup=p6PodFormatCode
1904 \ start="L<<"
1905 \ skip="<<[^>]*>>"
1906 \ end=">>"
1907 \ contained
1908 \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar
1909
1910syn region p6PodFormatThree
1911 \ matchgroup=p6PodFormatCode
1912 \ start="L<<<"
1913 \ skip="<<<[^>]*>>>"
1914 \ end=">>>"
1915 \ contained
1916 \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar
1917
1918syn region p6PodFormatFrench
1919 \ matchgroup=p6PodFormatCode
1920 \ start="L«"
1921 \ skip="«[^»]*»"
1922 \ end="»"
1923 \ contained
1924 \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar
1925
1926" E<> can have a ";" separator
1927
1928syn region p6PodFormatOne
1929 \ matchgroup=p6PodFormatCode
1930 \ start="E<"
1931 \ skip="<[^>]*>"
1932 \ end=">"
1933 \ contained
1934 \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodSemiColon
1935
1936syn region p6PodFormatTwo
1937 \ matchgroup=p6PodFormatCode
1938 \ start="E<<"
1939 \ skip="<<[^>]*>>"
1940 \ end=">>"
1941 \ contained
1942 \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodSemiColon
1943
1944syn region p6PodFormatThree
1945 \ matchgroup=p6PodFormatCode
1946 \ start="E<<<"
1947 \ skip="<<<[^>]*>>>"
1948 \ end=">>>"
1949 \ contained
1950 \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon
1951
1952syn region p6PodFormatFrench
1953 \ matchgroup=p6PodFormatCode
1954 \ start="E«"
1955 \ skip="«[^»]*»"
1956 \ end="»"
1957 \ contained
1958 \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon
1959
1960" M<> can have a ":" separator
1961
1962syn region p6PodFormatOne
1963 \ matchgroup=p6PodFormatCode
1964 \ start="M<"
1965 \ skip="<[^>]*>"
1966 \ end=">"
1967 \ contained
1968 \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodColon
1969
1970syn region p6PodFormatTwo
1971 \ matchgroup=p6PodFormatCode
1972 \ start="M<<"
1973 \ skip="<<[^>]*>>"
1974 \ end=">>"
1975 \ contained
1976 \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodColon
1977
1978syn region p6PodFormatThree
1979 \ matchgroup=p6PodFormatCode
1980 \ start="M<<<"
1981 \ skip="<<<[^>]*>>>"
1982 \ end=">>>"
1983 \ contained
1984 \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon
1985
1986syn region p6PodFormatFrench
1987 \ matchgroup=p6PodFormatCode
1988 \ start="M«"
1989 \ skip="«[^»]*»"
1990 \ end="»"
1991 \ contained
1992 \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon
1993
1994" D<> can have "|" and ";" separators
1995
1996syn region p6PodFormatOne
1997 \ matchgroup=p6PodFormatCode
1998 \ start="D<"
1999 \ skip="<[^>]*>"
2000 \ end=">"
2001 \ contained
2002 \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon
2003
2004syn region p6PodFormatTwo
2005 \ matchgroup=p6PodFormatCode
2006 \ start="D<<"
2007 \ skip="<<[^>]*>>"
2008 \ end=">>"
2009 \ contained
2010 \ contains=p6PodFormatAngleTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon
2011
2012syn region p6PodFormatThree
2013 \ matchgroup=p6PodFormatCode
2014 \ start="D<<<"
2015 \ skip="<<<[^>]*>>>"
2016 \ end=">>>"
2017 \ contained
2018 \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon
2019
2020syn region p6PodFormatFrench
2021 \ matchgroup=p6PodFormatCode
2022 \ start="D«"
2023 \ skip="«[^»]*»"
2024 \ end="»"
2025 \ contained
2026 \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon
2027
2028" X<> can have "|", "," and ";" separators
2029
2030syn region p6PodFormatOne
2031 \ matchgroup=p6PodFormatCode
2032 \ start="X<"
2033 \ skip="<[^>]*>"
2034 \ end=">"
2035 \ contained
2036 \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2037
2038syn region p6PodFormatTwo
2039 \ matchgroup=p6PodFormatCode
2040 \ start="X<<"
2041 \ skip="<<[^>]*>>"
2042 \ end=">>"
2043 \ contained
2044 \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2045
2046syn region p6PodFormatThree
2047 \ matchgroup=p6PodFormatCode
2048 \ start="X<<<"
2049 \ skip="<<<[^>]*>>>"
2050 \ end=">>>"
2051 \ contained
2052 \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2053
2054syn region p6PodFormatFrench
2055 \ matchgroup=p6PodFormatCode
2056 \ start="X«"
2057 \ skip="«[^»]*»"
2058 \ end="»"
2059 \ contained
2060 \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma
2061
2062" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02002063" Only when an item doesn't have highlighting yet
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002064
Bram Moolenaarf37506f2016-08-31 22:22:10 +02002065hi def link p6EscOctOld p6Error
2066hi def link p6PackageTwigil p6Twigil
2067hi def link p6StringAngle p6String
2068hi def link p6StringFrench p6String
2069hi def link p6StringAngles p6String
2070hi def link p6StringSQ p6String
2071hi def link p6StringDQ p6String
2072hi def link p6StringQ p6String
2073hi def link p6RxStringSQ p6String
2074hi def link p6RxStringDQ p6String
2075hi def link p6Substitution p6String
2076hi def link p6Transliteration p6String
2077hi def link p6StringAuto p6String
2078hi def link p6StringP5Auto p6String
2079hi def link p6Key p6String
2080hi def link p6Match p6String
2081hi def link p6RegexBlock p6String
2082hi def link p6RxP5CharClass p6String
2083hi def link p6RxP5QuoteMeta p6String
2084hi def link p6RxCharClass p6String
2085hi def link p6RxQuoteWords p6String
2086hi def link p6ReduceOp p6Operator
2087hi def link p6ReverseCrossOp p6Operator
2088hi def link p6HyperOp p6Operator
2089hi def link p6QuoteQ p6Operator
2090hi def link p6RxRange p6StringSpecial
2091hi def link p6RxAnchor p6StringSpecial
2092hi def link p6RxP5Anchor p6StringSpecial
2093hi def link p6CodePoint p6StringSpecial
2094hi def link p6RxMeta p6StringSpecial
2095hi def link p6RxP5Range p6StringSpecial
2096hi def link p6RxP5CPId p6StringSpecial
2097hi def link p6RxP5Posix p6StringSpecial
2098hi def link p6RxP5Mod p6StringSpecial
2099hi def link p6RxP5HexSeq p6StringSpecial
2100hi def link p6RxP5OctSeq p6StringSpecial
2101hi def link p6RxP5WriteRefId p6StringSpecial
2102hi def link p6HexSequence p6StringSpecial
2103hi def link p6OctSequence p6StringSpecial
2104hi def link p6RxP5Named p6StringSpecial
2105hi def link p6RxP5PropId p6StringSpecial
2106hi def link p6RxP5Quantifier p6StringSpecial
2107hi def link p6RxP5CountId p6StringSpecial
2108hi def link p6RxP5Verb p6StringSpecial
2109hi def link p6Escape p6StringSpecial2
2110hi def link p6EscNull p6StringSpecial2
2111hi def link p6EscHash p6StringSpecial2
2112hi def link p6EscQQ p6StringSpecial2
2113hi def link p6EscQuote p6StringSpecial2
2114hi def link p6EscDoubleQuote p6StringSpecial2
2115hi def link p6EscBackTick p6StringSpecial2
2116hi def link p6EscForwardSlash p6StringSpecial2
2117hi def link p6EscVerticalBar p6StringSpecial2
2118hi def link p6EscExclamation p6StringSpecial2
2119hi def link p6EscDollar p6StringSpecial2
2120hi def link p6EscOpenCurly p6StringSpecial2
2121hi def link p6EscCloseCurly p6StringSpecial2
2122hi def link p6EscCloseBracket p6StringSpecial2
2123hi def link p6EscCloseAngle p6StringSpecial2
2124hi def link p6EscCloseFrench p6StringSpecial2
2125hi def link p6EscBackSlash p6StringSpecial2
2126hi def link p6RxEscape p6StringSpecial2
2127hi def link p6RxCapture p6StringSpecial2
2128hi def link p6RxAlternation p6StringSpecial2
2129hi def link p6RxP5 p6StringSpecial2
2130hi def link p6RxP5ReadRef p6StringSpecial2
2131hi def link p6RxP5Oct p6StringSpecial2
2132hi def link p6RxP5Hex p6StringSpecial2
2133hi def link p6RxP5EscMeta p6StringSpecial2
2134hi def link p6RxP5Meta p6StringSpecial2
2135hi def link p6RxP5Escape p6StringSpecial2
2136hi def link p6RxP5CodePoint p6StringSpecial2
2137hi def link p6RxP5WriteRef p6StringSpecial2
2138hi def link p6RxP5Prop p6StringSpecial2
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002139
Bram Moolenaarf37506f2016-08-31 22:22:10 +02002140hi def link p6Property Tag
2141hi def link p6Attention Todo
2142hi def link p6Type Type
2143hi def link p6Error Error
2144hi def link p6BlockLabel Label
2145hi def link p6Float Float
2146hi def link p6Normal Normal
2147hi def link p6Package Normal
2148hi def link p6PackageScope Normal
2149hi def link p6Number Number
2150hi def link p6VersionNum Number
2151hi def link p6String String
2152hi def link p6Repeat Repeat
2153hi def link p6Keyword Keyword
2154hi def link p6Pragma Keyword
2155hi def link p6Module Keyword
2156hi def link p6DeclareRoutine Keyword
2157hi def link p6VarStorage Special
2158hi def link p6FlowControl Special
2159hi def link p6NumberBase Special
2160hi def link p6Twigil Special
2161hi def link p6StringSpecial2 Special
2162hi def link p6VersionDot Special
2163hi def link p6Comment Comment
2164hi def link p6Include Include
2165hi def link p6Shebang PreProc
2166hi def link p6ClosureTrait PreProc
2167hi def link p6Routine Function
2168hi def link p6Operator Operator
2169hi def link p6Version Operator
2170hi def link p6Context Operator
2171hi def link p6Quote Delimiter
2172hi def link p6TypeConstraint PreCondit
2173hi def link p6Exception Exception
2174hi def link p6Placeholder Identifier
2175hi def link p6Variable Identifier
2176hi def link p6VarSlash Identifier
2177hi def link p6VarNum Identifier
2178hi def link p6VarExclam Identifier
2179hi def link p6VarMatch Identifier
2180hi def link p6VarName Identifier
2181hi def link p6MatchVar Identifier
2182hi def link p6RxP5ReadRefId Identifier
2183hi def link p6RxP5ModDef Identifier
2184hi def link p6RxP5ModName Identifier
2185hi def link p6Conditional Conditional
2186hi def link p6StringSpecial SpecialChar
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002187
Bram Moolenaarf37506f2016-08-31 22:22:10 +02002188hi def link p6PodAbbr p6Pod
2189hi def link p6PodAbbrEOF p6Pod
2190hi def link p6PodAbbrNoCode p6Pod
2191hi def link p6PodAbbrCode p6PodCode
2192hi def link p6PodPara p6Pod
2193hi def link p6PodParaEOF p6Pod
2194hi def link p6PodParaNoCode p6Pod
2195hi def link p6PodParaCode p6PodCode
2196hi def link p6PodDelim p6Pod
2197hi def link p6PodDelimEOF p6Pod
2198hi def link p6PodDelimNoCode p6Pod
2199hi def link p6PodDelimCode p6PodCode
2200hi def link p6PodImplicitCode p6PodCode
2201hi def link p6PodExtraConfig p6PodPrefix
2202hi def link p6PodVerticalBar p6PodFormatCode
2203hi def link p6PodColon p6PodFormatCode
2204hi def link p6PodSemicolon p6PodFormatCode
2205hi def link p6PodComma p6PodFormatCode
2206hi def link p6PodFormatOne p6PodFormat
2207hi def link p6PodFormatTwo p6PodFormat
2208hi def link p6PodFormatThree p6PodFormat
2209hi def link p6PodFormatFrench p6PodFormat
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002210
Bram Moolenaarf37506f2016-08-31 22:22:10 +02002211hi def link p6PodType Type
2212hi def link p6PodConfigOption String
2213hi def link p6PodCode PreProc
2214hi def link p6Pod Comment
2215hi def link p6PodComment Comment
2216hi def link p6PodAutoQuote Operator
2217hi def link p6PodConfigOperator Operator
2218hi def link p6PodPrefix Statement
2219hi def link p6PodName Identifier
2220hi def link p6PodFormatCode SpecialChar
2221hi def link p6PodFormat SpecialComment
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002222
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002223
2224" Syncing to speed up processing
2225"syn sync match p6SyncPod groupthere p6PodAbbrRegion "^=\K\k*\>"
2226"syn sync match p6SyncPod groupthere p6PodDirectRegion "^=\%(config\|use\|encoding\)\>"
2227"syn sync match p6SyncPod groupthere p6PodParaRegion "^=for\>"
2228"syn sync match p6SyncPod groupthere p6PodDelimRegion "^=begin\>"
2229"syn sync match p6SyncPod groupthere p6PodDelimEndRegion "^=end\>"
2230
2231" Let's just sync whole file, the other methods aren't reliable (or I don't
2232" know how to use them reliably)
2233syn sync fromstart
2234
2235setlocal foldmethod=syntax
2236
2237let b:current_syntax = "perl6"
2238
Bram Moolenaar9a7224b2012-04-30 15:56:52 +02002239let &cpo = s:keepcpo
2240unlet s:keepcpo
2241
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002242" vim:ts=8:sts=4:sw=4:expandtab:ft=vim