You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

467 lines
21KB

  1. %YAML 1.2
  2. ---
  3. # http://www.sublimetext.com/docs/3/syntax.html
  4. name: PowerShell
  5. file_extensions:
  6. - ps1
  7. - psm1
  8. - psd1
  9. scope: source.powershell
  10. contexts:
  11. main:
  12. - match: "<#"
  13. captures:
  14. 0: punctuation.definition.comment.block.begin.powershell
  15. push:
  16. - meta_scope: comment.block.powershell
  17. - match: "#>"
  18. captures:
  19. 0: punctuation.definition.comment.block.end.powershell
  20. pop: true
  21. - include: commentEmbeddedDocs
  22. - match: '[2-6]>&1|>>|>|<<|<|>|>\||[1-6]>|[1-6]>>'
  23. scope: keyword.operator.redirection.powershell
  24. - include: commands
  25. - include: commentLine
  26. - include: variable
  27. - include: interpolatedStringContent
  28. - include: function
  29. - include: attribute
  30. - include: UsingDirective
  31. - include: type
  32. - include: hashtable
  33. - include: doubleQuotedString
  34. - include: scriptblock
  35. - include: doubleQuotedStringEscapes
  36. - match: (?<!')'
  37. captures:
  38. 0: punctuation.definition.string.begin.powershell
  39. push:
  40. - meta_scope: string.quoted.single.powershell
  41. - match: "'(?!')"
  42. captures:
  43. 0: punctuation.definition.string.end.powershell
  44. pop: true
  45. - match: "''"
  46. scope: constant.character.escape.powershell
  47. - match: \@"(?=$)
  48. push:
  49. - meta_scope: string.quoted.double.heredoc.powershell
  50. - match: ^"@
  51. pop: true
  52. - include: variableNoProperty
  53. - include: doubleQuotedStringEscapes
  54. - include: interpolation
  55. - match: \@'(?=$)
  56. push:
  57. - meta_scope: string.quoted.single.heredoc.powershell
  58. - match: ^'@
  59. pop: true
  60. - match: "''"
  61. scope: constant.character.escape.powershell
  62. - include: numericConstant
  63. - match: (@)(\()
  64. captures:
  65. 1: keyword.other.array.begin.powershell
  66. 2: punctuation.section.group.begin.powershell
  67. push:
  68. - meta_scope: meta.group.array-expression.powershell
  69. - match: \)
  70. captures:
  71. 0: punctuation.section.group.end.powershell
  72. pop: true
  73. - include: main
  74. - match: (\$)(\()
  75. comment: "TODO: move to repo; make recursive."
  76. captures:
  77. 1: punctuation.definition.variable.powershell
  78. 2: punctuation.section.group.begin.powershell
  79. push:
  80. - meta_scope: meta.group.complex.subexpression.powershell
  81. - match: \)
  82. captures:
  83. 0: punctuation.section.group.end.powershell
  84. pop: true
  85. - include: main
  86. - match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
  87. scope: support.function.powershell
  88. - match: (?<!\w|-|\.)((?i:begin|break|catch|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|from|if|in|inlinescript|parallel|param|process|return|sequence|switch|throw|trap|try|until|var|while)|%|\?)(?!\w)
  89. scope: keyword.control.powershell
  90. - match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
  91. scope: keyword.control.powershell
  92. - match: (?<!\w)(--%)(?!\w)
  93. comment: This should be moved to the repository at some point.
  94. captures:
  95. 1: keyword.control.powershell
  96. push:
  97. - match: $
  98. pop: true
  99. - match: .+
  100. scope: string.unquoted.powershell
  101. - match: (?<!\w)((?i:hidden|static))(?!\w)
  102. comment: This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.
  103. scope: storage.modifier.powershell
  104. - match: '(?<!\w|-)((?i:class)|%|\?)(?:\s)+((?:\p{L}|\d|_|-|)+)\b'
  105. comment: capture should be entity.name.type, but it doesn't provide a good color in the default schema.
  106. captures:
  107. 1: storage.type.powershell
  108. 2: entity.name.function
  109. - match: (?<!\w)-(?i:is(?:not)?|as)\b
  110. scope: keyword.operator.comparison.powershell
  111. - match: '(?<!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\p{L})'
  112. scope: keyword.operator.comparison.powershell
  113. - match: '(?<!\w)-(?i:join|split)(?!\p{L})|!'
  114. scope: keyword.operator.unary.powershell
  115. - match: '(?<!\w)-(?i:and|or|not|xor)(?!\p{L})|!'
  116. scope: keyword.operator.logical.powershell
  117. - match: '(?<!\w)-(?i:band|bor|bnot|bxor|shl|shr)(?!\p{L})'
  118. scope: keyword.operator.bitwise.powershell
  119. - match: '(?<!\w)-(?i:f)(?!\p{L})'
  120. scope: keyword.operator.string-format.powershell
  121. - match: "[+%*/-]?=|[+/*%-]"
  122. scope: keyword.operator.assignment.powershell
  123. - match: '\|{2}|&{2}|;'
  124. scope: punctuation.terminator.statement.powershell
  125. - match: '&|(?<!\w)\.(?= )|`|,|\|'
  126. scope: keyword.operator.other.powershell
  127. - match: (?<!\s|^)\.\.(?=\-?\d|\(|\$)
  128. comment: This is very imprecise, is there a syntax for 'must come after...'
  129. scope: keyword.operator.range.powershell
  130. RequiresDirective:
  131. - match: (?<=#)(?i:(requires))\s
  132. captures:
  133. 0: keyword.control.requires.powershell
  134. push:
  135. - meta_scope: meta.requires.powershell
  136. - match: $
  137. pop: true
  138. - match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
  139. scope: keyword.other.powershell
  140. - match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
  141. scope: variable.parameter.powershell
  142. - include: hashtable
  143. UsingDirective:
  144. - match: (?<!\w)(?i:(using))\s+(?i:(namespace|module))\s+(?i:((?:\w+(?:\.)?)+))
  145. captures:
  146. 1: keyword.control.using.powershell
  147. 2: keyword.other.powershell
  148. 3: variable.parameter.powershell
  149. attribute:
  150. - match: '(\[)\s*\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength)\b'
  151. captures:
  152. 1: punctuation.section.bracket.begin.powershell
  153. 2: support.function.attribute.powershell
  154. push:
  155. - meta_scope: meta.attribute.powershell
  156. - match: '(\])'
  157. captures:
  158. 1: punctuation.section.bracket.end.powershell
  159. pop: true
  160. - match: \(
  161. captures:
  162. 0: punctuation.section.group.begin.powershell
  163. push:
  164. - match: \)
  165. captures:
  166. 0: punctuation.section.group.end.powershell
  167. pop: true
  168. - include: variable
  169. - include: variableNoProperty
  170. - include: hashtable
  171. - include: scriptblock
  172. - include: doubleQuotedStringEscapes
  173. - include: doubleQuotedString
  174. - include: type
  175. - include: numericConstant
  176. - include: doubleQuotedString
  177. - include: main
  178. - match: (?i)\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|supportspaging|positionalbinding|helpuri|confirmimpact|helpmessage)\b(?:\s+)?(=)?
  179. captures:
  180. 1: variable.parameter.attribute.powershell
  181. 2: keyword.operator.assignment.powershell
  182. - match: (?<!')'
  183. captures:
  184. 0: punctuation.definition.string.begin.powershell
  185. push:
  186. - meta_scope: string.quoted.single.powershell
  187. - match: "'(?!')"
  188. captures:
  189. 0: punctuation.definition.string.end.powershell
  190. pop: true
  191. - match: "''"
  192. scope: constant.character.escape.powershell
  193. commands:
  194. - match: '(?:(\p{L}|\d|_|-|\\|\:)*\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b'
  195. comment: "Verb-Noun pattern:"
  196. scope: support.function.powershell
  197. - match: (?<!\w)(?i:foreach-object)(?!\w)
  198. comment: Builtin cmdlets with reserved verbs
  199. scope: support.function.powershell
  200. - match: (?<!\w)(?i:where-object)(?!\w)
  201. comment: Builtin cmdlets with reserved verbs
  202. scope: support.function.powershell
  203. - match: (?<!\w)(?i:sort-object)(?!\w)
  204. comment: Builtin cmdlets with reserved verbs
  205. scope: support.function.powershell
  206. - match: (?<!\w)(?i:tee-object)(?!\w)
  207. comment: Builtin cmdlets with reserved verbs
  208. scope: support.function.powershell
  209. commentEmbeddedDocs:
  210. - match: ^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))
  211. scope: comment.documentation.embedded.powershell
  212. captures:
  213. 1: constant.string.documentation.powershell
  214. 2: keyword.operator.documentation.powershell
  215. - match: '(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))'
  216. scope: comment.documentation.embedded.powershell
  217. captures:
  218. 1: constant.string.documentation.powershell
  219. 2: keyword.operator.documentation.powershell
  220. 3: keyword.operator.documentation.powershell
  221. commentLine:
  222. - match: '(?<![`\\-])#'
  223. captures:
  224. 0: punctuation.definition.comment.powershell
  225. push:
  226. - meta_scope: comment.line.powershell
  227. - match: $\n?
  228. captures:
  229. 0: punctuation.definition.comment.powershell
  230. pop: true
  231. - include: commentEmbeddedDocs
  232. - include: RequiresDirective
  233. doubleQuotedString:
  234. - match: (?<!(?<!`)")"
  235. captures:
  236. 0: punctuation.definition.string.begin.powershell
  237. push:
  238. - meta_scope: string.quoted.double.powershell
  239. - match: '"(?!")'
  240. captures:
  241. 0: punctuation.definition.string.end.powershell
  242. pop: true
  243. - match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
  244. - include: variableNoProperty
  245. - include: variable
  246. - include: doubleQuotedStringEscapes
  247. - include: interpolation
  248. - match: '`\s*$'
  249. scope: keyword.other.powershell
  250. doubleQuotedStringEscapes:
  251. - match: '`[0abnfrvt"''$`]'
  252. scope: constant.character.escape.powershell
  253. - match: '""'
  254. scope: constant.character.escape.powershell
  255. function:
  256. - match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
  257. captures:
  258. 0: meta.function.powershell
  259. 1: storage.type.powershell
  260. 2: storage.modifier.scope.powershell
  261. 3: entity.name.function.powershell
  262. push:
  263. - match: '(?=\{|\()'
  264. pop: true
  265. - include: commentLine
  266. hashtable:
  267. - match: '(@)(\{)'
  268. captures:
  269. 1: keyword.other.hashtable.begin.powershell
  270. 2: punctuation.section.braces.begin.powershell
  271. push:
  272. - meta_scope: meta.hashtable.powershell
  273. - match: '(\})'
  274. captures:
  275. 1: punctuation.section.braces.end.powershell
  276. pop: true
  277. - match: \b((?:\'|\")?)(\w+)((?:\'|\")?)(?:\s+)?(=)(?:\s+)?
  278. scope: meta.hashtable.assignment.powershell
  279. captures:
  280. 1: punctuation.definition.string.begin.powershell
  281. 2: variable.other.readwrite.powershell
  282. 3: punctuation.definition.string.end.powershell
  283. 4: keyword.operator.assignment.powershell
  284. - include: scriptblock
  285. - include: main
  286. interpolatedStringContent:
  287. - match: \(
  288. captures:
  289. 0: punctuation.section.group.begin.powershell
  290. push:
  291. - meta_content_scope: interpolated.simple.source.powershell
  292. - match: \)
  293. captures:
  294. 0: punctuation.section.group.end.powershell
  295. pop: true
  296. - include: main
  297. - include: interpolation
  298. - include: interpolatedStringContent
  299. interpolation:
  300. - match: (\$)(\()
  301. captures:
  302. 1: punctuation.definition.variable.powershell
  303. 2: punctuation.section.group.begin.powershell
  304. push:
  305. - meta_content_scope: interpolated.complex.source.powershell
  306. - match: \)
  307. captures:
  308. 0: punctuation.section.group.end.powershell
  309. pop: true
  310. - include: main
  311. - include: interpolation
  312. - include: interpolatedStringContent
  313. numericConstant:
  314. - match: '(?<!\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
  315. captures:
  316. 1: constant.numeric.hex.powershell
  317. 2: keyword.other.powershell
  318. - match: '(?<!\w)([-+]?(?:[0-9_]+)?\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b'
  319. captures:
  320. 1: constant.numeric.integer.powershell
  321. 2: keyword.other.powershell
  322. - match: '(?<!\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
  323. captures:
  324. 1: constant.numeric.octal.powershell
  325. 2: keyword.other.powershell
  326. - match: '(?<!\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b'
  327. captures:
  328. 1: constant.numeric.integer.powershell
  329. 2: keyword.other.powershell
  330. - match: '(?<!\w)([-+]?[0-9_]+\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b'
  331. captures:
  332. 1: constant.numeric.integer.powershell
  333. 2: keyword.other.powershell
  334. - match: '(?<!\w)([-+]?[0-9_]+[\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\b'
  335. captures:
  336. 1: constant.numeric.integer.powershell
  337. 2: keyword.other.powershell
  338. - match: '(?<!\w)([-+]?[0-9_]+[\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
  339. captures:
  340. 1: constant.numeric.integer.powershell
  341. 2: keyword.other.powershell
  342. scriptblock:
  343. - match: '\{'
  344. captures:
  345. 0: punctuation.section.braces.begin.powershell
  346. push:
  347. - meta_scope: meta.scriptblock.powershell
  348. - match: '\}'
  349. captures:
  350. 0: punctuation.section.braces.end.powershell
  351. pop: true
  352. - include: main
  353. type:
  354. - match: '\['
  355. captures:
  356. 0: punctuation.section.bracket.begin.powershell
  357. push:
  358. - match: '\]'
  359. captures:
  360. 0: punctuation.section.bracket.end.powershell
  361. pop: true
  362. - match: '(?!\d+|\.)(?:\p{L}|\p{N}|\.)+'
  363. scope: storage.type.powershell
  364. - include: main
  365. variable:
  366. - match: (\$)(?i:(False|Null|True))\b
  367. comment: These are special constants.
  368. captures:
  369. 0: constant.language.powershell
  370. 1: punctuation.definition.variable.powershell
  371. - match: '(\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\.(?:\p{L}|\d|_)+)*\b)?\b'
  372. comment: These are the other built-in constants.
  373. captures:
  374. 0: support.constant.variable.powershell
  375. 1: punctuation.definition.variable.powershell
  376. 3: variable.other.member.powershell
  377. - match: '(\$)(?i:(\$|\^|\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))((?:\.(?:\p{L}|\d|_)+)*\b)?\b'
  378. comment: Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant.
  379. captures:
  380. 0: support.constant.automatic.powershell
  381. 1: punctuation.definition.variable.powershell
  382. 3: variable.other.member.powershell
  383. - match: '(\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))((?:\.(?:\p{L}|\d|_)+)*\b)?\b'
  384. comment: Style preference variables as language variables so that they stand out.
  385. captures:
  386. 0: variable.language.powershell
  387. 1: punctuation.definition.variable.powershell
  388. 3: variable.other.member.powershell
  389. - match: '(?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))((?:\.(?:\p{L}|\d|_)+)*\b)?'
  390. captures:
  391. 0: variable.other.readwrite.powershell
  392. 1: punctuation.definition.variable.powershell
  393. 2: storage.modifier.scope.powershell
  394. 4: variable.other.member.powershell
  395. - match: '(?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_)+)*\b)?'
  396. captures:
  397. 0: variable.other.readwrite.powershell
  398. 1: punctuation.definition.variable.powershell
  399. 2: punctuation.section.braces.begin.powershell
  400. 3: storage.modifier.scope.powershell
  401. 5: punctuation.section.braces.end.powershell
  402. 6: variable.other.member.powershell
  403. - match: '(?i:(\$|@)((?:\p{L}|\d|_)+:)?((?:\p{L}|\d|_)+))((?:\.(?:\p{L}|\d|_)+)*\b)?'
  404. captures:
  405. 0: variable.other.readwrite.powershell
  406. 1: punctuation.definition.variable.powershell
  407. 2: support.variable.drive.powershell
  408. 4: variable.other.member.powershell
  409. - match: '(?i:(\$)(\{)((?:\p{L}|\d|_)+:)?([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_)+)*\b)?'
  410. captures:
  411. 0: variable.other.readwrite.powershell
  412. 1: punctuation.definition.variable.powershell
  413. 2: punctuation.section.braces.begin.powershell
  414. 3: support.variable.drive.powershell
  415. 5: punctuation.section.braces.end.powershell
  416. 6: variable.other.member.powershell
  417. variableNoProperty:
  418. - match: (\$)(?i:(False|Null|True))\b
  419. comment: These are special constants.
  420. captures:
  421. 0: constant.language.powershell
  422. 1: punctuation.definition.variable.powershell
  423. - match: (\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))\b
  424. comment: These are the other built-in constants.
  425. captures:
  426. 0: support.constant.variable.powershell
  427. 1: punctuation.definition.variable.powershell
  428. 3: variable.other.member.powershell
  429. - match: (\$)(?i:(\$|\^|\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))\b
  430. comment: Automatic variables are not constants, but they are read-only...
  431. captures:
  432. 0: support.variable.automatic.powershell
  433. 1: punctuation.definition.variable.powershell
  434. 3: variable.other.member.powershell
  435. - match: (\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))\b
  436. comment: Style preference variables as language variables so that they stand out.
  437. captures:
  438. 0: variable.language.powershell
  439. 1: punctuation.definition.variable.powershell
  440. 3: variable.other.member.powershell
  441. - match: '(?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))'
  442. captures:
  443. 0: variable.other.readwrite.powershell
  444. 1: punctuation.definition.variable.powershell
  445. 2: storage.modifier.scope.powershell
  446. 4: variable.other.member.powershell
  447. - match: '(?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\}))'
  448. captures:
  449. 0: variable.other.readwrite.powershell
  450. 1: punctuation.definition.variable.powershell
  451. 2: storage.modifier.scope.powershell
  452. 4: keyword.other.powershell
  453. 5: variable.other.member.powershell
  454. - match: '(?i:(\$)((?:\p{L}|\d|_)+:)?((?:\p{L}|\d|_)+))'
  455. captures:
  456. 0: variable.other.readwrite.powershell
  457. 1: punctuation.definition.variable.powershell
  458. 2: support.variable.drive.powershell
  459. 4: variable.other.member.powershell
  460. - match: '(?i:(\$)(\{)((?:\p{L}|\d|_)+:)?([^}]*[^}`])(\}))'
  461. captures:
  462. 0: variable.other.readwrite.powershell
  463. 1: punctuation.definition.variable.powershell
  464. 2: punctuation.section.braces.begin
  465. 3: support.variable.drive.powershell
  466. 5: punctuation.section.braces.end