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