/
perl6.vim.pre
1963 lines (1740 loc) · 66 KB
/
perl6.vim.pre
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
" Vim syntax file
" Language: Perl 6
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: http://github.com/vim-perl/vim-perl/tree/master
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: {{LAST_CHANGE}}
" Contributors: Luke Palmer <fibonaci@babylonia.flatirons.org>
" Moritz Lenz <moritz@faui2k3.org>
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" This is a big undertaking. Perl 6 is the sort of language that only Perl
" can parse. But I'll do my best to get vim to.
"
" The ftdetect/perl11.vim file in this repository takes care of setting the
" right filetype for Perl 6 files. To set it explicitly you can also add this
" line near the bottom of your source file:
" # vim: filetype=perl6
" TODO:
" * Go over the list of keywords/types to see what's deprecated/missing
" * Add more support for folding (:help syn-fold)
"
" If you want to have Pir code inside Q:PIR// strings highlighted, do:
" let perl6_embedded_pir=1
"
" The above requires pir.vim, which you can find in Parrot's repository:
" https://github.com/parrot/parrot/tree/master/editor
"
" To highlight Perl 5 regexes (m:P5//):
" let perl6_perl5_regexes=1
"
" To enable folding:
" let perl6_fold=1
if version < 704 | throw "perl6.vim uses regex syntax which Vim <7.4 doesn't support. Try 'make fix_old_vim' in the vim-perl repository." | endif
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let s:keepcpo= &cpo
set cpo&vim
" Patterns which will be interpolated by the preprocessor (tools/preproc.pl):
"
" @@IDENT_NONDIGIT@@ "[A-Za-z_\xC0-\xFF]"
" @@IDENT_CHAR@@ "[A-Za-z_\xC0-\xFF0-9]"
" @@IDENTIFIER@@ "\%(@@IDENT_NONDIGIT@@\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\@=\)*\)"
" @@IDENTIFIER_START@@ "@@IDENT_CHAR@@\@1<!\%(@@IDENT_NONDIGIT@@[-']\)\@2<!"
" @@IDENTIFIER_END@@ "\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\)\@!"
" @@METAOP@@ #\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+#
" @@ADVERBS@@ "\%(\_s*:!\?@@IDENTIFIER@@\%(([^)]*)\)\?\)*"
"
" Same but escaped, for use in string eval
" @@IDENT_NONDIGIT_Q@@ "[A-Za-z_\\xC0-\\xFF]"
" @@IDENT_CHAR_Q@@ "[A-Za-z_\\xC0-\\xFF0-9]"
" @@IDENTIFIER_Q@@ "\\%(@@IDENT_NONDIGIT_Q@@\\%(@@IDENT_CHAR_Q@@\\|[-']@@IDENT_NONDIGIT_Q@@\\@=\\)*\\)"
" @@IDENTIFIER_START_Q@@ "@@IDENT_CHAR_Q@@\\@1<!\\%(@@IDENT_NONDIGIT_Q@@[-']\\)\\@2<!"
" @@IDENTIFIER_END_Q@@ "\\%(@@IDENT_CHAR_Q@@\\|[-']@@IDENT_NONDIGIT_Q@@\\)\\@!"
" Identifiers (subroutines, methods, constants, classes, roles, etc)
syn match p6Identifier display "@@IDENTIFIER@@"
let s:keywords = {
\ "p6Include": [
\ "use require unit",
\ ],
\ "p6Conditional": [
\ "if else elsif unless with orwith without",
\ ],
\ "p6VarStorage": [
\ "let my our state temp has constant",
\ ],
\ "p6Repeat": [
\ "for loop repeat while until gather given",
\ ],
\ "p6FlowControl": [
\ "take do when next last redo return return-rw contend maybe defer",
\ "start default exit make continue break goto leave async lift",
\ ],
\ "p6ClosureTrait": [
\ "BEGIN CHECK INIT START FIRST ENTER LEAVE KEEP",
\ "UNDO NEXT LAST PRE POST END CATCH CONTROL TEMP",
\ ],
\ "p6Exception": [
\ "die fail try warn",
\ ],
\ "p6Pragma": [
\ "oo fatal",
\ ],
\ "p6Operator": [
\ "div xx x mod also leg cmp before after eq ne le lt not",
\ "gt ge eqv ff fff and andthen or xor orelse extra lcm gcd o",
\ ],
\ "p6Type": [
\ "int int1 int2 int4 int8 int16 int32 int64",
\ "rat rat1 rat2 rat4 rat8 rat16 rat32 rat64",
\ "buf buf1 buf2 buf4 buf8 buf16 buf32 buf64",
\ "uint uint1 uint2 uint4 uint8 uint16 uint32 bit bool",
\ "uint64 utf8 utf16 utf32 bag set mix num complex",
\ ],
\ }
" These can be immediately followed by parentheses
let s:types = [
\ "Object Any Junction Whatever Capture Match",
\ "Signature Proxy Matcher Package Module Class",
\ "Grammar Scalar Array Hash KeyHash KeySet KeyBag",
\ "Pair List Seq Range Set Bag Map Mapping Void Undef",
\ "Failure Exception Code Block Routine Sub Macro",
\ "Method Submethod Regex Str Blob Char Byte Parcel",
\ "Codepoint Grapheme StrPos StrLen Version Num",
\ "Complex Bit True False Order Same Less More",
\ "Increasing Decreasing Ordered Callable AnyChar",
\ "Positional Associative Ordering KeyExtractor",
\ "Comparator OrderingPair IO KitchenSink Role",
\ "Int Rat Buf UInt Abstraction Numeric Real",
\ "Nil Mu",
\ ]
" We explicitly enumerate the alphanumeric infix operators allowed after [RSXZ]
" to avoid matching package names that start with those letters.
let s:alpha_metaops = [
\ "div mod gcd lcm xx x does but cmp leg eq ne gt ge lt le before after eqv",
\ "min max not so andthen and or orelse",
\ ]
let s:words_space = join(s:alpha_metaops, " ")
let s:temp = split(s:words_space)
let s:alpha_metaops_or = join(s:temp, "\\|")
" We don't use "syn keyword" here because that always has higher priority
" than matches/regions, which would prevent these words from matching as
" autoquoted strings before "=>" or "p5=>".
syn match p6KeywordStart display "\%(@@IDENTIFIER@@@@IDENTIFIER_END@@\)\@=@@IDENTIFIER_START@@"
\ nextgroup=p6Attention,p6Variable,p6Include,p6Conditional,p6VarStorage,p6Repeat,p6FlowControl,p6ClosureTrait,p6Exception,p6Number,p6Pragma,p6Type,p6Operator,p6Identifier
for [group, words] in items(s:keywords)
let s:words_space = join(words, " ")
let s:temp = split(s:words_space)
let s:words = join(s:temp, "\\|")
exec "syn match ". group ." display \"[.^]\\@1<!\\%(". s:words . "\\)(\\@!@@IDENTIFIER_END_Q@@\" contained"
endfor
let s:words_space = join(s:types, " ")
let s:temp = split(s:words_space)
let s:words = join(s:temp, "\\|")
exec "syn match p6Type display \"\\%(". s:words . "\\)@@IDENTIFIER_END_Q@@\" contained"
unlet s:keywords s:types s:words_space s:temp s:words
syn match p6PreDeclare display "[.^]\@1<!\<\%(multi\|proto\|only\)\>" nextgroup=p6Declare,p6Identifier skipwhite skipempty
syn match p6Declare display "[.^]\@1<!\<\%(macro\|sub\|submethod\|method\|category\|module\|class\|role\|package\|enum\|grammar\|slang\|subset\)\>" nextgroup=p6Identifier skipwhite skipempty
syn match p6DeclareRegex display "[.^]\@1<!\<\%(regex\|rule\|token\)\>" nextgroup=p6RegexName skipwhite skipempty
syn match p6TypeConstraint display "\%([.^]\|^\s*\)\@<!\a\@=\%(does\|as\|but\|trusts\|of\|returns\|handles\|where\|augment\|supersede\)\>"
syn match p6TypeConstraint display "\%([.^]\|^\s*\)\@<!@@IDENTIFIER_START@@is@@IDENTIFIER_END@@" skipwhite skipempty nextgroup=p6Property
syn match p6Property display "\a\@=\%(signature\|context\|also\|shape\|prec\|irs\|ofs\|ors\|export\|deep\|binary\|unary\|reparsed\|rw\|parsed\|cached\|readonly\|defequiv\|will\|ref\|copy\|inline\|tighter\|looser\|equiv\|assoc\|required\)" contained
" packages, must come after all the keywords
syn match p6Identifier display "\%(::\)\@2<=@@IDENTIFIER@@*"
syn match p6Identifier display "@@IDENTIFIER@@\%(::\)\@="
" The sigil in ::*Package
syn match p6PackageTwigil display "\%(::\)\@2<=\*"
" some standard packages
syn match p6Type display "\%(::\)\@2<!\%(Order\%(::Same\|::More\|::Less\)\?\|Bool\%(::True\|::False\)\?\)@@IDENTIFIER_END@@"
" Don't put a "\+" at the end of the character class. That makes it so
" greedy that the "%" " in "+%foo" won't be allowed to match as a sigil,
" among other things
syn match p6Operator display "[-+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅∘]"
syn match p6Operator display "\%(:\@1<!::\@2!\|::=\|\.::\)"
" these require whitespace on the left side
syn match p6Operator display "\%(\s\|^\)\@1<=\%(xx=\|p5=>\)"
" index overloading
syn match p6Operator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)"
" Reduce metaoperators like [+]
syn match p6ReduceOp display "\%(^\|\s\|(\)\@1<=!*\%([RSXZ\[]\)*[&RSXZ]\?\[\+(\?@@METAOP@@)\?]\+"
syn match p6SetOp display "R\?(\%([-^.+|&]\|[<>][=+]\?\|cont\|elem\))"
" Reverse, cross, and zip metaoperators
exec "syn match p6RSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:alnum:][:space:]]\\)\\+\\|\\s\\@=\\|$\\)\""
syn match p6BlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@="
syn match p6Number display "@@IDENT_CHAR@@\@1<!\%(\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?Inf\|NaN\)"
syn match p6Number display "@@IDENT_CHAR@@\@1<!\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?\%(\%(\d\|__\@!\)*[._]\@1<!\.\)\?_\@!\%(\d\|_\)\+_\@1<!\%([eE]-\?_\@!\%(\d\|_\)\+\)\?i\?"
syn match p6Number display "@@IDENT_CHAR@@\@1<!\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?0[obxd]\@=" nextgroup=p6OctBase,p6BinBase,p6HexBase,p6DecBase
syn match p6OctBase display "o" contained nextgroup=p6OctNumber
syn match p6BinBase display "b" contained nextgroup=p6BinNumber
syn match p6HexBase display "x" contained nextgroup=p6HexNumber
syn match p6DecBase display "d" contained nextgroup=p6DecNumber
syn match p6OctNumber display "[0-7][0-7_]*" contained
syn match p6BinNumber display "[01][01_]*" contained
syn match p6HexNumber display "\x[[:xdigit:]_]*" contained
syn match p6DecNumber display "\d[[:digit:]_]*" contained
syn match p6Version display "\<v\d\+\%(\.\%(\*\|\d\+\)\)*+\?"
" Contextualizers
syn match p6Context display "\<\%(item\|list\|slice\|hash\)\>"
syn match p6Context display "\%(\$\|@\|%\|&\)(\@="
" Quoting
" one cluster for every quote adverb
syn cluster p6Interp_scalar
\ add=p6InterpScalar
syn cluster p6Interp_array
\ add=p6InterpArray
syn cluster p6Interp_hash
\ add=p6InterpHash
syn cluster p6Interp_function
\ add=p6InterpFunction
syn cluster p6Interp_closure
\ add=p6InterpClosure
syn cluster p6Interp_q
\ add=p6EscQQ
\ add=p6EscBackSlash
syn cluster p6Interp_backslash
\ add=@p6Interp_q
\ add=p6Escape
\ add=p6EscOpenCurly
\ add=p6EscCodePoint
\ add=p6EscHex
\ add=p6EscOct
\ add=p6EscOctOld
\ add=p6EscNull
syn cluster p6Interp_qq
\ add=@p6Interp_scalar
\ add=@p6Interp_array
\ add=@p6Interp_hash
\ add=@p6Interp_function
\ add=@p6Interp_closure
\ add=@p6Interp_backslash
\ add=p6MatchVarSigil
syn region p6InterpScalar
\ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\@=\)\?@@IDENTIFIER@@\)\%(\.\^\?@@IDENTIFIER@@\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
\ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\@=\)\?@@IDENTIFIER@@\)\|\%(\d\+\|!\|/\|¢\)\)\)"
\ end="\z1\zs"
\ contained keepend
\ contains=TOP
syn region p6InterpScalar
\ matchgroup=p6Context
\ start="\$\ze()\@!"
\ skip="([^)]*)"
\ end=")\zs"
\ contained
\ contains=TOP
syn region p6InterpArray
\ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\@=\)\?@@IDENTIFIER@@\)\%(\.\^\?@@IDENTIFIER@@\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
\ end="\z1\zs"
\ contained keepend
\ contains=TOP
syn region p6InterpArray
\ matchgroup=p6Context
\ start="@\ze()\@!"
\ skip="([^)]*)"
\ end=")\zs"
\ contained
\ contains=TOP
syn region p6InterpHash
\ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\@=\)\?@@IDENTIFIER@@\)\%(\.\^\?@@IDENTIFIER@@\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
\ end="\z1\zs"
\ contained keepend
\ contains=TOP
syn region p6InterpHash
\ matchgroup=p6Context
\ start="%\ze()\@!"
\ skip="([^)]*)"
\ end=")\zs"
\ contained
\ contains=TOP
syn region p6InterpFunction
\ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\@=\)\?@@IDENTIFIER@@\%(\.\^\?@@IDENTIFIER@@\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
\ end="\z1\zs"
\ contained keepend
\ contains=TOP
syn region p6InterpFunction
\ matchgroup=p6Context
\ start="&\ze()\@!"
\ skip="([^)]*)"
\ end=")\zs"
\ contained
\ contains=TOP
syn region p6InterpClosure
\ start="\\\@1<!{}\@!"
\ skip="{[^}]*}"
\ end="}"
\ contained keepend
\ contains=TOP
" generic escape
syn match p6Escape display "\\\S" contained
" escaped closing delimiters
syn match p6EscQuote display "\\'" contained
syn match p6EscDoubleQuote display "\\\"" contained
syn match p6EscCloseAngle display "\\>" contained
syn match p6EscCloseFrench display "\\»" contained
syn match p6EscBackTick display "\\`" contained
syn match p6EscForwardSlash display "\\/" contained
syn match p6EscVerticalBar display "\\|" contained
syn match p6EscExclamation display "\\!" contained
syn match p6EscComma display "\\," contained
syn match p6EscDollar display "\\\$" contained
syn match p6EscCloseCurly display "\\}" contained
syn match p6EscCloseBracket display "\\\]" contained
" matches :key, :!key, :$var, :key<var>, etc
" Since we don't know in advance how the adverb ends, we use a trick.
" Consume nothing with the start pattern (\ze at the beginning),
" while capturing the whole adverb into \z1 and then putting it before
" the match start (\zs) of the end pattern.
syn region p6Adverb
\ start="\ze\z(:!\?@@IDENTIFIER@@\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)"
\ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@1<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\)\|@@IDENTIFIER@@\)\)"
\ end="\z1\zs"
\ contained keepend
\ contains=TOP
" <words>
" Distinguishing this from the "less than" operator is tricky. For now,
" it matches if any of the following is true:
"
" * There is whitespace missing on either side of the "<", since
" people tend to put spaces around "less than". We make an exception
" for " = < ... >" assignments though.
" * It comes after "enum", "for", "any", "all", or "none"
" * It's the first or last thing on a line (ignoring whitespace)
" * It's preceded by "(\s*" or "=\s\+"
" * It's empty and terminated on the same line (e.g. <> and < >)
"
" It never matches when:
"
" * Preceded by [<+~=!] (e.g. <<foo>>, =<$foo>, * !< 3)
" * Followed by [-=] (e.g. <--, <=, <==, <->)
syn region p6StringAngle
\ matchgroup=p6Quote
\ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
\ start="\%(\s\|[<+~=!]\)\@<!<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
\ start="[<+~=!]\@1<!<\%(\s\|<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
\ start="\%(^\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
\ start="[<+~=!]\@1<!<\%(\s*$\)\@="
\ start="\%((\s*\|=\s\+\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
\ start="<\%(\s*>\)\@="
\ skip="\\\@1<!\\>"
\ end=">"
\ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle
syn region p6StringAngleFixed
\ matchgroup=p6Quote
\ start="<"
\ skip="\\\@1<!\\>"
\ end=">"
\ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle
\ contained
syn region p6InnerAnglesOne
\ matchgroup=p6StringAngle
\ start="\\\@1<!<"
\ skip="\\\@1<!\\>"
\ end=">"
\ transparent contained
\ contains=p6InnerAnglesOne
" <<words>>
syn region p6StringAngles
\ matchgroup=p6Quote
\ start="<<=\@!"
\ skip="\\\@1<!\\>"
\ end=">>"
\ contains=p6InnerAnglesTwo,@p6Interp_qq,p6Comment,p6BracketComment,p6EscHash,p6EscCloseAngle,p6Adverb,p6StringSQ,p6StringDQ
syn region p6InnerAnglesTwo
\ matchgroup=p6StringAngles
\ start="<<"
\ skip="\\\@1<!\\>"
\ end=">>"
\ transparent contained
\ contains=p6InnerAnglesTwo
" «words»
syn region p6StringFrench
\ matchgroup=p6Quote
\ start="«"
\ skip="\\\@1<!\\»"
\ end="»"
\ contains=p6InnerFrench,@p6Interp_qq,p6Comment,p6BracketComment,p6EscHash,p6EscCloseFrench,p6Adverb,p6StringSQ,p6StringDQ
syn region p6InnerFrench
\ matchgroup=p6StringFrench
\ start="\\\@1<!«"
\ skip="\\\@1<!\\»"
\ end="»"
\ transparent contained
\ contains=p6InnerFrench
" Hyperops. They need to come after "<>" and "«»" strings in order to override
" them, but before other types of strings, to avoid matching those delimiters
" as parts of hyperops.
syn match p6HyperOp display #[^[:digit:][{('",:[:space:]][^[{('",:[:space:]]*\%(«\|<<\)#
syn match p6HyperOp display "«@@METAOP@@[«»]"
syn match p6HyperOp display "»@@METAOP@@\%(«\|»\?\)"
syn match p6HyperOp display "<<@@METAOP@@\%(<<\|>>\)"
syn match p6HyperOp display ">>@@METAOP@@\%(<<\|\%(>>\)\?\)"
" 'string'
syn region p6StringSQ
\ matchgroup=p6Quote
\ start="'"
\ skip="\\\@1<!\\'"
\ end="'"
\ contains=@p6Interp_q,p6EscQuote
\ keepend extend
" "string"
syn region p6StringDQ
\ matchgroup=p6Quote
\ start=+"+
\ skip=+\\\@1<!\\"+
\ end=+"+
\ contains=@p6Interp_qq,p6EscDoubleQuote
\ keepend extend
" Q// and friends
syn match p6QuoteQStart display "\%(:\|\%(sub\|role\)\s\)\@5<![Qq]\@=" nextgroup=p6QuoteQ,p6QuoteQ_q,p6QuoteQ_qww,p6QuoteQ_qq,p6QuoteQ_to,p6QuoteQ_qto,p6QuoteQ_qqto,p6Identifier
syn match p6QuoteQ display "Q\%(qq\|ww\|[abcfhpsqvwx]\)\?[A-Za-z(]\@!" nextgroup=p6PairsQ skipwhite skipempty contained
syn match p6QuoteQ_q display "q[abcfhpsvwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_q skipwhite skipempty contained
syn match p6QuoteQ_qww display "qww[A-Za-z(]\@!" nextgroup=p6PairsQ_qww skipwhite skipempty contained
syn match p6QuoteQ_qq display "qq[pwx]\?[A-Za-z(]\@!" nextgroup=p6PairsQ_qq skipwhite skipempty contained
syn match p6QuoteQ_to display "Qto[A-Za-z(]\@!" nextgroup=p6StringQ_to skipwhite skipempty contained
syn match p6QuoteQ_qto display "qto[A-Za-z(]\@!" nextgroup=p6StringQ_qto skipwhite skipempty contained
syn match p6QuoteQ_qqto display "qqto[A-Za-z(]\@!" nextgroup=p6StringQ_qqto skipwhite skipempty contained
syn match p6QuoteQ_qto display "q\_s*\%(@@ADVERBS@@:\%(to\|heredoc\)@@ADVERBS@@(\@!\)\@=" nextgroup=p6PairsQ_qto skipwhite skipempty contained
syn match p6QuoteQ_qqto display "qq\_s*\%(@@ADVERBS@@:\%(to\|heredoc\)@@ADVERBS@@(\@!\)\@=" nextgroup=p6PairsQ_qqto skipwhite skipempty contained
syn match p6PairsQ "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6StringQ
syn match p6PairsQ_q "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6StringQ_q
syn match p6PairsQ_qww "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6StringQ_qww
syn match p6PairsQ_qq "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6StringQ_qq
syn match p6PairsQ_qto "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6StringQ_qto
syn match p6PairsQ_qqto "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6StringQ_qqto
if exists("perl6_embedded_pir") || exists("perl6_extended_all")
syn include @p6PIR syntax/pir.vim
syn match p6Quote_QPIR display "Q[A-Za-z(]\@!\%(\_s*:PIR\)\@=" nextgroup=p6PairsQ_PIR skipwhite skipempty
syn match p6Pairs_QPIR contained "\_s*:PIR" transparent skipwhite skipempty nextgroup=p6StringQ_PIR
endif
" hardcoded set of delimiters
let s:plain_delims = [
\ ["DQ", "\\\"", "\\\"", "p6EscDoubleQuote", "\\\\\\@1<!\\\\\\\""],
\ ["SQ", "'", "'", "p6EscQuote", "\\\\\\@1<!\\\\'"],
\ ["Slash", "/", "/", "p6EscForwardSlash", "\\\\\\@1<!\\\\/"],
\ ["BackTick", "`", "`", "p6EscBackTick", "\\\\\\@1<!\\\\`"],
\ ["Bar", "|", "|", "p6EscVerticalBar", "\\\\\\@1<!\\\\|"],
\ ["Exclamation", "!", "!", "p6EscExclamation", "\\\\\\@1<!\\\\!"],
\ ["Comma", ",", ",", "p6EscComma", "\\\\\\@1<!\\\\,"],
\ ["Dollar", "\\$", "\\$", "p6EscDollar", "\\\\\\@1<!\\\\\\$"],
\ ]
let s:bracketing_delims = [
\ ["Curly", "{", "}", "p6EscCloseCurly", "\\%(\\\\\\@1<!\\\\}\\|{[^}]*}\\)"],
\ ["Angle", "<", ">", "p6EscCloseAngle", "\\%(\\\\\\@1<!\\\\>\\|<[^>]*>\\)"],
\ ["French", "«", "»", "p6EscCloseFrench", "\\%(\\\\\\@1<!\\\\»\\|«[^»]*»\\)"],
\ ["Bracket", "\\\[", "]", "p6EscCloseBracket", "\\%(\\\\\\@1<!\\\\]\\|\\[^\\]]*]\\)"],
\ ["Paren", "\\s\\@1<=(", ")", "p6EscCloseParen", "\\%(\\\\\\@1<!\\\\)\\|([^)]*)\\)"],
\ ]
let s:all_delims = s:plain_delims + s:bracketing_delims
for [name, start_delim, end_delim, end_group, skip] in s:all_delims
exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" end=\"".end_delim."\" contained"
exec "syn region p6StringQ_q matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,".end_group." contained"
exec "syn region p6StringQ_qww matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_q,p6StringSQ,p6StringDQ".end_group." contained"
exec "syn region p6StringQ_qq matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6Interp_qq,".end_group." contained"
exec "syn region p6StringQ_to matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" end=\"^\\s*\\z1$\" contained"
exec "syn region p6StringQ_qto matchgroup=p6Quote start=\"".start_delim."\\z([^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_q,".end_group." contained"
exec "syn region p6StringQ_qqto matchgroup=p6Quote start=\"".start_delim."\\z(\[^".end_delim."]\\+\\)".end_delim."\" skip=\"".skip."\" end=\"^\\s*\\z1$\" contains=@p6Interp_qq,".end_group." contained"
if exists("perl6_embedded_pir") || exists("perl6_extended_all")
exec "syn region p6StringQ_PIR matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6PIR,".end_group." contained"
endif
endfor
unlet s:plain_delims s:all_delims
" :key
syn match p6Operator display ":\@1<!::\@!!\?" nextgroup=p6Key,p6StringAngleFixed,p6StringAngles,p6StringFrench
syn match p6Key display "@@IDENTIFIER@@" contained nextgroup=p6StringAngleFixed,p6StringAngles,p6StringFrench
" Regexes and grammars
syn match p6RegexName display "@@IDENTIFIER@@\?" nextgroup=p6RegexBlockCrap skipwhite skipempty contained
syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained
syn region p6RegexBlock
\ matchgroup=p6Normal
\ start="{"
\ end="}"
\ contained
\ contains=@p6Regexen,@p6Variables
" Perl 6 regex bits
syn cluster p6Regexen
\ add=p6RxMeta
\ add=p6RxEscape
\ add=p6EscCodePoint
\ add=p6EscHex
\ add=p6EscOct
\ add=p6EscNull
\ add=p6RxAnchor
\ add=p6RxCapture
\ add=p6RxGroup
\ add=p6RxAlternation
\ add=p6RxBoundary
\ add=p6RxAdverb
\ add=p6RxAdverbArg
\ add=p6RxStorage
\ add=p6RxAssertion
\ add=p6RxAssertGroup
\ add=p6RxQuoteWords
\ add=p6RxClosure
\ add=p6RxStringSQ
\ add=p6RxStringDQ
\ add=p6Comment
\ add=p6BracketComment
\ add=p6MatchVarSigil
syn match p6RxMeta display contained ".\%(@@IDENT_CHAR@@\|\s\)\@1<!"
syn match p6RxAnchor display contained "[$^]"
syn match p6RxEscape display contained "\\\S"
syn match p6RxCapture display contained "[()]"
syn match p6RxAlternation display contained "|"
syn match p6RxRange display contained "\.\."
" misc escapes
syn match p6EscOctOld display "\\[1-9]\d\{1,2}" contained
syn match p6EscNull display "\\0\d\@!" contained
syn match p6EscCodePoint display "\\[cC]" contained nextgroup=p6CodePoint
syn match p6EscHex display "\\[xX]" contained nextgroup=p6HexSequence
syn match p6EscOct display "\\o" contained nextgroup=p6OctSequence
syn match p6EscQQ display "\\qq" contained nextgroup=p6QQSequence
syn match p6EscOpenCurly display "\\{" contained
syn match p6EscHash display "\\#" contained
syn match p6EscBackSlash display "\\\\" contained
syn region p6QQSequence
\ matchgroup=p6Escape
\ start="\["
\ skip="\[[^\]]*]"
\ end="]"
\ contained transparent
\ contains=@p6Interp_qq
syn match p6CodePoint display "\%(\d\+\|\S\)" contained
syn region p6CodePoint
\ matchgroup=p6Escape
\ start="\["
\ end="]"
\ contained
syn match p6HexSequence display "\x\+" contained
syn region p6HexSequence
\ matchgroup=p6Escape
\ start="\["
\ end="]"
\ contained
syn match p6OctSequence display "\o\+" contained
syn region p6OctSequence
\ matchgroup=p6Escape
\ start="\["
\ end="]"
\ contained
" $<match>, @<match>
syn region p6MatchVarSigil
\ matchgroup=p6Variable
\ start="[$@]\%(<<\@!\)\@="
\ end=">\@1<="
\ contains=p6MatchVar
syn region p6MatchVar
\ matchgroup=p6Twigil
\ start="<"
\ end=">"
\ contained
syn region p6RxClosure
\ matchgroup=p6Normal
\ start="{"
\ end="}"
\ contained
\ containedin=p6RxClosure
\ contains=TOP
syn region p6RxGroup
\ matchgroup=p6StringSpecial2
\ start="\["
\ end="]"
\ contained
\ contains=@p6Regexen,@p6Variables,p6MatchVarSigil
syn region p6RxAssertion
\ matchgroup=p6StringSpecial2
\ start="<\%(?\?\%(before\|after\)\|\%(@@IDENTIFIER@@=\)\|[+?*]\)\?"
\ end=">"
\ contained
\ contains=@p6Regexen,p6Identifier,@p6Variables,p6RxCharClass,p6RxAssertCall
syn region p6RxAssertGroup
\ matchgroup=p6StringSpecial2
\ start="<@@IDENTIFIER@@=\["
\ skip="\\\@1<!\\]"
\ end="]"
\ contained
syn match p6RxAssertCall display "\%(::\|@@IDENTIFIER@@\)" contained nextgroup=p6RxAssertArgs
syn region p6RxAssertArgs
\ start="("
\ end=")"
\ contained keepend
\ contains=TOP
syn region p6RxAssertArgs
\ start=":"
\ end="\ze>"
\ contained keepend
\ contains=TOP
syn match p6RxBoundary display contained "\%([«»]\|<<\|>>\)"
syn region p6RxCharClass
\ matchgroup=p6StringSpecial2
\ start="\%(<[-!+?]\?\)\@2<=\["
\ skip="\\]"
\ end="]"
\ contained
\ contains=p6RxRange,p6RxEscape,p6EscHex,p6EscOct,p6EscCodePoint,p6EscNull
syn region p6RxQuoteWords
\ matchgroup=p6StringSpecial2
\ start="<\s"
\ end="\s\?>"
\ contained
syn region p6RxAdverb
\ start="\ze\z(:!\?@@IDENTIFIER@@\)"
\ end="\z1\zs"
\ contained keepend
\ contains=TOP
syn region p6RxAdverbArg
\ start="\%(:!\?@@IDENTIFIER@@\)\@<=("
\ skip="([^)]\{-})"
\ end=")"
\ contained
\ keepend
\ contains=TOP
syn region p6RxStorage
\ matchgroup=p6Operator
\ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@="
\ end="$"
\ contains=TOP
\ contained
\ keepend
" 'string' inside a regex
syn region p6RxStringSQ
\ matchgroup=p6Quote
\ start="'"
\ skip="\\\@1<!\\'"
\ end="'"
\ contained
\ contains=p6EscQuote,p6EscBackSlash
" "string" inside a regex
syn region p6RxStringDQ
\ matchgroup=p6Quote
\ start=+"+
\ skip=+\\\@1<!\\"+
\ end=+"+
\ contained
\ contains=p6EscDoubleQuote,p6EscBackSlash,@p6Interp_qq
" $!, $var, $!var, $::var, $package::var $*::package::var, etc
" Thus must come after the matches for the "$" regex anchor, but before
" the match for the $ regex delimiter
syn cluster p6Variables
\ add=p6VarSlash
\ add=p6VarExclam
\ add=p6VarMatch
\ add=p6VarNum
\ add=p6Variable
syn match p6BareSigil display "[@$%&]\%(\s*\%([,)}=]\|where\>\)\)\@="
syn match p6VarSlash display "\$/"
syn match p6VarExclam display "\$!"
syn match p6VarMatch display "\$¢"
syn match p6VarNum display "\$\d\+"
syn match p6Variable display "self"
syn match p6Variable display "[@$%&]\?[@&$%]\$*\%(::\|\%(\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\)\|@@IDENT_NONDIGIT@@\)\@=" nextgroup=p6Twigil,p6VarName,p6PackageScope
syn match p6VarName display "@@IDENTIFIER@@" nextgroup=p6PostHyperOp contained
syn match p6Close display "[\])]" transparent nextgroup=p6PostHyperOp
syn match p6PostHyperOp display "\%(»\|>>\)" contained
syn match p6Twigil display "\%([.^*?=!~]\|:\@1<!::\@!\)@@IDENT_NONDIGIT@@\@=" nextgroup=p6PackageScope,p6VarName contained
syn match p6PackageScope display "@@IDENTIFIER@@\?::" nextgroup=p6PackageScope,p6VarName contained
" Perl 6 regex regions
syn match p6MatchStart_m display "\.\@1<!\<\%(mm\?\|rx\)@@IDENTIFIER_END@@" skipwhite skipempty nextgroup=p6MatchAdverbs_m
syn match p6MatchStart_s display "\.\@1<!\<[sS]@@IDENTIFIER_END@@" skipwhite skipempty nextgroup=p6MatchAdverbs_s
syn match p6MatchStart_tr display "\.\@1<!\<tr@@IDENTIFIER_END@@" skipwhite skipempty nextgroup=p6MatchAdverbs_tr
syn match p6MatchAdverbs_m "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6Match
syn match p6MatchAdverbs_s "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6Substitution
syn match p6MatchAdverbs_tr "@@ADVERBS@@" contained transparent skipwhite skipempty nextgroup=p6Transliteration
" /foo/
syn region p6MatchBare
\ matchgroup=p6Quote
\ start="/\@1<!\%(\%(\_^\|[!\[,=~|&/:({]\|\^\?fff\?\^\?\|=>\|\<\%(if\|unless\|while\|when\|where\|so\)\)\s*\)\@<=/[/=]\@!"
\ skip="\\/"
\ end="/"
\ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
" m/foo/, m$foo$, m!foo!, etc
syn region p6Match
\ matchgroup=p6Quote
\ start=+\z([/!$,|`"]\)+
\ skip="\\\z1"
\ end="\z1"
\ contained
\ contains=@p6Regexen,p6Variable,p6VarNum
" m<foo>, m«foo», m{foo}, etc
for [name, start_delim, end_delim, end_group, skip] in s:bracketing_delims
exec "syn region p6Match matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Regexen,@p6Variables"
endfor
" Substitutions
" s/foo//, s$foo$$, s!foo!!, etc
syn region p6Substitution
\ matchgroup=p6Quote
\ start=+\z([/!$,|`"]\)+
\ skip="\\\z1"
\ end="\z1"me=e-1
\ contained
\ contains=@p6Regexen,p6Variable,p6VarNum
\ nextgroup=p6Replacement
syn region p6Replacement
\ matchgroup=p6Quote
\ start="\z(.\)"
\ skip="\\\z1"
\ end="\z1"
\ contained
\ contains=@p6Interp_qq
" s<foo><bar>, s«foo»«bar», s{foo}{bar}, etc
for [name, start_delim, end_delim, end_group, skip] in s:bracketing_delims
exec "syn region p6Substitution matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Regexen,@p6Variables nextgroup=p6Repl".name
exec "syn region p6Repl".name." matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Interp_qq"
endfor
" Transliteration
" tr/foo/bar/, tr|foo|bar, etc
syn region p6Transliteration
\ matchgroup=p6Quote
\ start=+\z([/!$,|`"]\)+
\ skip="\\\z1"
\ end="\z1"me=e-1
\ contained
\ contains=p6RxRange
\ nextgroup=p6TransRepl
syn region p6TransRepl
\ matchgroup=p6Quote
\ start="\z(.\)"
\ skip="\\\z1"
\ end="\z1"
\ contained
\ contains=@p6Interp_qq,p6RxRange
" tr<foo><bar>, tr«foo»«bar», tr{foo}{bar}, etc
for [name, start_delim, end_delim, end_group, skip] in s:bracketing_delims
exec "syn region p6Transliteration matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=p6RxRange nextgroup=p6TransRepl".name
exec "syn region p6TransRepl".name." matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contained keepend contains=@p6Interp_qq,p6RxRange"
endfor
unlet s:bracketing_delims
if exists("perl6_perl5_regexes") || exists("perl6_extended_all")
" Perl 5 regex regions
syn cluster p6RegexP5Base
\ add=p6RxP5Escape
\ add=p6RxP5Oct
\ add=p6RxP5Hex
\ add=p6RxP5EscMeta
\ add=p6RxP5CodePoint
\ add=p6RxP5Prop
" normal regex stuff
syn cluster p6RegexP5
\ add=@p6RegexP5Base
\ add=p6RxP5Quantifier
\ add=p6RxP5Meta
\ add=p6RxP5QuoteMeta
\ add=p6RxP5ParenMod
\ add=p6RxP5Verb
\ add=p6RxP5Count
\ add=p6RxP5Named
\ add=p6RxP5ReadRef
\ add=p6RxP5WriteRef
\ add=p6RxP5CharClass
\ add=p6RxP5Anchor
" inside character classes
syn cluster p6RegexP5Class
\ add=@p6RegexP5Base
\ add=p6RxP5Posix
\ add=p6RxP5Range
syn match p6RxP5Escape display contained "\\\S"
syn match p6RxP5CodePoint display contained "\\c\S\@=" nextgroup=p6RxP5CPId
syn match p6RxP5CPId display contained "\S"
syn match p6RxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=p6RxP5OctSeq
syn match p6RxP5OctSeq display contained "\o\{1,3}"
syn match p6RxP5Anchor display contained "[\^$]"
syn match p6RxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=p6RxP5HexSeq
syn match p6RxP5HexSeq display contained "\x\{1,2}"
syn region p6RxP5HexSeq
\ matchgroup=p6RxP5Escape
\ start="{"
\ end="}"
\ contained
syn region p6RxP5Named
\ matchgroup=p6RxP5Escape
\ start="\%(\\N\)\@2<={"
\ end="}"
\ contained
syn match p6RxP5Quantifier display contained "\%([+*]\|(\@1<!?\)"
syn match p6RxP5ReadRef display contained "\\[1-9]\d\@!"
syn match p6RxP5ReadRef display contained "\@@IDENT_CHAR@@<\@=" nextgroup=p6RxP5ReadRefId
syn region p6RxP5ReadRefId
\ matchgroup=p6RxP5Escape
\ start="<"
\ end=">"
\ contained
syn match p6RxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=p6RxP5WriteRefId
syn match p6RxP5WriteRefId display contained "\d\+"
syn region p6RxP5WriteRefId
\ matchgroup=p6RxP5Escape
\ start="{"
\ end="}"
\ contained
syn match p6RxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=p6RxP5PropId
syn match p6RxP5PropId display contained "\a"
syn region p6RxP5PropId
\ matchgroup=p6RxP5Escape
\ start="{"
\ end="}"
\ contained
syn match p6RxP5Meta display contained "[(|).]"
syn match p6RxP5ParenMod display contained "(\@1<=?\@=" nextgroup=p6RxP5Mod,p6RxP5ModName,p6RxP5Code
syn match p6RxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)"
syn match p6RxP5Mod display contained "?-\?[impsx]\+"
syn match p6RxP5Mod display contained "?\%([-+]\?\d\+\|R\)"
syn match p6RxP5Mod display contained "?(DEFINE)"
syn match p6RxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=p6RxP5ModDef
syn match p6RxP5ModDef display contained "\h\w*"
syn region p6RxP5ModName
\ matchgroup=p6StringSpecial
\ start="?'"
\ end="'"
\ contained
syn region p6RxP5ModName
\ matchgroup=p6StringSpecial
\ start="?P\?<"
\ end=">"
\ contained
syn region p6RxP5Code
\ matchgroup=p6StringSpecial
\ start="??\?{"
\ end="})\@="
\ contained
\ contains=TOP
syn match p6RxP5EscMeta display contained "\\[?*.{}()[\]|\^$]"
syn match p6RxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=p6RxP5CountId
syn region p6RxP5CountId
\ matchgroup=p6RxP5Escape
\ start="{"
\ end="}"
\ contained
syn match p6RxP5Verb display contained "(\@1<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)"
syn region p6RxP5QuoteMeta
\ matchgroup=p6RxP5Escape
\ start="\\Q"
\ end="\\E"
\ contained
\ contains=@p6Variables,p6EscBackSlash
syn region p6RxP5CharClass
\ matchgroup=p6StringSpecial
\ start="\[\^\?"
\ skip="\\]"
\ end="]"
\ contained
\ contains=@p6RegexP5Class
syn region p6RxP5Posix
\ matchgroup=p6RxP5Escape
\ start="\[:"
\ end=":]"
\ contained
syn match p6RxP5Range display contained "-"
" m:P5//
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=/"
\ skip="\\/"
\ end="/"
\ contains=@p6RegexP5,p6Variable,p6VarExclam,p6VarMatch,p6VarNum
" m:P5!!
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=!"
\ skip="\\!"
\ end="!"
\ contains=@p6RegexP5,p6Variable,p6VarSlash,p6VarMatch,p6VarNum
" m:P5$$, m:P5||, etc
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=\z([\"'`|,$]\)"
\ skip="\\\z1"
\ end="\z1"
\ contains=@p6RegexP5,@p6Variables
" m:P5 ()
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s\+\)\@<=()\@!"
\ skip="\\)"
\ end=")"
\ contains=@p6RegexP5,@p6Variables
" m:P5[]
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=[]\@!"
\ skip="\\]"
\ end="]"
\ contains=@p6RegexP5,@p6Variables
" m:P5{}
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<={}\@!"
\ skip="\\}"
\ end="}"
\ contains=@p6RegexP5,p6Variables
" m:P5<>
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=<>\@!"
\ skip="\\>"
\ end=">"
\ contains=@p6RegexP5,p6Variables
" m:P5«»
syn region p6Match
\ matchgroup=p6Quote
\ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=«»\@!"
\ skip="\\»"
\ end="»"
\ contains=@p6RegexP5,p6Variables
endif
" Comments
syn match p6Attention display "\<\%(ACHTUNG\|ATTN\|ATTENTION\|FIXME\|NB\|TODO\|TBD\|WTF\|XXX\|NOTE\)" contained
" normal end-of-line comment