raku.vim 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972
  1. " Vim syntax file
  2. " Language: Raku
  3. " Maintainer: vim-perl <vim-perl@googlegroups.com>
  4. " Homepage: https://github.com/Raku/vim-raku
  5. " Bugs/requests: https://github.com/Raku/vim-raku/issues
  6. " Last Change: 2021-04-16
  7. " Contributors: Luke Palmer <fibonaci@babylonia.flatirons.org>
  8. " Moritz Lenz <moritz@faui2k3.org>
  9. " Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
  10. "
  11. " This is a big undertaking.
  12. "
  13. " The ftdetect/raku.vim file in this repository takes care of setting the
  14. " right filetype for Raku files. To set it explicitly you can also add this
  15. " line near the bottom of your source file:
  16. " # vim: filetype=raku
  17. " TODO:
  18. " * Go over the list of keywords/types to see what's deprecated/missing
  19. " * Add more support for folding (:help syn-fold)
  20. "
  21. " If you want to have Pir code inside Q:PIR// strings highlighted, do:
  22. " let raku_embedded_pir=1
  23. "
  24. " The above requires pir.vim, which you can find in Parrot's repository:
  25. " https://github.com/parrot/parrot/tree/master/editor
  26. "
  27. " To highlight Perl 5 regexes (m:P5//):
  28. " let raku_perl5_regexes=1
  29. "
  30. " To enable folding:
  31. " let raku_fold=1
  32. if version < 704 | throw "raku.vim uses regex syntax which Vim <7.4 doesn't support. Try 'make fix_old_vim' in the vim-perl repository." | endif
  33. " For version 5.x: Clear all syntax items
  34. " For version 6.x: Quit when a syntax file was already loaded
  35. if version < 600
  36. syntax clear
  37. elseif exists("b:current_syntax")
  38. finish
  39. endif
  40. let s:keepcpo= &cpo
  41. set cpo&vim
  42. " Patterns which will be interpolated by the preprocessor (tools/preproc.pl):
  43. "
  44. " @@IDENT_NONDIGIT@@ "[A-Za-z_\xC0-\xFF]"
  45. " @@IDENT_CHAR@@ "[A-Za-z_\xC0-\xFF0-9]"
  46. " @@IDENTIFIER@@ "\%(@@IDENT_NONDIGIT@@\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\@=\)*\)"
  47. " @@IDENTIFIER_START@@ "@@IDENT_CHAR@@\@1<!\%(@@IDENT_NONDIGIT@@[-']\)\@2<!"
  48. " @@IDENTIFIER_END@@ "\%(@@IDENT_CHAR@@\|[-']@@IDENT_NONDIGIT@@\)\@!"
  49. " @@METAOP@@ #\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+#
  50. " @@ADVERBS@@ "\%(\_s*:!\?@@IDENTIFIER@@\%(([^)]*)\)\?\)*"
  51. "
  52. " Same but escaped, for use in string eval
  53. " @@IDENT_NONDIGIT_Q@@ "[A-Za-z_\\xC0-\\xFF]"
  54. " @@IDENT_CHAR_Q@@ "[A-Za-z_\\xC0-\\xFF0-9]"
  55. " @@IDENTIFIER_Q@@ "\\%(@@IDENT_NONDIGIT_Q@@\\%(@@IDENT_CHAR_Q@@\\|[-']@@IDENT_NONDIGIT_Q@@\\@=\\)*\\)"
  56. " @@IDENTIFIER_START_Q@@ "@@IDENT_CHAR_Q@@\\@1<!\\%(@@IDENT_NONDIGIT_Q@@[-']\\)\\@2<!"
  57. " @@IDENTIFIER_END_Q@@ "\\%(@@IDENT_CHAR_Q@@\\|[-']@@IDENT_NONDIGIT_Q@@\\)\\@!"
  58. " Identifiers (subroutines, methods, constants, classes, roles, etc)
  59. syn match rakuIdentifier display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  60. let s:keywords = {
  61. \ "rakuInclude": [
  62. \ "use require import unit",
  63. \ ],
  64. \ "rakuConditional": [
  65. \ "if else elsif unless with orwith without once",
  66. \ ],
  67. \ "rakuVarStorage": [
  68. \ "let my our state temp has constant",
  69. \ ],
  70. \ "rakuRepeat": [
  71. \ "for loop repeat while until gather given",
  72. \ "supply react race hyper lazy quietly",
  73. \ ],
  74. \ "rakuFlowControl": [
  75. \ "take take-rw do when next last redo return return-rw",
  76. \ "start default exit make continue break goto leave",
  77. \ "proceed succeed whenever emit done",
  78. \ ],
  79. \ "rakuClosureTrait": [
  80. \ "BEGIN CHECK INIT FIRST ENTER LEAVE KEEP",
  81. \ "UNDO NEXT LAST PRE POST END CATCH CONTROL",
  82. \ "DOC QUIT CLOSE COMPOSE",
  83. \ ],
  84. \ "rakuException": [
  85. \ "die fail try warn",
  86. \ ],
  87. \ "rakuPragma": [
  88. \ "MONKEY-GUTS MONKEY-SEE-NO-EVAL MONKEY-TYPING MONKEY",
  89. \ "experimental fatal isms lib newline nqp precompilation",
  90. \ "soft strict trace variables worries",
  91. \ ],
  92. \ "rakuOperator": [
  93. \ "div xx x mod also leg cmp before after eq ne le lt not",
  94. \ "gt ge eqv ff fff and andthen or xor orelse lcm gcd o",
  95. \ "unicmp notandthen minmax",
  96. \ ],
  97. \ "rakuType": [
  98. \ "int int1 int2 int4 int8 int16 int32 int64",
  99. \ "rat rat1 rat2 rat4 rat8 rat16 rat32 rat64",
  100. \ "buf buf1 buf2 buf4 buf8 buf16 buf32 buf64",
  101. \ "blob blob1 blob2 blob4 blob8 blob16 blob32 blob64",
  102. \ "uint uint1 uint2 uint4 uint8 uint16 uint32 bit bool",
  103. \ "uint64 utf8 utf16 utf32 bag set mix complex",
  104. \ "num num32 num64 long longlong Pointer size_t str void",
  105. \ "ulong ulonglong ssize_t atomicint",
  106. \ ],
  107. \ }
  108. " These can be immediately followed by parentheses
  109. let s:types = [
  110. \ "Object Any Cool Junction Whatever Capture Match",
  111. \ "Signature Proxy Matcher Package Module Class",
  112. \ "Grammar Scalar Array Hash KeyHash KeySet KeyBag",
  113. \ "Pair List Seq Range Set Bag Map Mapping Void Undef",
  114. \ "Failure Exception Code Block Routine Sub Macro",
  115. \ "Method Submethod Regex Str Blob Char Byte Parcel",
  116. \ "Codepoint Grapheme StrPos StrLen Version Num",
  117. \ "Complex Bit True False Order Same Less More",
  118. \ "Increasing Decreasing Ordered Callable AnyChar",
  119. \ "Positional Associative Ordering KeyExtractor",
  120. \ "Comparator OrderingPair IO KitchenSink Role",
  121. \ "Int Rat Buf UInt Abstraction Numeric Real",
  122. \ "Nil Mu SeekFromBeginning SeekFromEnd SeekFromCurrent",
  123. \ ]
  124. " We explicitly enumerate the alphanumeric infix operators allowed after [RSXZ]
  125. " to avoid matching package names that start with those letters.
  126. let s:alpha_metaops = [
  127. \ "div mod gcd lcm xx x does but cmp leg eq ne gt ge lt le before after eqv",
  128. \ "min max not so andthen and or orelse unicmp coll minmax",
  129. \ ]
  130. let s:words_space = join(s:alpha_metaops, " ")
  131. let s:temp = split(s:words_space)
  132. let s:alpha_metaops_or = join(s:temp, "\\|")
  133. " We don't use "syn keyword" here because that always has higher priority
  134. " than matches/regions, which would prevent these words from matching as
  135. " autoquoted strings before "=>".
  136. syn match rakuKeywordStart display "\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!\)\@=[A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!"
  137. \ nextgroup=rakuAttention,rakuVariable,rakuInclude,rakuConditional,rakuVarStorage,rakuRepeat,rakuFlowControl,rakuClosureTrait,rakuException,rakuNumber,rakuPragma,rakuType,rakuOperator,rakuIdentifier
  138. for [s:group, s:words_list] in items(s:keywords)
  139. let s:words_space = join(s:words_list, " ")
  140. let s:temp = split(s:words_space)
  141. let s:words = join(s:temp, "\\|")
  142. exec "syn match ". s:group ." display \"[.^]\\@1<!\\%(". s:words . "\\)(\\@!\\%([A-Za-z_\\xC0-\\xFF0-9]\\|[-'][A-Za-z_\\xC0-\\xFF]\\)\\@!\" contained"
  143. endfor
  144. let s:words_space = join(s:types, " ")
  145. let s:temp = split(s:words_space)
  146. let s:words = join(s:temp, "\\|")
  147. exec "syn match rakuType display \"\\%(". s:words . "\\)\\%([A-Za-z_\\xC0-\\xFF0-9]\\|[-'][A-Za-z_\\xC0-\\xFF]\\)\\@!\" contained"
  148. unlet s:group s:words_list s:keywords s:types s:words_space s:temp s:words
  149. syn match rakuPreDeclare display "[.^]\@1<!\<\%(multi\|proto\|only\)\>" nextgroup=rakuDeclare,rakuIdentifier skipwhite skipempty
  150. syn match rakuDeclare display "[.^]\@1<!\<\%(macro\|sub\|submethod\|method\|module\|class\|role\|package\|enum\|grammar\|slang\|subset\)\>" nextgroup=rakuIdentifier skipwhite skipempty
  151. syn match rakuDeclareRegex display "[.^]\@1<!\<\%(regex\|rule\|token\)\>" nextgroup=rakuRegexName skipwhite skipempty
  152. syn match rakuTypeConstraint display "\%([.^]\|^\s*\)\@<!\a\@=\%(does\|as\|but\|trusts\|of\|returns\|handles\|where\|augment\|supersede\)\>"
  153. syn match rakuTypeConstraint display "\%([.^]\|^\s*\)\@<![A-Za-z_\xC0-\xFF0-9]\@1<!\%([A-Za-z_\xC0-\xFF][-']\)\@2<!is\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=rakuProperty
  154. syn match rakuProperty 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\|DEPRECATED\|raw\|repr\|dynamic\|hidden-from-backtrace\|nodal\|pure\)" contained
  155. " packages, must come after all the keywords
  156. syn match rakuIdentifier display "\%(::\)\@2<=\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)*"
  157. syn match rakuIdentifier display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(::\)\@="
  158. " The sigil in ::*Package
  159. syn match rakuPackageTwigil display "\%(::\)\@2<=\*"
  160. " some standard packages
  161. syn match rakuType display "\%(::\)\@2<!\%(SeekType\%(::SeekFromBeginning\|::SeekFromCurrent\|::SeekFromEnd\)\|Order\%(::Same\|::More\|::Less\)\?\|Bool\%(::True\|::False\)\?\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!"
  162. " Don't put a "\+" at the end of the character class. That makes it so
  163. " greedy that the "%" " in "+%foo" won't be allowed to match as a sigil,
  164. " among other things
  165. syn match rakuOperator display "[-+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅∘]"
  166. syn match rakuOperator display "\%(:\@1<!::\@2!\|::=\|\.::\)"
  167. " these require whitespace on the left side
  168. syn match rakuOperator display "\%(\s\|^\)\@1<=\%(xx=\)"
  169. " index overloading
  170. syn match rakuOperator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)"
  171. " Reduce metaoperators like [+]
  172. syn match rakuReduceOp display "\%(^\|\s\|(\)\@1<=!*\%([RSXZ\[]\)*[&RSXZ]\?\[\+(\?\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+)\?]\+"
  173. syn match rakuSetOp display "R\?(\%([-^.+|&]\|[<>][=+]\?\|cont\|elem\))"
  174. " Reverse, cross, and zip metaoperators
  175. exec "syn match rakuRSXZOp display \"[RSXZ]:\\@!\\%(\\a\\@=\\%(". s:alpha_metaops_or . "\\)\\>\\|[[:alnum:]]\\@!\\%([.,]\\|[^[,.[:alnum:][:space:]]\\)\\+\\|\\s\\@=\\|$\\)\""
  176. syn match rakuBlockLabel display "^\s*\zs\h\w*\s*::\@!\_s\@="
  177. syn match rakuNumber display "[A-Za-z_\xC0-\xFF0-9]\@1<!\%(\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?Inf\|NaN\)"
  178. syn match rakuNumber display "[A-Za-z_\xC0-\xFF0-9]\@1<!\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?\%(\%(\d\|__\@!\)*[._]\@1<!\.\)\?_\@!\%(\d\|_\)\+_\@1<!\%([eE]-\?_\@!\%(\d\|_\)\+\)\?i\?"
  179. syn match rakuNumber display "[A-Za-z_\xC0-\xFF0-9]\@1<!\%(\%(\_^\|\s\|[^*\a]\)\@1<=[-+]\)\?0[obxd]\@=" nextgroup=rakuOctBase,rakuBinBase,rakuHexBase,rakuDecBase
  180. syn match rakuOctBase display "o" contained nextgroup=rakuOctNumber
  181. syn match rakuBinBase display "b" contained nextgroup=rakuBinNumber
  182. syn match rakuHexBase display "x" contained nextgroup=rakuHexNumber
  183. syn match rakuDecBase display "d" contained nextgroup=rakuDecNumber
  184. syn match rakuOctNumber display "[0-7][0-7_]*" contained
  185. syn match rakuBinNumber display "[01][01_]*" contained
  186. syn match rakuHexNumber display "\x[[:xdigit:]_]*" contained
  187. syn match rakuDecNumber display "\d[[:digit:]_]*" contained
  188. syn match rakuVersion display "\<v\d\+\%(\.\%(\*\|\d\+\)\)*+\?"
  189. " Contextualizers
  190. syn match rakuContext display "\<\%(item\|list\|slice\|hash\)\>"
  191. syn match rakuContext display "\%(\$\|@\|%\|&\)(\@="
  192. " Quoting
  193. " one cluster for every quote adverb
  194. syn cluster rakuInterp_scalar
  195. \ add=rakuInterpScalar
  196. syn cluster rakuInterp_array
  197. \ add=rakuInterpArray
  198. syn cluster rakuInterp_hash
  199. \ add=rakuInterpHash
  200. syn cluster rakuInterp_function
  201. \ add=rakuInterpFunction
  202. syn cluster rakuInterp_closure
  203. \ add=rakuInterpClosure
  204. syn cluster rakuInterp_q
  205. \ add=rakuEscQQ
  206. \ add=rakuEscBackSlash
  207. syn cluster rakuInterp_backslash
  208. \ add=@rakuInterp_q
  209. \ add=rakuEscape
  210. \ add=rakuEscOpenCurly
  211. \ add=rakuEscCodePoint
  212. \ add=rakuEscHex
  213. \ add=rakuEscOct
  214. \ add=rakuEscOctOld
  215. \ add=rakuEscNull
  216. syn cluster rakuInterp_qq
  217. \ add=@rakuInterp_scalar
  218. \ add=@rakuInterp_array
  219. \ add=@rakuInterp_hash
  220. \ add=@rakuInterp_function
  221. \ add=@rakuInterp_closure
  222. \ add=@rakuInterp_backslash
  223. \ add=rakuMatchVarSigil
  224. syn region rakuInterpScalar
  225. \ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
  226. \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\|\%(\d\+\|!\|/\|¢\)\)\)"
  227. \ end="\z1\zs"
  228. \ contained keepend
  229. \ contains=TOP
  230. syn region rakuInterpScalar
  231. \ matchgroup=rakuContext
  232. \ start="\$\ze()\@!"
  233. \ skip="([^)]*)"
  234. \ end=")\zs"
  235. \ contained
  236. \ contains=TOP
  237. syn region rakuInterpArray
  238. \ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
  239. \ end="\z1\zs"
  240. \ contained keepend
  241. \ contains=TOP
  242. syn region rakuInterpArray
  243. \ matchgroup=rakuContext
  244. \ start="@\ze()\@!"
  245. \ skip="([^)]*)"
  246. \ end=")\zs"
  247. \ contained
  248. \ contains=TOP
  249. syn region rakuInterpHash
  250. \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
  251. \ end="\z1\zs"
  252. \ contained keepend
  253. \ contains=TOP
  254. syn region rakuInterpHash
  255. \ matchgroup=rakuContext
  256. \ start="%\ze()\@!"
  257. \ skip="([^)]*)"
  258. \ end=")\zs"
  259. \ contained
  260. \ contains=TOP
  261. syn region rakuInterpFunction
  262. \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
  263. \ end="\z1\zs"
  264. \ contained keepend
  265. \ contains=TOP
  266. syn region rakuInterpFunction
  267. \ matchgroup=rakuContext
  268. \ start="&\ze()\@!"
  269. \ skip="([^)]*)"
  270. \ end=")\zs"
  271. \ contained
  272. \ contains=TOP
  273. syn region rakuInterpClosure
  274. \ start="\\\@1<!{}\@!"
  275. \ skip="{[^}]*}"
  276. \ end="}"
  277. \ contained keepend
  278. \ contains=TOP
  279. " generic escape
  280. syn match rakuEscape display "\\\S" contained
  281. " escaped closing delimiters
  282. syn match rakuEscQuote display "\\'" contained
  283. syn match rakuEscDoubleQuote display "\\\"" contained
  284. syn match rakuEscCloseAngle display "\\>" contained
  285. syn match rakuEscCloseFrench display "\\»" contained
  286. syn match rakuEscBackTick display "\\`" contained
  287. syn match rakuEscForwardSlash display "\\/" contained
  288. syn match rakuEscVerticalBar display "\\|" contained
  289. syn match rakuEscExclamation display "\\!" contained
  290. syn match rakuEscComma display "\\," contained
  291. syn match rakuEscDollar display "\\\$" contained
  292. syn match rakuEscCloseCurly display "\\}" contained
  293. syn match rakuEscCloseBracket display "\\\]" contained
  294. " matches :key, :!key, :$var, :key<var>, etc
  295. " Since we don't know in advance how the adverb ends, we use a trick.
  296. " Consume nothing with the start pattern (\ze at the beginning),
  297. " while capturing the whole adverb into \z1 and then putting it before
  298. " the match start (\zs) of the end pattern.
  299. syn region rakuAdverb
  300. \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)"
  301. \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@1<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\)\|\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\)"
  302. \ end="\z1\zs"
  303. \ contained keepend
  304. \ contains=TOP
  305. " <words>
  306. " Distinguishing this from the "less than" operator is tricky. For now,
  307. " it matches if any of the following is true:
  308. "
  309. " * There is whitespace missing on either side of the "<", since
  310. " people tend to put spaces around "less than". We make an exception
  311. " for " = < ... >" assignments though.
  312. " * It comes after "enum", "for", "any", "all", or "none"
  313. " * It's the first or last thing on a line (ignoring whitespace)
  314. " * It's preceded by "(\s*" or "=\s\+"
  315. " * It's empty and terminated on the same line (e.g. <> and < >)
  316. "
  317. " It never matches when:
  318. "
  319. " * Preceded by [<+~=!] (e.g. <<foo>>, =<$foo>, * !< 3)
  320. " * Followed by [-=] (e.g. <--, <=, <==, <->)
  321. syn region rakuStringAngle
  322. \ matchgroup=rakuQuote
  323. \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
  324. \ start="\%(\s\|[<+~=!]\)\@<!<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
  325. \ start="[<+~=!]\@1<!<\%(\s\|<\|=>\|\%([=-]\{1,2}>\|[=-]\{1,2}\)\)\@!"
  326. \ start="\%(^\s*\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
  327. \ start="[<+~=!]\@1<!<\%(\s*$\)\@="
  328. \ start="\%((\s*\|=\s\+\)\@<=<\%(<\|=>\|\%([=-]\{1,2}>\|[=-]\{2}\)\)\@!"
  329. \ start="<\%(\s*>\)\@="
  330. \ skip="\\\@1<!\\>"
  331. \ end=">"
  332. \ contains=rakuInnerAnglesOne,rakuEscBackSlash,rakuEscCloseAngle
  333. syn region rakuStringAngleFixed
  334. \ matchgroup=rakuQuote
  335. \ start="<"
  336. \ skip="\\\@1<!\\>"
  337. \ end=">"
  338. \ contains=rakuInnerAnglesOne,rakuEscBackSlash,rakuEscCloseAngle
  339. \ contained
  340. syn region rakuInnerAnglesOne
  341. \ matchgroup=rakuStringAngle
  342. \ start="\\\@1<!<"
  343. \ skip="\\\@1<!\\>"
  344. \ end=">"
  345. \ transparent contained
  346. \ contains=rakuInnerAnglesOne
  347. " <<words>>
  348. syn region rakuStringAngles
  349. \ matchgroup=rakuQuote
  350. \ start="<<=\@!"
  351. \ skip="\\\@1<!\\>"
  352. \ end=">>"
  353. \ contains=rakuInnerAnglesTwo,@rakuInterp_qq,rakuComment,rakuBracketComment,rakuEscHash,rakuEscCloseAngle,rakuAdverb,rakuStringSQ,rakuStringDQ
  354. syn region rakuInnerAnglesTwo
  355. \ matchgroup=rakuStringAngles
  356. \ start="<<"
  357. \ skip="\\\@1<!\\>"
  358. \ end=">>"
  359. \ transparent contained
  360. \ contains=rakuInnerAnglesTwo
  361. " «words»
  362. syn region rakuStringFrench
  363. \ matchgroup=rakuQuote
  364. \ start="«"
  365. \ skip="\\\@1<!\\»"
  366. \ end="»"
  367. \ contains=rakuInnerFrench,@rakuInterp_qq,rakuComment,rakuBracketComment,rakuEscHash,rakuEscCloseFrench,rakuAdverb,rakuStringSQ,rakuStringDQ
  368. syn region rakuInnerFrench
  369. \ matchgroup=rakuStringFrench
  370. \ start="\\\@1<!«"
  371. \ skip="\\\@1<!\\»"
  372. \ end="»"
  373. \ transparent contained
  374. \ contains=rakuInnerFrench
  375. " Hyperops. They need to come after "<>" and "«»" strings in order to override
  376. " them, but before other types of strings, to avoid matching those delimiters
  377. " as parts of hyperops.
  378. syn match rakuHyperOp display #[^[:digit:][{('",:[:space:]][^[{('",:[:space:]]*\%(«\|<<\)#
  379. syn match rakuHyperOp display "«\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+[«»]"
  380. syn match rakuHyperOp display "»\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(«\|»\?\)"
  381. syn match rakuHyperOp display "<<\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|>>\)"
  382. syn match rakuHyperOp display ">>\%(\d\|[@%$][.?^=[:alpha:]]\)\@!\%(\.\|[^[{('".[:space:]]\)\+\%(<<\|\%(>>\)\?\)"
  383. " 'string'
  384. syn region rakuStringSQ
  385. \ matchgroup=rakuQuote
  386. \ start="'"
  387. \ skip="\\\@1<!\\'"
  388. \ end="'"
  389. \ contains=@rakuInterp_q,rakuEscQuote
  390. \ keepend extend
  391. " "string"
  392. syn region rakuStringDQ
  393. \ matchgroup=rakuQuote
  394. \ start=+"+
  395. \ skip=+\\\@1<!\\"+
  396. \ end=+"+
  397. \ contains=@rakuInterp_qq,rakuEscDoubleQuote
  398. \ keepend extend
  399. " Q// and friends
  400. syn match rakuQuoteQStart display "\%(:\|\%(sub\|role\)\s\)\@5<![Qq]\@=" nextgroup=rakuQuoteQ,rakuQuoteQ_q,rakuQuoteQ_qww,rakuQuoteQ_qq,rakuQuoteQ_to,rakuQuoteQ_qto,rakuQuoteQ_qqto,rakuIdentifier
  401. syn match rakuQuoteQ display "Q\%(qq\|ww\|[abcfhpsqvwx]\)\?[A-Za-z(]\@!" nextgroup=rakuPairsQ skipwhite skipempty contained
  402. syn match rakuQuoteQ_q display "q[abcfhpsvwx]\?[A-Za-z(]\@!" nextgroup=rakuPairsQ_q skipwhite skipempty contained
  403. syn match rakuQuoteQ_qww display "qww[A-Za-z(]\@!" nextgroup=rakuPairsQ_qww skipwhite skipempty contained
  404. syn match rakuQuoteQ_qq display "qq\%([pwx]\|ww\)\?[A-Za-z(]\@!" nextgroup=rakuPairsQ_qq skipwhite skipempty contained
  405. syn match rakuQuoteQ_to display "Qto[A-Za-z(]\@!" nextgroup=rakuStringQ_to skipwhite skipempty contained
  406. syn match rakuQuoteQ_qto display "qto[A-Za-z(]\@!" nextgroup=rakuStringQ_qto skipwhite skipempty contained
  407. syn match rakuQuoteQ_qqto display "qqto[A-Za-z(]\@!" nextgroup=rakuStringQ_qqto skipwhite skipempty contained
  408. syn match rakuQuoteQ_qto display "q\_s*\%(\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*:\%(to\|heredoc\)\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*(\@!\)\@=" nextgroup=rakuPairsQ_qto skipwhite skipempty contained
  409. syn match rakuQuoteQ_qqto display "qq\_s*\%(\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*:\%(to\|heredoc\)\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*(\@!\)\@=" nextgroup=rakuPairsQ_qqto skipwhite skipempty contained
  410. syn match rakuPairsQ "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuStringQ
  411. syn match rakuPairsQ_q "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuStringQ_q
  412. syn match rakuPairsQ_qww "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuStringQ_qww
  413. syn match rakuPairsQ_qq "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuStringQ_qq
  414. syn match rakuPairsQ_qto "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuStringQ_qto
  415. syn match rakuPairsQ_qqto "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuStringQ_qqto
  416. if exists("raku_embedded_pir") || exists("raku_extended_all")
  417. syn include @rakuPIR syntax/pir.vim
  418. syn match rakuQuote_QPIR display "Q[A-Za-z(]\@!\%(\_s*:PIR\)\@=" nextgroup=rakuPairsQ_PIR skipwhite skipempty
  419. syn match rakuPairs_QPIR contained "\_s*:PIR" transparent skipwhite skipempty nextgroup=rakuStringQ_PIR
  420. endif
  421. " hardcoded set of delimiters
  422. let s:plain_delims = [
  423. \ ["DQ", "\\\"", "\\\"", "rakuEscDoubleQuote", "\\\\\\@1<!\\\\\\\""],
  424. \ ["SQ", "'", "'", "rakuEscQuote", "\\\\\\@1<!\\\\'"],
  425. \ ["Slash", "/", "/", "rakuEscForwardSlash", "\\\\\\@1<!\\\\/"],
  426. \ ["BackTick", "`", "`", "rakuEscBackTick", "\\\\\\@1<!\\\\`"],
  427. \ ["Bar", "|", "|", "rakuEscVerticalBar", "\\\\\\@1<!\\\\|"],
  428. \ ["Exclamation", "!", "!", "rakuEscExclamation", "\\\\\\@1<!\\\\!"],
  429. \ ["Comma", ",", ",", "rakuEscComma", "\\\\\\@1<!\\\\,"],
  430. \ ["Dollar", "\\$", "\\$", "rakuEscDollar", "\\\\\\@1<!\\\\\\$"],
  431. \ ]
  432. let s:bracketing_delims = [
  433. \ ["Curly", "{", "}", "rakuEscCloseCurly", "\\%(\\\\\\@1<!\\\\}\\|{[^}]*}\\)"],
  434. \ ["Angle", "<", ">", "rakuEscCloseAngle", "\\%(\\\\\\@1<!\\\\>\\|<[^>]*>\\)"],
  435. \ ["French", "«", "»", "rakuEscCloseFrench", "\\%(\\\\\\@1<!\\\\»\\|«[^»]*»\\)"],
  436. \ ["Bracket", "\\\[", "]", "rakuEscCloseBracket", "\\%(\\\\\\@1<!\\\\]\\|\\[^\\]]*]\\)"],
  437. \ ["Paren", "\\s\\@1<=(", ")", "rakuEscCloseParen", "\\%(\\\\\\@1<!\\\\)\\|([^)]*)\\)"],
  438. \ ]
  439. let s:all_delims = s:plain_delims + s:bracketing_delims
  440. for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:all_delims
  441. exec "syn region rakuStringQ matchgroup=rakuQuote start=\"".s:start_delim."\" end=\"".s:end_delim."\" contained"
  442. exec "syn region rakuStringQ_q matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contains=@rakuInterp_q,".s:end_group." contained"
  443. exec "syn region rakuStringQ_qww matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contains=@rakuInterp_q,rakuStringSQ,rakuStringDQ".s:end_group." contained"
  444. exec "syn region rakuStringQ_qq matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contains=@rakuInterp_qq,".s:end_group." contained"
  445. exec "syn region rakuStringQ_to matchgroup=rakuQuote start=\"".s:start_delim."\\z([^".s:end_delim."]\\+\\)".s:end_delim."\" end=\"^\\s*\\z1$\" contained"
  446. exec "syn region rakuStringQ_qto matchgroup=rakuQuote start=\"".s:start_delim."\\z([^".s:end_delim."]\\+\\)".s:end_delim."\" skip=\"".s:skip."\" end=\"^\\s*\\z1$\" contains=@rakuInterp_q,".s:end_group." contained"
  447. exec "syn region rakuStringQ_qqto matchgroup=rakuQuote start=\"".s:start_delim."\\z(\[^".s:end_delim."]\\+\\)".s:end_delim."\" skip=\"".s:skip."\" end=\"^\\s*\\z1$\" contains=@rakuInterp_qq,".s:end_group." contained"
  448. if exists("raku_embedded_pir") || exists("raku_extended_all")
  449. exec "syn region rakuStringQ_PIR matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contains=@rakuPIR,".s:end_group." contained"
  450. endif
  451. endfor
  452. unlet s:name s:start_delim s:end_delim s:end_group s:skip s:plain_delims s:all_delims
  453. " :key
  454. syn match rakuOperator display ":\@1<!::\@!!\?" nextgroup=rakuKey,rakuStringAngleFixed,rakuStringAngles,rakuStringFrench
  455. syn match rakuKey display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" contained nextgroup=rakuStringAngleFixed,rakuStringAngles,rakuStringFrench
  456. " Regexes and grammars
  457. syn match rakuRegexName display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\?" nextgroup=rakuRegexBlockCrap skipwhite skipempty contained
  458. syn match rakuRegexBlockCrap "[^{]*" nextgroup=rakuRegexBlock skipwhite skipempty transparent contained
  459. syn region rakuRegexBlock
  460. \ matchgroup=rakuNormal
  461. \ start="{"
  462. \ end="}"
  463. \ contained
  464. \ contains=@rakuRegexen,@rakuVariables
  465. " Perl 6 regex bits
  466. syn cluster rakuRegexen
  467. \ add=rakuRxMeta
  468. \ add=rakuRxEscape
  469. \ add=rakuEscCodePoint
  470. \ add=rakuEscHex
  471. \ add=rakuEscOct
  472. \ add=rakuEscNull
  473. \ add=rakuRxAnchor
  474. \ add=rakuRxCapture
  475. \ add=rakuRxGroup
  476. \ add=rakuRxAlternation
  477. \ add=rakuRxBoundary
  478. \ add=rakuRxAdverb
  479. \ add=rakuRxAdverbArg
  480. \ add=rakuRxStorage
  481. \ add=rakuRxAssertion
  482. \ add=rakuRxAssertGroup
  483. \ add=rakuRxQuoteWords
  484. \ add=rakuRxClosure
  485. \ add=rakuRxStringSQ
  486. \ add=rakuRxStringDQ
  487. \ add=rakuComment
  488. \ add=rakuBracketComment
  489. \ add=rakuMatchVarSigil
  490. syn match rakuRxMeta display contained ".\%([A-Za-z_\xC0-\xFF0-9]\|\s\)\@1<!"
  491. syn match rakuRxAnchor display contained "[$^]"
  492. syn match rakuRxEscape display contained "\\\S"
  493. syn match rakuRxCapture display contained "[()]"
  494. syn match rakuRxAlternation display contained "|"
  495. syn match rakuRxRange display contained "\.\."
  496. " misc escapes
  497. syn match rakuEscOctOld display "\\[1-9]\d\{1,2}" contained
  498. syn match rakuEscNull display "\\0\d\@!" contained
  499. syn match rakuEscCodePoint display "\\[cC]" contained nextgroup=rakuCodePoint
  500. syn match rakuEscHex display "\\[xX]" contained nextgroup=rakuHexSequence
  501. syn match rakuEscOct display "\\o" contained nextgroup=rakuOctSequence
  502. syn match rakuEscQQ display "\\qq" contained nextgroup=rakuQQSequence
  503. syn match rakuEscOpenCurly display "\\{" contained
  504. syn match rakuEscHash display "\\#" contained
  505. syn match rakuEscBackSlash display "\\\\" contained
  506. syn region rakuQQSequence
  507. \ matchgroup=rakuEscape
  508. \ start="\["
  509. \ skip="\[[^\]]*]"
  510. \ end="]"
  511. \ contained transparent
  512. \ contains=@rakuInterp_qq
  513. syn match rakuCodePoint display "\%(\d\+\|\S\)" contained
  514. syn region rakuCodePoint
  515. \ matchgroup=rakuEscape
  516. \ start="\["
  517. \ end="]"
  518. \ contained
  519. syn match rakuHexSequence display "\x\+" contained
  520. syn region rakuHexSequence
  521. \ matchgroup=rakuEscape
  522. \ start="\["
  523. \ end="]"
  524. \ contained
  525. syn match rakuOctSequence display "\o\+" contained
  526. syn region rakuOctSequence
  527. \ matchgroup=rakuEscape
  528. \ start="\["
  529. \ end="]"
  530. \ contained
  531. " $<match>, @<match>
  532. syn region rakuMatchVarSigil
  533. \ matchgroup=rakuVariable
  534. \ start="[$@]\%(<<\@!\)\@="
  535. \ end=">\@1<="
  536. \ contains=rakuMatchVar
  537. syn region rakuMatchVar
  538. \ matchgroup=rakuTwigil
  539. \ start="<"
  540. \ end=">"
  541. \ contained
  542. syn region rakuRxClosure
  543. \ matchgroup=rakuNormal
  544. \ start="{"
  545. \ end="}"
  546. \ contained
  547. \ containedin=rakuRxClosure
  548. \ contains=TOP
  549. syn region rakuRxGroup
  550. \ matchgroup=rakuStringSpecial2
  551. \ start="\["
  552. \ end="]"
  553. \ contained
  554. \ contains=@rakuRegexen,@rakuVariables,rakuMatchVarSigil
  555. syn region rakuRxAssertion
  556. \ matchgroup=rakuStringSpecial2
  557. \ start="<\%(?\?\%(before\|after\)\|\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\)\|[+?*]\)\?"
  558. \ end=">"
  559. \ contained
  560. \ contains=@rakuRegexen,rakuIdentifier,@rakuVariables,rakuRxCharClass,rakuRxAssertCall
  561. syn region rakuRxAssertGroup
  562. \ matchgroup=rakuStringSpecial2
  563. \ start="<\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)=\["
  564. \ skip="\\\@1<!\\]"
  565. \ end="]"
  566. \ contained
  567. syn match rakuRxAssertCall display "\%(::\|\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)" contained nextgroup=rakuRxAssertArgs
  568. syn region rakuRxAssertArgs
  569. \ start="("
  570. \ end=")"
  571. \ contained keepend
  572. \ contains=TOP
  573. syn region rakuRxAssertArgs
  574. \ start=":"
  575. \ end="\ze>"
  576. \ contained keepend
  577. \ contains=TOP
  578. syn match rakuRxBoundary display contained "\%([«»]\|<<\|>>\)"
  579. syn region rakuRxCharClass
  580. \ matchgroup=rakuStringSpecial2
  581. \ start="\%(<[-!+?]\?\)\@2<=\["
  582. \ skip="\\]"
  583. \ end="]"
  584. \ contained
  585. \ contains=rakuRxRange,rakuRxEscape,rakuEscHex,rakuEscOct,rakuEscCodePoint,rakuEscNull
  586. syn region rakuRxQuoteWords
  587. \ matchgroup=rakuStringSpecial2
  588. \ start="<\s"
  589. \ end="\s\?>"
  590. \ contained
  591. syn region rakuRxAdverb
  592. \ start="\ze\z(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)"
  593. \ end="\z1\zs"
  594. \ contained keepend
  595. \ contains=TOP
  596. syn region rakuRxAdverbArg
  597. \ start="\%(:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\@<=("
  598. \ skip="([^)]\{-})"
  599. \ end=")"
  600. \ contained
  601. \ keepend
  602. \ contains=TOP
  603. syn region rakuRxStorage
  604. \ matchgroup=rakuOperator
  605. \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@="
  606. \ end="$"
  607. \ contains=TOP
  608. \ contained
  609. \ keepend
  610. " 'string' inside a regex
  611. syn region rakuRxStringSQ
  612. \ matchgroup=rakuQuote
  613. \ start="'"
  614. \ skip="\\\@1<!\\'"
  615. \ end="'"
  616. \ contained
  617. \ contains=rakuEscQuote,rakuEscBackSlash
  618. " "string" inside a regex
  619. syn region rakuRxStringDQ
  620. \ matchgroup=rakuQuote
  621. \ start=+"+
  622. \ skip=+\\\@1<!\\"+
  623. \ end=+"+
  624. \ contained
  625. \ contains=rakuEscDoubleQuote,rakuEscBackSlash,@rakuInterp_qq
  626. " $!, $var, $!var, $::var, $package::var $*::package::var, etc
  627. " Thus must come after the matches for the "$" regex anchor, but before
  628. " the match for the $ regex delimiter
  629. syn cluster rakuVariables
  630. \ add=rakuVarSlash
  631. \ add=rakuVarExclam
  632. \ add=rakuVarMatch
  633. \ add=rakuVarNum
  634. \ add=rakuVariable
  635. syn match rakuBareSigil display "[@$%&]\%(\s*\%([,)}=]\|where\>\)\)\@="
  636. syn match rakuVarSlash display "\$/"
  637. syn match rakuVarExclam display "\$!"
  638. syn match rakuVarMatch display "\$¢"
  639. syn match rakuVarNum display "\$\d\+"
  640. syn match rakuVariable display "self"
  641. syn match rakuVariable display "[@$%&]\?[@&$%]\$*\%(::\|\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\)\|[A-Za-z_\xC0-\xFF]\)\@=" nextgroup=rakuTwigil,rakuVarName,rakuPackageScope
  642. syn match rakuVarName display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)" nextgroup=rakuPostHyperOp contained
  643. syn match rakuClose display "[\])]" transparent nextgroup=rakuPostHyperOp
  644. syn match rakuPostHyperOp display "\%(»\|>>\)" contained
  645. syn match rakuTwigil display "\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=" nextgroup=rakuPackageScope,rakuVarName contained
  646. syn match rakuPackageScope display "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\?::" nextgroup=rakuPackageScope,rakuVarName contained
  647. " Perl 6 regex regions
  648. syn match rakuMatchStart_m display "\.\@1<!\<\%(mm\?\|rx\)\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=rakuMatchAdverbs_m
  649. syn match rakuMatchStart_s display "\.\@1<!\<[sS]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=rakuMatchAdverbs_s
  650. syn match rakuMatchStart_tr display "\.\@1<!\<tr\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\)\@!" skipwhite skipempty nextgroup=rakuMatchAdverbs_tr
  651. syn match rakuMatchAdverbs_m "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuMatch
  652. syn match rakuMatchAdverbs_s "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuSubstitution
  653. syn match rakuMatchAdverbs_tr "\%(\_s*:!\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(([^)]*)\)\?\)*" contained transparent skipwhite skipempty nextgroup=rakuTransliteration
  654. " /foo/
  655. syn region rakuMatchBare
  656. \ matchgroup=rakuQuote
  657. \ start="/\@1<!\%(\%(\_^\|[!\[,=~|&/:({]\|\^\?fff\?\^\?\|=>\|\<\%(if\|unless\|while\|when\|where\|so\)\)\s*\)\@<=/[/=]\@!"
  658. \ skip="\\/"
  659. \ end="/"
  660. \ contains=@rakuRegexen,rakuVariable,rakuVarExclam,rakuVarMatch,rakuVarNum
  661. " m/foo/, m$foo$, m!foo!, etc
  662. syn region rakuMatch
  663. \ matchgroup=rakuQuote
  664. \ start=+\z([/!$,|`"]\)+
  665. \ skip="\\\z1"
  666. \ end="\z1"
  667. \ contained
  668. \ contains=@rakuRegexen,rakuVariable,rakuVarNum
  669. " m<foo>, m«foo», m{foo}, etc
  670. for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims
  671. exec "syn region rakuMatch matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuRegexen,@rakuVariables"
  672. endfor
  673. unlet s:name s:start_delim s:end_delim s:end_group s:skip
  674. " Substitutions
  675. " s/foo//, s$foo$$, s!foo!!, etc
  676. syn region rakuSubstitution
  677. \ matchgroup=rakuQuote
  678. \ start=+\z([/!$,|`"]\)+
  679. \ skip="\\\z1"
  680. \ end="\z1"me=e-1
  681. \ contained
  682. \ contains=@rakuRegexen,rakuVariable,rakuVarNum
  683. \ nextgroup=rakuReplacement
  684. syn region rakuReplacement
  685. \ matchgroup=rakuQuote
  686. \ start="\z(.\)"
  687. \ skip="\\\z1"
  688. \ end="\z1"
  689. \ contained
  690. \ contains=@rakuInterp_qq
  691. " s<foo><bar>, s«foo»«bar», s{foo}{bar}, etc
  692. for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims
  693. exec "syn region rakuSubstitution matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuRegexen,@rakuVariables nextgroup=rakuRepl".s:name
  694. exec "syn region rakuRepl".s:name." matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuInterp_qq"
  695. endfor
  696. unlet s:name s:start_delim s:end_delim s:end_group s:skip
  697. " Transliteration
  698. " tr/foo/bar/, tr|foo|bar, etc
  699. syn region rakuTransliteration
  700. \ matchgroup=rakuQuote
  701. \ start=+\z([/!$,|`"]\)+
  702. \ skip="\\\z1"
  703. \ end="\z1"me=e-1
  704. \ contained
  705. \ contains=rakuRxRange
  706. \ nextgroup=rakuTransRepl
  707. syn region rakuTransRepl
  708. \ matchgroup=rakuQuote
  709. \ start="\z(.\)"
  710. \ skip="\\\z1"
  711. \ end="\z1"
  712. \ contained
  713. \ contains=@rakuInterp_qq,rakuRxRange
  714. " tr<foo><bar>, tr«foo»«bar», tr{foo}{bar}, etc
  715. for [s:name, s:start_delim, s:end_delim, s:end_group, s:skip] in s:bracketing_delims
  716. exec "syn region rakuTransliteration matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=rakuRxRange nextgroup=rakuTransRepl".s:name
  717. exec "syn region rakuTransRepl".s:name." matchgroup=rakuQuote start=\"".s:start_delim."\" skip=\"".s:skip."\" end=\"".s:end_delim."\" contained keepend contains=@rakuInterp_qq,rakuRxRange"
  718. endfor
  719. unlet s:name s:start_delim s:end_delim s:end_group s:skip s:bracketing_delims
  720. if exists("raku_perl5_regexes") || exists("raku_extended_all")
  721. " Perl 5 regex regions
  722. syn cluster rakuRegexP5Base
  723. \ add=rakuRxP5Escape
  724. \ add=rakuRxP5Oct
  725. \ add=rakuRxP5Hex
  726. \ add=rakuRxP5EscMeta
  727. \ add=rakuRxP5CodePoint
  728. \ add=rakuRxP5Prop
  729. " normal regex stuff
  730. syn cluster rakuRegexP5
  731. \ add=@rakuRegexP5Base
  732. \ add=rakuRxP5Quantifier
  733. \ add=rakuRxP5Meta
  734. \ add=rakuRxP5QuoteMeta
  735. \ add=rakuRxP5ParenMod
  736. \ add=rakuRxP5Verb
  737. \ add=rakuRxP5Count
  738. \ add=rakuRxP5Named
  739. \ add=rakuRxP5ReadRef
  740. \ add=rakuRxP5WriteRef
  741. \ add=rakuRxP5CharClass
  742. \ add=rakuRxP5Anchor
  743. " inside character classes
  744. syn cluster rakuRegexP5Class
  745. \ add=@rakuRegexP5Base
  746. \ add=rakuRxP5Posix
  747. \ add=rakuRxP5Range
  748. syn match rakuRxP5Escape display contained "\\\S"
  749. syn match rakuRxP5CodePoint display contained "\\c\S\@=" nextgroup=rakuRxP5CPId
  750. syn match rakuRxP5CPId display contained "\S"
  751. syn match rakuRxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=rakuRxP5OctSeq
  752. syn match rakuRxP5OctSeq display contained "\o\{1,3}"
  753. syn match rakuRxP5Anchor display contained "[\^$]"
  754. syn match rakuRxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=rakuRxP5HexSeq
  755. syn match rakuRxP5HexSeq display contained "\x\{1,2}"
  756. syn region rakuRxP5HexSeq
  757. \ matchgroup=rakuRxP5Escape
  758. \ start="{"
  759. \ end="}"
  760. \ contained
  761. syn region rakuRxP5Named
  762. \ matchgroup=rakuRxP5Escape
  763. \ start="\%(\\N\)\@2<={"
  764. \ end="}"
  765. \ contained
  766. syn match rakuRxP5Quantifier display contained "\%([+*]\|(\@1<!?\)"
  767. syn match rakuRxP5ReadRef display contained "\\[1-9]\d\@!"
  768. syn match rakuRxP5ReadRef display contained "\[A-Za-z_\xC0-\xFF0-9]<\@=" nextgroup=rakuRxP5ReadRefId
  769. syn region rakuRxP5ReadRefId
  770. \ matchgroup=rakuRxP5Escape
  771. \ start="<"
  772. \ end=">"
  773. \ contained
  774. syn match rakuRxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=rakuRxP5WriteRefId
  775. syn match rakuRxP5WriteRefId display contained "\d\+"
  776. syn region rakuRxP5WriteRefId
  777. \ matchgroup=rakuRxP5Escape
  778. \ start="{"
  779. \ end="}"
  780. \ contained
  781. syn match rakuRxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=rakuRxP5PropId
  782. syn match rakuRxP5PropId display contained "\a"
  783. syn region rakuRxP5PropId
  784. \ matchgroup=rakuRxP5Escape
  785. \ start="{"
  786. \ end="}"
  787. \ contained
  788. syn match rakuRxP5Meta display contained "[(|).]"
  789. syn match rakuRxP5ParenMod display contained "(\@1<=?\@=" nextgroup=rakuRxP5Mod,rakuRxP5ModName,rakuRxP5Code
  790. syn match rakuRxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)"
  791. syn match rakuRxP5Mod display contained "?-\?[impsx]\+"
  792. syn match rakuRxP5Mod display contained "?\%([-+]\?\d\+\|R\)"
  793. syn match rakuRxP5Mod display contained "?(DEFINE)"
  794. syn match rakuRxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=rakuRxP5ModDef
  795. syn match rakuRxP5ModDef display contained "\h\w*"
  796. syn region rakuRxP5ModName
  797. \ matchgroup=rakuStringSpecial
  798. \ start="?'"
  799. \ end="'"
  800. \ contained
  801. syn region rakuRxP5ModName
  802. \ matchgroup=rakuStringSpecial
  803. \ start="?P\?<"
  804. \ end=">"
  805. \ contained
  806. syn region rakuRxP5Code
  807. \ matchgroup=rakuStringSpecial
  808. \ start="??\?{"
  809. \ end="})\@="
  810. \ contained
  811. \ contains=TOP
  812. syn match rakuRxP5EscMeta display contained "\\[?*.{}()[\]|\^$]"
  813. syn match rakuRxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=rakuRxP5CountId
  814. syn region rakuRxP5CountId
  815. \ matchgroup=rakuRxP5Escape
  816. \ start="{"
  817. \ end="}"
  818. \ contained
  819. syn match rakuRxP5Verb display contained "(\@1<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)"
  820. syn region rakuRxP5QuoteMeta
  821. \ matchgroup=rakuRxP5Escape
  822. \ start="\\Q"
  823. \ end="\\E"
  824. \ contained
  825. \ contains=@rakuVariables,rakuEscBackSlash
  826. syn region rakuRxP5CharClass
  827. \ matchgroup=rakuStringSpecial
  828. \ start="\[\^\?"
  829. \ skip="\\]"
  830. \ end="]"
  831. \ contained
  832. \ contains=@rakuRegexP5Class
  833. syn region rakuRxP5Posix
  834. \ matchgroup=rakuRxP5Escape
  835. \ start="\[:"
  836. \ end=":]"
  837. \ contained
  838. syn match rakuRxP5Range display contained "-"
  839. " m:P5//
  840. syn region rakuMatch
  841. \ matchgroup=rakuQuote
  842. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=/"
  843. \ skip="\\/"
  844. \ end="/"
  845. \ contains=@rakuRegexP5,rakuVariable,rakuVarExclam,rakuVarMatch,rakuVarNum
  846. " m:P5!!
  847. syn region rakuMatch
  848. \ matchgroup=rakuQuote
  849. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=!"
  850. \ skip="\\!"
  851. \ end="!"
  852. \ contains=@rakuRegexP5,rakuVariable,rakuVarSlash,rakuVarMatch,rakuVarNum
  853. " m:P5$$, m:P5||, etc
  854. syn region rakuMatch
  855. \ matchgroup=rakuQuote
  856. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=\z([\"'`|,$]\)"
  857. \ skip="\\\z1"
  858. \ end="\z1"
  859. \ contains=@rakuRegexP5,@rakuVariables
  860. " m:P5 ()
  861. syn region rakuMatch
  862. \ matchgroup=rakuQuote
  863. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s\+\)\@<=()\@!"
  864. \ skip="\\)"
  865. \ end=")"
  866. \ contains=@rakuRegexP5,@rakuVariables
  867. " m:P5[]
  868. syn region rakuMatch
  869. \ matchgroup=rakuQuote
  870. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=[]\@!"
  871. \ skip="\\]"
  872. \ end="]"
  873. \ contains=@rakuRegexP5,@rakuVariables
  874. " m:P5{}
  875. syn region rakuMatch
  876. \ matchgroup=rakuQuote
  877. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<={}\@!"
  878. \ skip="\\}"
  879. \ end="}"
  880. \ contains=@rakuRegexP5,rakuVariables
  881. " m:P5<>
  882. syn region rakuMatch
  883. \ matchgroup=rakuQuote
  884. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=<>\@!"
  885. \ skip="\\>"
  886. \ end=">"
  887. \ contains=@rakuRegexP5,rakuVariables
  888. " m:P5«»
  889. syn region rakuMatch
  890. \ matchgroup=rakuQuote
  891. \ start="\%(\%(::\|[$@%&][.!^:*?]\?\|\.\)\@2<!\<m\s*:P\%(erl\)\?5\s*\)\@<=«»\@!"
  892. \ skip="\\»"
  893. \ end="»"
  894. \ contains=@rakuRegexP5,rakuVariables
  895. endif
  896. " Comments
  897. syn match rakuAttention display "\<\%(ACHTUNG\|ATTN\|ATTENTION\|FIXME\|NB\|TODO\|TBD\|WTF\|XXX\|NOTE\)" contained
  898. " normal end-of-line comment
  899. syn match rakuComment display "#.*" contains=rakuAttention
  900. " Multiline comments. Arbitrary numbers of opening brackets are allowed,
  901. " but we only define regions for 1 to 3
  902. syn region rakuBracketComment
  903. \ start="#[`|=]("
  904. \ skip="([^)]*)"
  905. \ end=")"
  906. \ contains=rakuAttention,rakuBracketComment
  907. syn region rakuBracketComment
  908. \ start="#[`|=]\["
  909. \ skip="\[[^\]]*]"
  910. \ end="]"
  911. \ contains=rakuAttention,rakuBracketComment
  912. syn region rakuBracketComment
  913. \ start="#[`|=]{"
  914. \ skip="{[^}]*}"
  915. \ end="}"
  916. \ contains=rakuAttention,rakuBracketComment
  917. syn region rakuBracketComment
  918. \ start="#[`|=]<"
  919. \ skip="<[^>]*>"
  920. \ end=">"
  921. \ contains=rakuAttention,rakuBracketComment
  922. syn region rakuBracketComment
  923. \ start="#[`|=]«"
  924. \ skip="«[^»]*»"
  925. \ end="»"
  926. \ contains=rakuAttention,rakuBracketComment
  927. " Comments with double and triple delimiters
  928. syn region rakuBracketComment
  929. \ matchgroup=rakuBracketComment
  930. \ start="#[`|=](("
  931. \ skip="((\%([^)\|))\@!]\)*))"
  932. \ end="))"
  933. \ contains=rakuAttention,rakuBracketComment
  934. syn region rakuBracketComment
  935. \ matchgroup=rakuBracketComment
  936. \ start="#[`|=]((("
  937. \ skip="(((\%([^)]\|)\%())\)\@!\)*)))"
  938. \ end=")))"
  939. \ contains=rakuAttention,rakuBracketComment
  940. syn region rakuBracketComment
  941. \ matchgroup=rakuBracketComment
  942. \ start="#[`|=]\[\["
  943. \ skip="\[\[\%([^\]]\|]]\@!\)*]]"
  944. \ end="]]"
  945. \ contains=rakuAttention,rakuBracketComment
  946. syn region rakuBracketComment
  947. \ matchgroup=rakuBracketComment
  948. \ start="#[`|=]\[\[\["
  949. \ skip="\[\[\[\%([^\]]\|]\%(]]\)\@!\)*]]]"
  950. \ end="]]]"
  951. \ contains=rakuAttention,rakuBracketComment
  952. syn region rakuBracketComment
  953. \ matchgroup=rakuBracketComment
  954. \ start="#[`|=]{{"
  955. \ skip="{{\%([^}]\|}}\@!\)*}}"
  956. \ end="}}"
  957. \ contains=rakuAttention,rakuBracketComment
  958. syn region rakuBracketComment
  959. \ matchgroup=rakuBracketComment
  960. \ start="#[`|=]{{{"
  961. \ skip="{{{\%([^}]\|}\%(}}\)\@!\)*}}}"
  962. \ end="}}}"
  963. \ contains=rakuAttention,rakuBracketComment
  964. syn region rakuBracketComment
  965. \ matchgroup=rakuBracketComment
  966. \ start="#[`|=]<<"
  967. \ skip="<<\%([^>]\|>>\@!\)*>>"
  968. \ end=">>"
  969. \ contains=rakuAttention,rakuBracketComment
  970. syn region rakuBracketComment
  971. \ matchgroup=rakuBracketComment
  972. \ start="#[`|=]<<<"
  973. \ skip="<<<\%([^>]\|>\%(>>\)\@!\)*>>>"
  974. \ end=">>>"
  975. \ contains=rakuAttention,rakuBracketComment
  976. syn region rakuBracketComment
  977. \ matchgroup=rakuBracketComment
  978. \ start="#[`|=]««"
  979. \ skip="««\%([^»]\|»»\@!\)*»»"
  980. \ end="»»"
  981. \ contains=rakuAttention,rakuBracketComment
  982. syn region rakuBracketComment
  983. \ matchgroup=rakuBracketComment
  984. \ start="#[`|=]«««"
  985. \ skip="«««\%([^»]\|»\%(»»\)\@!\)*»»»"
  986. \ end="»»»"
  987. \ contains=rakuAttention,rakuBracketComment
  988. syn match rakuShebang display "\%^#!.*"
  989. " => autoquoting
  990. syn match rakuStringAuto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\%(p5\)\@2<![RSXZ]\@1<!=>"
  991. syn match rakuStringAuto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\ze\s\+=>"
  992. syn match rakuStringAuto display "\.\@1<!\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)p5\ze=>"
  993. " Pod
  994. " Abbreviated blocks (implicit code forbidden)
  995. syn region rakuPodAbbrRegion
  996. \ matchgroup=rakuPodPrefix
  997. \ start="^\s*\zs=\ze\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  998. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  999. \ contains=rakuPodAbbrNoCodeType
  1000. \ keepend
  1001. syn region rakuPodAbbrNoCodeType
  1002. \ matchgroup=rakuPodType
  1003. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1004. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1005. \ contained
  1006. \ contains=rakuPodName,rakuPodAbbrNoCode
  1007. syn match rakuPodName contained ".\+" contains=@rakuPodFormat
  1008. syn match rakuPodComment contained ".\+"
  1009. syn region rakuPodAbbrNoCode
  1010. \ start="^"
  1011. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1012. \ contained
  1013. \ contains=@rakuPodFormat
  1014. " Abbreviated blocks (everything is code)
  1015. syn region rakuPodAbbrRegion
  1016. \ matchgroup=rakuPodPrefix
  1017. \ start="^\s*\zs=\zecode\>"
  1018. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1019. \ contains=rakuPodAbbrCodeType
  1020. \ keepend
  1021. syn region rakuPodAbbrCodeType
  1022. \ matchgroup=rakuPodType
  1023. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1024. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1025. \ contained
  1026. \ contains=rakuPodName,rakuPodAbbrCode
  1027. syn region rakuPodAbbrCode
  1028. \ start="^"
  1029. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1030. \ contained
  1031. " Abbreviated blocks (everything is a comment)
  1032. syn region rakuPodAbbrRegion
  1033. \ matchgroup=rakuPodPrefix
  1034. \ start="^=\zecomment\>"
  1035. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1036. \ contains=rakuPodAbbrCommentType
  1037. \ keepend
  1038. syn region rakuPodAbbrCommentType
  1039. \ matchgroup=rakuPodType
  1040. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1041. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1042. \ contained
  1043. \ contains=rakuPodComment,rakuPodAbbrNoCode
  1044. " Abbreviated blocks (implicit code allowed)
  1045. syn region rakuPodAbbrRegion
  1046. \ matchgroup=rakuPodPrefix
  1047. \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>"
  1048. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1049. \ contains=rakuPodAbbrType
  1050. \ keepend
  1051. syn region rakuPodAbbrType
  1052. \ matchgroup=rakuPodType
  1053. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1054. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1055. \ contained
  1056. \ contains=rakuPodName,rakuPodAbbr
  1057. syn region rakuPodAbbr
  1058. \ start="^"
  1059. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1060. \ contained
  1061. \ contains=@rakuPodFormat,rakuPodImplicitCode
  1062. " Abbreviated block to end-of-file
  1063. syn region rakuPodAbbrRegion
  1064. \ matchgroup=rakuPodPrefix
  1065. \ start="^=\zeEND\>"
  1066. \ end="\%$"
  1067. \ contains=rakuPodAbbrEOFType
  1068. \ keepend
  1069. syn region rakuPodAbbrEOFType
  1070. \ matchgroup=rakuPodType
  1071. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1072. \ end="\%$"
  1073. \ contained
  1074. \ contains=rakuPodName,rakuPodAbbrEOF
  1075. syn region rakuPodAbbrEOF
  1076. \ start="^"
  1077. \ end="\%$"
  1078. \ contained
  1079. \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode
  1080. " Directives
  1081. syn region rakuPodDirectRegion
  1082. \ matchgroup=rakuPodPrefix
  1083. \ start="^=\%(config\|use\)\>"
  1084. \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)"
  1085. \ contains=rakuPodDirectArgRegion
  1086. \ keepend
  1087. syn region rakuPodDirectArgRegion
  1088. \ matchgroup=rakuPodType
  1089. \ start="\S\+"
  1090. \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)"
  1091. \ contained
  1092. \ contains=rakuPodDirectConfigRegion
  1093. syn region rakuPodDirectConfigRegion
  1094. \ start=""
  1095. \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)"
  1096. \ contained
  1097. \ contains=@rakuPodConfig
  1098. " =encoding is a special directive
  1099. syn region rakuPodDirectRegion
  1100. \ matchgroup=rakuPodPrefix
  1101. \ start="^=encoding\>"
  1102. \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)"
  1103. \ contains=rakuPodEncodingArgRegion
  1104. \ keepend
  1105. syn region rakuPodEncodingArgRegion
  1106. \ matchgroup=rakuPodName
  1107. \ start="\S\+"
  1108. \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)"
  1109. \ contained
  1110. " Paragraph blocks (implicit code forbidden)
  1111. syn region rakuPodParaRegion
  1112. \ matchgroup=rakuPodPrefix
  1113. \ start="^\s*\zs=for\>"
  1114. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1115. \ contains=rakuPodParaNoCodeTypeRegion
  1116. \ keepend extend
  1117. syn region rakuPodParaNoCodeTypeRegion
  1118. \ matchgroup=rakuPodType
  1119. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1120. \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1121. \ contained
  1122. \ contains=rakuPodParaNoCode,rakuPodParaConfigRegion
  1123. syn region rakuPodParaConfigRegion
  1124. \ start=""
  1125. \ end="^\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\@1<!\)"
  1126. \ contained
  1127. \ contains=@rakuPodConfig
  1128. syn region rakuPodParaNoCode
  1129. \ start="^[^=]"
  1130. \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1131. \ contained
  1132. \ contains=@rakuPodFormat
  1133. " Paragraph blocks (everything is code)
  1134. syn region rakuPodParaRegion
  1135. \ matchgroup=rakuPodPrefix
  1136. \ start="^\s*\zs=for\>\ze\s*code\>"
  1137. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1138. \ contains=rakuPodParaCodeTypeRegion
  1139. \ keepend extend
  1140. syn region rakuPodParaCodeTypeRegion
  1141. \ matchgroup=rakuPodType
  1142. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1143. \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1144. \ contained
  1145. \ contains=rakuPodParaCode,rakuPodParaConfigRegion
  1146. syn region rakuPodParaCode
  1147. \ start="^[^=]"
  1148. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1149. \ contained
  1150. " Paragraph blocks (implicit code allowed)
  1151. syn region rakuPodParaRegion
  1152. \ matchgroup=rakuPodPrefix
  1153. \ start="^\s*\zs=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>"
  1154. \ end="^\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1155. \ contains=rakuPodParaTypeRegion
  1156. \ keepend extend
  1157. syn region rakuPodParaTypeRegion
  1158. \ matchgroup=rakuPodType
  1159. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1160. \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1161. \ contained
  1162. \ contains=rakuPodPara,rakuPodParaConfigRegion
  1163. syn region rakuPodPara
  1164. \ start="^[^=]"
  1165. \ end="^\s*\zs\ze\%(\s*$\|=[A-Za-z_\xC0-\xFF]\)"
  1166. \ contained
  1167. \ contains=@rakuPodFormat,rakuPodImplicitCode
  1168. " Paragraph block to end-of-file
  1169. syn region rakuPodParaRegion
  1170. \ matchgroup=rakuPodPrefix
  1171. \ start="^=for\>\ze\s\+END\>"
  1172. \ end="\%$"
  1173. \ contains=rakuPodParaEOFTypeRegion
  1174. \ keepend extend
  1175. syn region rakuPodParaEOFTypeRegion
  1176. \ matchgroup=rakuPodType
  1177. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1178. \ end="\%$"
  1179. \ contained
  1180. \ contains=rakuPodParaEOF,rakuPodParaConfigRegion
  1181. syn region rakuPodParaEOF
  1182. \ start="^[^=]"
  1183. \ end="\%$"
  1184. \ contained
  1185. \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode
  1186. " Delimited blocks (implicit code forbidden)
  1187. syn region rakuPodDelimRegion
  1188. \ matchgroup=rakuPodPrefix
  1189. \ start="^\z(\s*\)\zs=begin\>"
  1190. \ end="^\z1\zs=end\>"
  1191. \ contains=rakuPodDelimNoCodeTypeRegion
  1192. \ keepend extend skipwhite
  1193. \ nextgroup=rakuPodType
  1194. syn region rakuPodDelimNoCodeTypeRegion
  1195. \ matchgroup=rakuPodType
  1196. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1197. \ end="^\s*\zs\ze=end\>"
  1198. \ contained
  1199. \ contains=rakuPodDelimNoCode,rakuPodDelimConfigRegion
  1200. syn region rakuPodDelimConfigRegion
  1201. \ start=""
  1202. \ end="^\s*\zs\ze\%([^=]\|=[A-Za-z_\xC0-\xFF]\|\s*$\)"
  1203. \ contained
  1204. \ contains=@rakuPodConfig
  1205. syn region rakuPodDelimNoCode
  1206. \ start="^"
  1207. \ end="^\s*\zs\ze=end\>"
  1208. \ contained
  1209. \ contains=@rakuPodNestedBlocks,@rakuPodFormat
  1210. " Delimited blocks (everything is code)
  1211. syn region rakuPodDelimRegion
  1212. \ matchgroup=rakuPodPrefix
  1213. \ start="^\z(\s*\)\zs=begin\>\ze\s*code\>"
  1214. \ end="^\z1\zs=end\>"
  1215. \ contains=rakuPodDelimCodeTypeRegion
  1216. \ keepend extend skipwhite
  1217. \ nextgroup=rakuPodType
  1218. syn region rakuPodDelimCodeTypeRegion
  1219. \ matchgroup=rakuPodType
  1220. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1221. \ end="^\s*\zs\ze=end\>"
  1222. \ contained
  1223. \ contains=rakuPodDelimCode,rakuPodDelimConfigRegion
  1224. syn region rakuPodDelimCode
  1225. \ start="^"
  1226. \ end="^\s*\zs\ze=end\>"
  1227. \ contained
  1228. \ contains=@rakuPodNestedBlocks
  1229. " Delimited blocks (implicit code allowed)
  1230. syn region rakuPodDelimRegion
  1231. \ matchgroup=rakuPodPrefix
  1232. \ start="^\z(\s*\)\zs=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>"
  1233. \ end="^\z1\zs=end\>"
  1234. \ contains=rakuPodDelimTypeRegion
  1235. \ keepend extend skipwhite
  1236. \ nextgroup=rakuPodType
  1237. syn region rakuPodDelimTypeRegion
  1238. \ matchgroup=rakuPodType
  1239. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1240. \ end="^\s*\zs\ze=end\>"
  1241. \ contained
  1242. \ contains=rakuPodDelim,rakuPodDelimConfigRegion
  1243. syn region rakuPodDelim
  1244. \ start="^"
  1245. \ end="^\s*\zs\ze=end\>"
  1246. \ contained
  1247. \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode
  1248. " Delimited block to end-of-file
  1249. syn region rakuPodDelimRegion
  1250. \ matchgroup=rakuPodPrefix
  1251. \ start="^=begin\>\ze\s\+END\>"
  1252. \ end="\%$"
  1253. \ extend
  1254. \ contains=rakuPodDelimEOFTypeRegion
  1255. syn region rakuPodDelimEOFTypeRegion
  1256. \ matchgroup=rakuPodType
  1257. \ start="\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1258. \ end="\%$"
  1259. \ contained
  1260. \ contains=rakuPodDelimEOF,rakuPodDelimConfigRegion
  1261. syn region rakuPodDelimEOF
  1262. \ start="^"
  1263. \ end="\%$"
  1264. \ contained
  1265. \ contains=@rakuPodNestedBlocks,@rakuPodFormat,rakuPodImplicitCode
  1266. syn cluster rakuPodConfig
  1267. \ add=rakuPodConfigOperator
  1268. \ add=rakuPodExtraConfig
  1269. \ add=rakuStringAuto
  1270. \ add=rakuPodAutoQuote
  1271. \ add=rakuStringSQ
  1272. syn region rakuPodParens
  1273. \ start="("
  1274. \ end=")"
  1275. \ contained
  1276. \ contains=rakuNumber,rakuStringSQ
  1277. syn match rakuPodAutoQuote display contained "=>"
  1278. syn match rakuPodConfigOperator display contained ":!\?" nextgroup=rakuPodConfigOption
  1279. syn match rakuPodConfigOption display contained "[^[:space:](<]\+" nextgroup=rakuPodParens,rakuStringAngle
  1280. syn match rakuPodExtraConfig display contained "^="
  1281. syn match rakuPodVerticalBar display contained "|"
  1282. syn match rakuPodColon display contained ":"
  1283. syn match rakuPodSemicolon display contained ";"
  1284. syn match rakuPodComma display contained ","
  1285. syn match rakuPodImplicitCode display contained "^\s.*"
  1286. syn match rakuPodType display contained "\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)"
  1287. " These may appear inside delimited blocks
  1288. syn cluster rakuPodNestedBlocks
  1289. \ add=rakuPodAbbrRegion
  1290. \ add=rakuPodDirectRegion
  1291. \ add=rakuPodParaRegion
  1292. \ add=rakuPodDelimRegion
  1293. " Pod formatting codes
  1294. syn cluster rakuPodFormat
  1295. \ add=rakuPodFormatOne
  1296. \ add=rakuPodFormatTwo
  1297. \ add=rakuPodFormatThree
  1298. \ add=rakuPodFormatFrench
  1299. " Balanced angles found inside formatting codes. Ensures proper nesting.
  1300. syn region rakuPodFormatAnglesOne
  1301. \ matchgroup=rakuPodFormat
  1302. \ start="<"
  1303. \ skip="<[^>]*>"
  1304. \ end=">"
  1305. \ transparent contained
  1306. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne
  1307. syn region rakuPodFormatAnglesTwo
  1308. \ matchgroup=rakuPodFormat
  1309. \ start="<<"
  1310. \ skip="<<[^>]*>>"
  1311. \ end=">>"
  1312. \ transparent contained
  1313. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo
  1314. syn region rakuPodFormatAnglesThree
  1315. \ matchgroup=rakuPodFormat
  1316. \ start="<<<"
  1317. \ skip="<<<[^>]*>>>"
  1318. \ end=">>>"
  1319. \ transparent contained
  1320. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo,rakuPodFormatAnglesThree
  1321. syn region rakuPodFormatAnglesFrench
  1322. \ matchgroup=rakuPodFormat
  1323. \ start="«"
  1324. \ skip="«[^»]*»"
  1325. \ end="»"
  1326. \ transparent contained
  1327. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatAnglesOne,rakuPodFormatAnglesTwo,rakuPodFormatAnglesThree
  1328. " All formatting codes
  1329. syn region rakuPodFormatOne
  1330. \ matchgroup=rakuPodFormatCode
  1331. \ start="\u<"
  1332. \ skip="<[^>]*>"
  1333. \ end=">"
  1334. \ contained
  1335. \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne
  1336. syn region rakuPodFormatTwo
  1337. \ matchgroup=rakuPodFormatCode
  1338. \ start="\u<<"
  1339. \ skip="<<[^>]*>>"
  1340. \ end=">>"
  1341. \ contained
  1342. \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo
  1343. syn region rakuPodFormatThree
  1344. \ matchgroup=rakuPodFormatCode
  1345. \ start="\u<<<"
  1346. \ skip="<<<[^>]*>>>"
  1347. \ end=">>>"
  1348. \ contained
  1349. \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree
  1350. syn region rakuPodFormatFrench
  1351. \ matchgroup=rakuPodFormatCode
  1352. \ start="\u«"
  1353. \ skip="«[^»]*»"
  1354. \ end="»"
  1355. \ contained
  1356. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree
  1357. " C<> and V<> don't allow nested formatting formatting codes
  1358. syn region rakuPodFormatOne
  1359. \ matchgroup=rakuPodFormatCode
  1360. \ start="[CV]<"
  1361. \ skip="<[^>]*>"
  1362. \ end=">"
  1363. \ contained
  1364. \ contains=rakuPodFormatAnglesOne
  1365. syn region rakuPodFormatTwo
  1366. \ matchgroup=rakuPodFormatCode
  1367. \ start="[CV]<<"
  1368. \ skip="<<[^>]*>>"
  1369. \ end=">>"
  1370. \ contained
  1371. \ contains=rakuPodFormatAnglesTwo
  1372. syn region rakuPodFormatThree
  1373. \ matchgroup=rakuPodFormatCode
  1374. \ start="[CV]<<<"
  1375. \ skip="<<<[^>]*>>>"
  1376. \ end=">>>"
  1377. \ contained
  1378. \ contains=rakuPodFormatAnglesThree
  1379. syn region rakuPodFormatFrench
  1380. \ matchgroup=rakuPodFormatCode
  1381. \ start="[CV]«"
  1382. \ skip="«[^»]*»"
  1383. \ end="»"
  1384. \ contained
  1385. \ contains=rakuPodFormatAnglesFrench
  1386. " L<> can have a "|" separator
  1387. syn region rakuPodFormatOne
  1388. \ matchgroup=rakuPodFormatCode
  1389. \ start="L<"
  1390. \ skip="<[^>]*>"
  1391. \ end=">"
  1392. \ contained
  1393. \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar
  1394. syn region rakuPodFormatTwo
  1395. \ matchgroup=rakuPodFormatCode
  1396. \ start="L<<"
  1397. \ skip="<<[^>]*>>"
  1398. \ end=">>"
  1399. \ contained
  1400. \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar
  1401. syn region rakuPodFormatThree
  1402. \ matchgroup=rakuPodFormatCode
  1403. \ start="L<<<"
  1404. \ skip="<<<[^>]*>>>"
  1405. \ end=">>>"
  1406. \ contained
  1407. \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar
  1408. syn region rakuPodFormatFrench
  1409. \ matchgroup=rakuPodFormatCode
  1410. \ start="L«"
  1411. \ skip="«[^»]*»"
  1412. \ end="»"
  1413. \ contained
  1414. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar
  1415. " E<> can have a ";" separator
  1416. syn region rakuPodFormatOne
  1417. \ matchgroup=rakuPodFormatCode
  1418. \ start="E<"
  1419. \ skip="<[^>]*>"
  1420. \ end=">"
  1421. \ contained
  1422. \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodSemiColon
  1423. syn region rakuPodFormatTwo
  1424. \ matchgroup=rakuPodFormatCode
  1425. \ start="E<<"
  1426. \ skip="<<[^>]*>>"
  1427. \ end=">>"
  1428. \ contained
  1429. \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodSemiColon
  1430. syn region rakuPodFormatThree
  1431. \ matchgroup=rakuPodFormatCode
  1432. \ start="E<<<"
  1433. \ skip="<<<[^>]*>>>"
  1434. \ end=">>>"
  1435. \ contained
  1436. \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodSemiColon
  1437. syn region rakuPodFormatFrench
  1438. \ matchgroup=rakuPodFormatCode
  1439. \ start="E«"
  1440. \ skip="«[^»]*»"
  1441. \ end="»"
  1442. \ contained
  1443. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodSemiColon
  1444. " M<> can have a ":" separator
  1445. syn region rakuPodFormatOne
  1446. \ matchgroup=rakuPodFormatCode
  1447. \ start="M<"
  1448. \ skip="<[^>]*>"
  1449. \ end=">"
  1450. \ contained
  1451. \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodColon
  1452. syn region rakuPodFormatTwo
  1453. \ matchgroup=rakuPodFormatCode
  1454. \ start="M<<"
  1455. \ skip="<<[^>]*>>"
  1456. \ end=">>"
  1457. \ contained
  1458. \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodColon
  1459. syn region rakuPodFormatThree
  1460. \ matchgroup=rakuPodFormatCode
  1461. \ start="M<<<"
  1462. \ skip="<<<[^>]*>>>"
  1463. \ end=">>>"
  1464. \ contained
  1465. \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodColon
  1466. syn region rakuPodFormatFrench
  1467. \ matchgroup=rakuPodFormatCode
  1468. \ start="M«"
  1469. \ skip="«[^»]*»"
  1470. \ end="»"
  1471. \ contained
  1472. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodColon
  1473. " D<> can have "|" and ";" separators
  1474. syn region rakuPodFormatOne
  1475. \ matchgroup=rakuPodFormatCode
  1476. \ start="D<"
  1477. \ skip="<[^>]*>"
  1478. \ end=">"
  1479. \ contained
  1480. \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar,rakuPodSemiColon
  1481. syn region rakuPodFormatTwo
  1482. \ matchgroup=rakuPodFormatCode
  1483. \ start="D<<"
  1484. \ skip="<<[^>]*>>"
  1485. \ end=">>"
  1486. \ contained
  1487. \ contains=rakuPodFormatAngleTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar,rakuPodSemiColon
  1488. syn region rakuPodFormatThree
  1489. \ matchgroup=rakuPodFormatCode
  1490. \ start="D<<<"
  1491. \ skip="<<<[^>]*>>>"
  1492. \ end=">>>"
  1493. \ contained
  1494. \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon
  1495. syn region rakuPodFormatFrench
  1496. \ matchgroup=rakuPodFormatCode
  1497. \ start="D«"
  1498. \ skip="«[^»]*»"
  1499. \ end="»"
  1500. \ contained
  1501. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon
  1502. " X<> can have "|", "," and ";" separators
  1503. syn region rakuPodFormatOne
  1504. \ matchgroup=rakuPodFormatCode
  1505. \ start="X<"
  1506. \ skip="<[^>]*>"
  1507. \ end=">"
  1508. \ contained
  1509. \ contains=rakuPodFormatAnglesOne,rakuPodFormatFrench,rakuPodFormatOne,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma
  1510. syn region rakuPodFormatTwo
  1511. \ matchgroup=rakuPodFormatCode
  1512. \ start="X<<"
  1513. \ skip="<<[^>]*>>"
  1514. \ end=">>"
  1515. \ contained
  1516. \ contains=rakuPodFormatAnglesTwo,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma
  1517. syn region rakuPodFormatThree
  1518. \ matchgroup=rakuPodFormatCode
  1519. \ start="X<<<"
  1520. \ skip="<<<[^>]*>>>"
  1521. \ end=">>>"
  1522. \ contained
  1523. \ contains=rakuPodFormatAnglesThree,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma
  1524. syn region rakuPodFormatFrench
  1525. \ matchgroup=rakuPodFormatCode
  1526. \ start="X«"
  1527. \ skip="«[^»]*»"
  1528. \ end="»"
  1529. \ contained
  1530. \ contains=rakuPodFormatAnglesFrench,rakuPodFormatFrench,rakuPodFormatOne,rakuPodFormatTwo,rakuPodFormatThree,rakuPodVerticalBar,rakuPodSemiColon,rakuPodComma
  1531. " Define the default highlighting.
  1532. " For version 5.7 and earlier: only when not done already
  1533. " For version 5.8 and later: only when an item doesn't have highlighting yet
  1534. if version >= 508 || !exists("did_raku_syntax_inits")
  1535. if version < 508
  1536. let did_raku_syntax_inits = 1
  1537. command -nargs=+ HiLink hi link <args>
  1538. else
  1539. command -nargs=+ HiLink hi def link <args>
  1540. endif
  1541. HiLink rakuEscOctOld rakuError
  1542. HiLink rakuPackageTwigil rakuTwigil
  1543. HiLink rakuStringAngle rakuString
  1544. HiLink rakuStringAngleFixed rakuString
  1545. HiLink rakuStringFrench rakuString
  1546. HiLink rakuStringAngles rakuString
  1547. HiLink rakuStringSQ rakuString
  1548. HiLink rakuStringDQ rakuString
  1549. HiLink rakuStringQ rakuString
  1550. HiLink rakuStringQ_q rakuString
  1551. HiLink rakuStringQ_qww rakuString
  1552. HiLink rakuStringQ_qq rakuString
  1553. HiLink rakuStringQ_to rakuString
  1554. HiLink rakuStringQ_qto rakuString
  1555. HiLink rakuStringQ_qqto rakuString
  1556. HiLink rakuRxStringSQ rakuString
  1557. HiLink rakuRxStringDQ rakuString
  1558. HiLink rakuReplacement rakuString
  1559. HiLink rakuReplCurly rakuString
  1560. HiLink rakuReplAngle rakuString
  1561. HiLink rakuReplFrench rakuString
  1562. HiLink rakuReplBracket rakuString
  1563. HiLink rakuReplParen rakuString
  1564. HiLink rakuTransliteration rakuString
  1565. HiLink rakuTransRepl rakuString
  1566. HiLink rakuTransReplCurly rakuString
  1567. HiLink rakuTransReplAngle rakuString
  1568. HiLink rakuTransReplFrench rakuString
  1569. HiLink rakuTransReplBracket rakuString
  1570. HiLink rakuTransReplParen rakuString
  1571. HiLink rakuStringAuto rakuString
  1572. HiLink rakuKey rakuString
  1573. HiLink rakuMatch rakuString
  1574. HiLink rakuSubstitution rakuString
  1575. HiLink rakuMatchBare rakuString
  1576. HiLink rakuRegexBlock rakuString
  1577. HiLink rakuRxP5CharClass rakuString
  1578. HiLink rakuRxP5QuoteMeta rakuString
  1579. HiLink rakuRxCharClass rakuString
  1580. HiLink rakuRxQuoteWords rakuString
  1581. HiLink rakuReduceOp rakuOperator
  1582. HiLink rakuSetOp rakuOperator
  1583. HiLink rakuRSXZOp rakuOperator
  1584. HiLink rakuHyperOp rakuOperator
  1585. HiLink rakuPostHyperOp rakuOperator
  1586. HiLink rakuQuoteQ rakuQuote
  1587. HiLink rakuQuoteQ_q rakuQuote
  1588. HiLink rakuQuoteQ_qww rakuQuote
  1589. HiLink rakuQuoteQ_qq rakuQuote
  1590. HiLink rakuQuoteQ_to rakuQuote
  1591. HiLink rakuQuoteQ_qto rakuQuote
  1592. HiLink rakuQuoteQ_qqto rakuQuote
  1593. HiLink rakuQuoteQ_PIR rakuQuote
  1594. HiLink rakuMatchStart_m rakuQuote
  1595. HiLink rakuMatchStart_s rakuQuote
  1596. HiLink rakuMatchStart_tr rakuQuote
  1597. HiLink rakuBareSigil rakuVariable
  1598. HiLink rakuRxRange rakuStringSpecial
  1599. HiLink rakuRxAnchor rakuStringSpecial
  1600. HiLink rakuRxBoundary rakuStringSpecial
  1601. HiLink rakuRxP5Anchor rakuStringSpecial
  1602. HiLink rakuCodePoint rakuStringSpecial
  1603. HiLink rakuRxMeta rakuStringSpecial
  1604. HiLink rakuRxP5Range rakuStringSpecial
  1605. HiLink rakuRxP5CPId rakuStringSpecial
  1606. HiLink rakuRxP5Posix rakuStringSpecial
  1607. HiLink rakuRxP5Mod rakuStringSpecial
  1608. HiLink rakuRxP5HexSeq rakuStringSpecial
  1609. HiLink rakuRxP5OctSeq rakuStringSpecial
  1610. HiLink rakuRxP5WriteRefId rakuStringSpecial
  1611. HiLink rakuHexSequence rakuStringSpecial
  1612. HiLink rakuOctSequence rakuStringSpecial
  1613. HiLink rakuRxP5Named rakuStringSpecial
  1614. HiLink rakuRxP5PropId rakuStringSpecial
  1615. HiLink rakuRxP5Quantifier rakuStringSpecial
  1616. HiLink rakuRxP5CountId rakuStringSpecial
  1617. HiLink rakuRxP5Verb rakuStringSpecial
  1618. HiLink rakuRxAssertGroup rakuStringSpecial2
  1619. HiLink rakuEscape rakuStringSpecial2
  1620. HiLink rakuEscNull rakuStringSpecial2
  1621. HiLink rakuEscHash rakuStringSpecial2
  1622. HiLink rakuEscQQ rakuStringSpecial2
  1623. HiLink rakuEscQuote rakuStringSpecial2
  1624. HiLink rakuEscDoubleQuote rakuStringSpecial2
  1625. HiLink rakuEscBackTick rakuStringSpecial2
  1626. HiLink rakuEscForwardSlash rakuStringSpecial2
  1627. HiLink rakuEscVerticalBar rakuStringSpecial2
  1628. HiLink rakuEscExclamation rakuStringSpecial2
  1629. HiLink rakuEscDollar rakuStringSpecial2
  1630. HiLink rakuEscOpenCurly rakuStringSpecial2
  1631. HiLink rakuEscCloseCurly rakuStringSpecial2
  1632. HiLink rakuEscCloseBracket rakuStringSpecial2
  1633. HiLink rakuEscCloseAngle rakuStringSpecial2
  1634. HiLink rakuEscCloseFrench rakuStringSpecial2
  1635. HiLink rakuEscBackSlash rakuStringSpecial2
  1636. HiLink rakuEscCodePoint rakuStringSpecial2
  1637. HiLink rakuEscOct rakuStringSpecial2
  1638. HiLink rakuEscHex rakuStringSpecial2
  1639. HiLink rakuRxEscape rakuStringSpecial2
  1640. HiLink rakuRxCapture rakuStringSpecial2
  1641. HiLink rakuRxAlternation rakuStringSpecial2
  1642. HiLink rakuRxP5 rakuStringSpecial2
  1643. HiLink rakuRxP5ReadRef rakuStringSpecial2
  1644. HiLink rakuRxP5Oct rakuStringSpecial2
  1645. HiLink rakuRxP5Hex rakuStringSpecial2
  1646. HiLink rakuRxP5EscMeta rakuStringSpecial2
  1647. HiLink rakuRxP5Meta rakuStringSpecial2
  1648. HiLink rakuRxP5Escape rakuStringSpecial2
  1649. HiLink rakuRxP5CodePoint rakuStringSpecial2
  1650. HiLink rakuRxP5WriteRef rakuStringSpecial2
  1651. HiLink rakuRxP5Prop rakuStringSpecial2
  1652. HiLink rakuProperty Tag
  1653. HiLink rakuAttention Todo
  1654. HiLink rakuType Type
  1655. HiLink rakuError Error
  1656. HiLink rakuBlockLabel Label
  1657. HiLink rakuNormal Normal
  1658. HiLink rakuIdentifier Normal
  1659. HiLink rakuPackage Normal
  1660. HiLink rakuPackageScope Normal
  1661. HiLink rakuNumber Number
  1662. HiLink rakuOctNumber Number
  1663. HiLink rakuBinNumber Number
  1664. HiLink rakuHexNumber Number
  1665. HiLink rakuDecNumber Number
  1666. HiLink rakuString String
  1667. HiLink rakuRepeat Repeat
  1668. HiLink rakuPragma Keyword
  1669. HiLink rakuPreDeclare Keyword
  1670. HiLink rakuDeclare Keyword
  1671. HiLink rakuDeclareRegex Keyword
  1672. HiLink rakuVarStorage Special
  1673. HiLink rakuFlowControl Special
  1674. HiLink rakuOctBase Special
  1675. HiLink rakuBinBase Special
  1676. HiLink rakuHexBase Special
  1677. HiLink rakuDecBase Special
  1678. HiLink rakuTwigil Special
  1679. HiLink rakuStringSpecial2 Special
  1680. HiLink rakuVersion Special
  1681. HiLink rakuComment Comment
  1682. HiLink rakuBracketComment Comment
  1683. HiLink rakuInclude Include
  1684. HiLink rakuShebang PreProc
  1685. HiLink rakuClosureTrait PreProc
  1686. HiLink rakuOperator Operator
  1687. HiLink rakuContext Operator
  1688. HiLink rakuQuote Delimiter
  1689. HiLink rakuTypeConstraint PreCondit
  1690. HiLink rakuException Exception
  1691. HiLink rakuVariable Identifier
  1692. HiLink rakuVarSlash Identifier
  1693. HiLink rakuVarNum Identifier
  1694. HiLink rakuVarExclam Identifier
  1695. HiLink rakuVarMatch Identifier
  1696. HiLink rakuVarName Identifier
  1697. HiLink rakuMatchVar Identifier
  1698. HiLink rakuRxP5ReadRefId Identifier
  1699. HiLink rakuRxP5ModDef Identifier
  1700. HiLink rakuRxP5ModName Identifier
  1701. HiLink rakuConditional Conditional
  1702. HiLink rakuStringSpecial SpecialChar
  1703. HiLink rakuPodAbbr rakuPod
  1704. HiLink rakuPodAbbrEOF rakuPod
  1705. HiLink rakuPodAbbrNoCode rakuPod
  1706. HiLink rakuPodAbbrCode rakuPodCode
  1707. HiLink rakuPodPara rakuPod
  1708. HiLink rakuPodParaEOF rakuPod
  1709. HiLink rakuPodParaNoCode rakuPod
  1710. HiLink rakuPodParaCode rakuPodCode
  1711. HiLink rakuPodDelim rakuPod
  1712. HiLink rakuPodDelimEOF rakuPod
  1713. HiLink rakuPodDelimNoCode rakuPod
  1714. HiLink rakuPodDelimCode rakuPodCode
  1715. HiLink rakuPodImplicitCode rakuPodCode
  1716. HiLink rakuPodExtraConfig rakuPodPrefix
  1717. HiLink rakuPodVerticalBar rakuPodFormatCode
  1718. HiLink rakuPodColon rakuPodFormatCode
  1719. HiLink rakuPodSemicolon rakuPodFormatCode
  1720. HiLink rakuPodComma rakuPodFormatCode
  1721. HiLink rakuPodFormatOne rakuPodFormat
  1722. HiLink rakuPodFormatTwo rakuPodFormat
  1723. HiLink rakuPodFormatThree rakuPodFormat
  1724. HiLink rakuPodFormatFrench rakuPodFormat
  1725. HiLink rakuPodType Type
  1726. HiLink rakuPodConfigOption String
  1727. HiLink rakuPodCode PreProc
  1728. HiLink rakuPod Comment
  1729. HiLink rakuPodComment Comment
  1730. HiLink rakuPodAutoQuote Operator
  1731. HiLink rakuPodConfigOperator Operator
  1732. HiLink rakuPodPrefix Statement
  1733. HiLink rakuPodName Identifier
  1734. HiLink rakuPodFormatCode SpecialChar
  1735. HiLink rakuPodFormat SpecialComment
  1736. delcommand HiLink
  1737. endif
  1738. if exists("raku_fold") || exists("raku_extended_all")
  1739. setl foldmethod=syntax
  1740. syn region rakuBlockFold
  1741. \ start="^\z(\s*\)\%(my\|our\|augment\|multi\|proto\|only\)\?\s*\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\s\+\)\?\<\%(CATCH\|try\|ENTER\|LEAVE\|CHECK\|INIT\|BEGIN\|END\|KEEP\|UNDO\|PRE\|POST\|module\|package\|enum\|subset\|class\|sub\%(method\)\?\|multi\|method\|slang\|grammar\|regex\|token\|rule\)\>[^{]\+\%({\s*\%(#.*\)\?\)\?$"
  1742. \ end="^\z1}"
  1743. \ transparent fold keepend extend
  1744. endif
  1745. let b:current_syntax = "raku"
  1746. let &cpo = s:keepcpo
  1747. unlet s:keepcpo
  1748. " vim:ts=8:sts=4:sw=4:expandtab:ft=vim