Skip to content

Commit d916071

Browse files
committed
Use regex strings in ValidatePattern
1 parent 56046c1 commit d916071

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

PowerShell.sublime-syntax

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,13 @@ contexts:
590590
- include: assignment-normal
591591

592592
attributes:
593+
- match: (\[)\s*(ValidatePattern)
594+
captures:
595+
1: punctuation.section.brackets.begin.powershell
596+
2: support.function.attribute.powershell
597+
push: inside-attribute
598+
with_prototype:
599+
- include: regex-strings
593600
- match: (\[)\s*({{attributes}})
594601
captures:
595602
1: punctuation.section.brackets.begin.powershell
@@ -1016,16 +1023,19 @@ contexts:
10161023
- include: single-quoted-heredoc-strings
10171024

10181025
expect-regex-string:
1026+
- include: regex-strings
1027+
- include: comma-separators
1028+
- include: else-pop
1029+
- include: pop-eol
1030+
1031+
regex-strings:
10191032
- match: '{{single_quote}}'
10201033
scope: meta.string.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell
10211034
embed: scope:source.regexp
10221035
embed_scope: meta.string.powershell source.regexp.embedded
10231036
escape: ({{single_quote}})
10241037
escape_captures:
10251038
1: meta.string.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell
1026-
- include: comma-separators
1027-
- include: else-pop
1028-
- include: pop-eol
10291039

10301040
single-quoted-strings:
10311041
- match: '{{single_quote}}'

Tests/syntax_test_Function.ps1

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -436,21 +436,10 @@ function Verb-Noun {
436436
# ^ punctuation.section.brackets.begin.powershell
437437
# ^^^^^^^^^^^^^^^ support.function.attribute.powershell
438438
# ^ punctuation.section.group.begin.powershell
439-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
440-
# ^ punctuation.definition.string.begin.powershell
441-
# ^^^^^^^ constant.other.placeholder.powershell
442-
# ^ punctuation.definition.placeholder.begin.powershell
443-
# ^ punctuation.separator.powershell
444-
# ^ punctuation.definition.placeholder.end.powershell
445-
# ^^^^^^ constant.other.placeholder.powershell
446-
# ^ punctuation.definition.placeholder.begin.powershell
447-
# ^ punctuation.separator.powershell
448-
# ^ punctuation.definition.placeholder.end.powershell
449-
# ^^^^ constant.other.placeholder.powershell
450-
# ^ punctuation.definition.placeholder.begin.powershell
451-
# ^ punctuation.separator.powershell
452-
# ^ punctuation.definition.placeholder.end.powershell
453-
# ^ punctuation.definition.string.end.powershell
439+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell
440+
# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
441+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp.embedded
442+
# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
454443
# ^ punctuation.section.group.end.powershell
455444
# ^ punctuation.section.brackets.end.powershell
456445
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.powershell

0 commit comments

Comments
 (0)