on master help sign in
Bump assets/syntaxes/02_Extra/PowerShell from `4a0a076` to `742f0b5` (#1935)

* Bump assets/syntaxes/02_Extra/PowerShell from `4a0a076` to `742f0b5` Bumps [assets/syntaxes/02_Extra/PowerShell](https://github.com/PowerShell/EditorSyntax) from `4a0a076` to `742f0b5`. - [Release notes](https://github.com/PowerShell/EditorSyntax/releases) - [Commits](https://github.com/PowerShell/EditorSyntax/compare/4a0a076661d26473cac71b9a17e6a759e9b1c643...742f0b5d4b60f5930c0b47fcc1f646860521296e) --- updated-dependencies: - dependency-name: assets/syntaxes/02_Extra/PowerShell dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Do machine-conversion from .tmLanguage to .sublime-syntax The new .sublime-syntax file is a pure "Tools" -> "Developer" -> "New Syntax from ..." conversion from a licenced version of Sublime Text, Version 3.1.1, Build 3176 with the .tmLanguage as the source file. No manual changes has been made. * Update regression test and add CHANGELOG.md entry Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Martin Nordholts <enselic@gmail.com>

commita02713dc15818dd2d82d5a38b45d2cc33a4de95c authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> dateSun 12 Dec 2021, 19:41 (5 years ago) parentee1f5a9
4 files changed+62−51
CHANGELOG.md+1 assets/syntaxes/02_Extra/PowerShell+1−1 assets/syntaxes/02_Extra/PowerShell.sublime-syntax+58−48 tests/syntax-tests/highlighted/PowerShell/test.ps1+2−2
CHANGELOG.md+1
@@ -42,6 +42,7 @@
4242- The `requirements.txt` syntax has been removed due to incompatible license requirements.
4343- Dart, new highlighter, see #1959 (@Ersikan)
4444- SCSS and Sass syntaxes updated, see #1766 (@Enselic)
45+- PowerShell syntax updated, see #1935 (@Enselic)
4546
4647## New themes
4748
assets/syntaxes/02_Extra/PowerShell+1−1

Submodule changed.

assets/syntaxes/02_Extra/PowerShell.sublime-syntax+58−48
@@ -24,7 +24,7 @@ contexts:
2424 - include: commands
2525 - include: commentLine
2626 - include: variable
27− - include: interpolatedStringContent
27+ - include: subexpression
2828 - include: function
2929 - include: attribute
3030 - include: UsingDirective
@@ -33,32 +33,38 @@ contexts:
3333 - include: doubleQuotedString
3434 - include: scriptblock
3535 - include: doubleQuotedStringEscapes
36− - match: (?<!')'
36+ - match: '[''\x{2018}-\x{201B}]'
3737 captures:
3838 0: punctuation.definition.string.begin.powershell
3939 push:
4040 - meta_scope: string.quoted.single.powershell
41− - match: "'(?!')"
41+ - match: '[''\x{2018}-\x{201B}]{2}'
42+ scope: constant.character.escape.powershell
43+ - match: '[''\x{2018}-\x{201B}]'
4244 captures:
4345 0: punctuation.definition.string.end.powershell
4446 pop: true
45− - match: "''"
46− scope: constant.character.escape.powershell
47− - match: \@"(?=$)
47+ - match: '(@["\x{201C}-\x{201E}])\s*$'
48+ captures:
49+ 1: punctuation.definition.string.begin.powershell
4850 push:
4951 - meta_scope: string.quoted.double.heredoc.powershell
50− - match: ^"@
52+ - match: '^["\x{201C}-\x{201E}]@'
53+ captures:
54+ 0: punctuation.definition.string.end.powershell
5155 pop: true
5256 - include: variableNoProperty
5357 - include: doubleQuotedStringEscapes
5458 - include: interpolation
55− - match: \@'(?=$)
59+ - match: '(@[''\x{2018}-\x{201B}])\s*$'
60+ captures:
61+ 1: punctuation.definition.string.begin.powershell
5662 push:
5763 - meta_scope: string.quoted.single.heredoc.powershell
58− - match: ^'@
64+ - match: '^[''\x{2018}-\x{201B}]@'
65+ captures:
66+ 0: punctuation.definition.string.end.powershell
5967 pop: true
60− - match: "''"
61− scope: constant.character.escape.powershell
6268 - include: numericConstant
6369 - match: (@)(\()
6470 captures:
@@ -71,11 +77,12 @@ contexts:
7177 0: punctuation.section.group.end.powershell
7278 pop: true
7379 - include: main
74− - match: (\$)(\()
80+ - match: ((\$))(\()
7581 comment: "TODO: move to repo; make recursive."
7682 captures:
77− 1: punctuation.definition.variable.powershell
78− 2: punctuation.section.group.begin.powershell
83+ 1: keyword.other.substatement.powershell
84+ 2: punctuation.definition.subexpression.powershell
85+ 3: punctuation.section.group.begin.powershell
7986 push:
8087 - meta_scope: meta.group.complex.subexpression.powershell
8188 - match: \)
@@ -85,7 +92,7 @@ contexts:
8592 - include: main
8693 - match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
8794 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)
95+ - match: (?<!\w|-|\.)((?i:begin|break|catch|clean|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)
8996 scope: keyword.control.powershell
9097 - match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
9198 scope: keyword.control.powershell
@@ -135,7 +142,7 @@ contexts:
135142 - meta_scope: meta.requires.powershell
136143 - match: $
137144 pop: true
138− - match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
145+ - match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version|Assembly|PSEdition)
139146 scope: keyword.other.powershell
140147 - match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
141148 scope: variable.parameter.powershell
@@ -187,51 +194,53 @@ contexts:
187194 comment: Builtin cmdlets with reserved verbs
188195 scope: support.function.powershell
189196 commentEmbeddedDocs:
190− - match: ^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))
197+ - match: (?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$
198+ comment: these embedded doc keywords do not support arguments, must be the only thing on the line
191199 scope: comment.documentation.embedded.powershell
192200 captures:
193201 1: constant.string.documentation.powershell
194202 2: keyword.operator.documentation.powershell
195− - match: '(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))'
203+ - match: (?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$
204+ comment: these embedded doc keywords require arguments though the type required may be inconsistent, they may not all be able to use the same argument match
196205 scope: comment.documentation.embedded.powershell
197206 captures:
198207 1: constant.string.documentation.powershell
199208 2: keyword.operator.documentation.powershell
200209 3: keyword.operator.documentation.powershell
201210 commentLine:
202− - match: '(?<![`\\-])#'
211+ - match: '(?<![`\\-])(#)#*'
203212 captures:
204− 0: punctuation.definition.comment.powershell
213+ 1: punctuation.definition.comment.powershell
205214 push:
206215 - meta_scope: comment.line.powershell
207216 - match: $\n?
208217 captures:
209− 0: punctuation.definition.comment.powershell
218+ 1: punctuation.definition.comment.powershell
210219 pop: true
211220 - include: commentEmbeddedDocs
212221 - include: RequiresDirective
213222 doubleQuotedString:
214− - match: (?<!(?<!`)")"
223+ - match: '["\x{201C}-\x{201E}]'
215224 captures:
216225 0: punctuation.definition.string.begin.powershell
217226 push:
218227 - meta_scope: string.quoted.double.powershell
219− - match: '"(?!")'
220− captures:
221− 0: punctuation.definition.string.end.powershell
222− pop: true
223228 - match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
224229 - include: variableNoProperty
225230 - include: doubleQuotedStringEscapes
231+ - match: '["\x{201C}-\x{201E}]{2}'
232+ scope: constant.character.escape.powershell
226233 - include: interpolation
227234 - match: '`\s*$'
228235 scope: keyword.other.powershell
236+ - match: '["\x{201C}-\x{201E}]'
237+ captures:
238+ 0: punctuation.definition.string.end.powershell
239+ pop: true
229240 doubleQuotedStringEscapes:
230− - match: '`[`0abefnrtv"''$]'
241+ - match: '`[`0abefnrtv''"\x{2018}-\x{201E}$]'
231242 scope: constant.character.escape.powershell
232243 - include: unicodeEscape
233− - match: '""'
234− scope: constant.character.escape.powershell
235244 function:
236245 - match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
237246 captures:
@@ -263,33 +272,23 @@ contexts:
263272 4: keyword.operator.assignment.powershell
264273 - include: scriptblock
265274 - include: main
266− interpolatedStringContent:
267− - match: \(
268− captures:
269− 0: punctuation.section.group.begin.powershell
270− push:
271− - meta_content_scope: interpolated.simple.source.powershell
272− - match: \)
273− captures:
274− 0: punctuation.section.group.end.powershell
275− pop: true
276− - include: main
277− - include: interpolation
278− - include: interpolatedStringContent
279275 interpolation:
280− - match: (\$)(\()
276+ - match: (((\$)))((\())
281277 captures:
282− 1: punctuation.definition.variable.powershell
283− 2: punctuation.section.group.begin.powershell
278+ 1: keyword.other.substatement.powershell
279+ 2: punctuation.definition.substatement.powershell
280+ 3: punctuation.section.embedded.substatement.begin.powershell
281+ 4: punctuation.section.group.begin.powershell
282+ 5: punctuation.section.embedded.substatement.begin.powershell
284283 push:
284+ - meta_scope: meta.embedded.substatement.powershell
285285 - meta_content_scope: interpolated.complex.source.powershell
286− - match: \)
286+ - match: (\))
287287 captures:
288288 0: punctuation.section.group.end.powershell
289+ 1: punctuation.section.embedded.substatement.end.powershell
289290 pop: true
290291 - include: main
291− - include: interpolation
292− - include: interpolatedStringContent
293292 numericConstant:
294293 - 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'
295294 captures:
@@ -330,6 +329,17 @@ contexts:
330329 0: punctuation.section.braces.end.powershell
331330 pop: true
332331 - include: main
332+ subexpression:
333+ - match: \(
334+ captures:
335+ 0: punctuation.section.group.begin.powershell
336+ push:
337+ - meta_scope: meta.group.simple.subexpression.powershell
338+ - match: \)
339+ captures:
340+ 0: punctuation.section.group.end.powershell
341+ pop: true
342+ - include: main
333343 type:
334344 - match: '\['
335345 captures:
tests/syntax-tests/highlighted/PowerShell/test.ps1+2−2
@@ -20,6 +20,6 @@
2020 'Path does not contain Rust'
2121}
2222
23−(5..30) | ? { $_ % (2 * 2 + 1) -eq 0 } | % {"In {0} minutes, the time will be {1}." -f $_, $( Get-FutureTime $_ )}
24−$later = Get-FutureTime -Minutes $( Get-Random -Minimum 60 -Maximum 120 )
23+(5..30) | ? { $_ % (2 * 2 + 1) -eq 0 } | % {"In {0} minutes, the time will be {1}." -f $_, $( Get-FutureTime $_ )}
24+$later = Get-FutureTime -Minutes $( Get-Random -Minimum 60 -Maximum 120 )
2525"The time will be " + $later + " later."