Skip to content

Commit 43a437b

Browse files
committed
Escape characters are valid without string quoting
1 parent d83caa6 commit 43a437b

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

PowerShell.sublime-syntax

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ contexts:
3636
- include: hashtable
3737
- include: strings
3838
- include: script-block
39-
# - include: double-quoted-string-escapes
39+
- include: escape-characters
4040
- include: numeric-constant
4141
- match: (@)(\()
4242
captures:
@@ -204,7 +204,7 @@ contexts:
204204
- include: variable-no-property
205205
- include: hashtable
206206
- include: script-block
207-
- include: double-quoted-string-escapes
207+
- include: escape-characters
208208
- include: double-quoted-string
209209
- include: type
210210
- include: numeric-constant
@@ -281,7 +281,7 @@ contexts:
281281
scope: punctuation.definition.string.end.powershell
282282
pop: true
283283
- include: variable-no-property
284-
- include: double-quoted-string-escapes
284+
- include: escape-characters
285285
- include: interpolation
286286
- match: \@'(?=$)
287287
scope: punctuation.definition.string.begin.powershell
@@ -309,7 +309,9 @@ contexts:
309309
scope: punctuation.definition.string.begin.powershell
310310
push:
311311
- meta_scope: string.quoted.double.powershell
312-
- include: double-quoted-string-escapes
312+
- match: '""'
313+
scope: constant.character.escape.powershell
314+
- include: escape-characters
313315
- match: '"'
314316
scope: punctuation.definition.string.end.powershell
315317
pop: true
@@ -320,13 +322,11 @@ contexts:
320322
- match: '`\s*$'
321323
scope: keyword.other.powershell
322324

323-
double-quoted-string-escapes:
325+
escape-characters:
324326
- match: '`[0abenfrvt"''$`]'
325327
scope: constant.character.escape.powershell
326328
- match: '`u\{\h+\}'
327329
scope: constant.character.escape.powershell
328-
- match: '""'
329-
scope: constant.character.escape.powershell
330330

331331
function:
332332
- match: ^(?:\s*)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)

Tests/syntax_test_PowerShell.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ $This is a 'double quoted'
428428
#^^^^ variable.language
429429
Isn't it "nice"??
430430
There is no @platting here!
431-
# ^ - punctuation.definition.variable
432-
# ^ - variable.other.readwrite
431+
# ^^^^^^^^^ - variable - punctuation
433432
"@
434433
# <- string.quoted.double.heredoc
435434
# <- string.quoted.double.heredoc
@@ -1306,6 +1305,10 @@ New-Object -TypeName System.Diagnostics.Process
13061305
# ^^^^^^^ - keyword.control
13071306
New-Object -TypeName System.Data
13081307
# ^^^^ - keyword.control
1308+
echo `"test`"
1309+
# ^^^^^^^^^ - string.quoted
1310+
# ^^ constant.character.escape
1311+
# ^^ constant.character.escape
13091312
@("any","array","has").foreach({ $_ })
13101313
# <- keyword.other.array.begin
13111314
# ^ meta.group.array-expression

0 commit comments

Comments
 (0)