Skip to content

Commit a9138a4

Browse files
committed
Use named contexts for group-likes
1 parent aec13fa commit a9138a4

File tree

1 file changed

+51
-41
lines changed

1 file changed

+51
-41
lines changed

PowerShell.sublime-syntax

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -168,71 +168,81 @@ contexts:
168168
groups:
169169
- match: \(
170170
scope: punctuation.section.group.begin.powershell
171-
push:
172-
- meta_scope: meta.group.powershell
173-
- match: \)
174-
scope: punctuation.section.group.end.powershell
175-
set: members
176-
# TODO: Move this to a foreach (X in Y) construct
177-
- match: \b(?i:in){{kebab_break}}
178-
scope: keyword.control.loop.in.powershell
179-
- include: attributes
180-
- include: expressions
171+
push: inside-group
172+
173+
inside-group:
174+
- meta_scope: meta.group.powershell
175+
- match: \)
176+
scope: punctuation.section.group.end.powershell
177+
set: members
178+
# TODO: Move this to a foreach (X in Y) construct
179+
- match: \b(?i:in){{kebab_break}}
180+
scope: keyword.control.loop.in.powershell
181+
- include: attributes
182+
- include: expressions
181183

182184
arrays:
183185
- match: (@)(\()
184186
captures:
185187
1: keyword.other.array.begin.powershell
186188
2: punctuation.section.group.begin.powershell
187-
push:
188-
- meta_scope: meta.group.array-expression.powershell
189-
- match: \)
190-
scope: punctuation.section.group.end.powershell
191-
pop: 1
192-
- include: expressions
189+
push: inside-array
190+
191+
inside-array:
192+
- meta_scope: meta.group.array-expression.powershell
193+
- match: \)
194+
scope: punctuation.section.group.end.powershell
195+
pop: 1
196+
- include: expressions
193197

194198
hashtables:
195199
- match: (@)(\{)
196200
captures:
197201
1: keyword.other.hashtable.begin.powershell
198202
2: punctuation.section.braces.begin.powershell
199-
push:
200-
- meta_scope: meta.hashtable.powershell
201-
- match: \}
202-
scope: punctuation.section.braces.end.powershell
203-
pop: 1
204-
- match: \b(['"]?)(\w+)(['"]?)\s*(=)\s*
205-
scope: meta.hashtable.assignment.powershell
206-
captures:
207-
1: punctuation.definition.string.begin.powershell
208-
2: variable.other.readwrite.powershell
209-
3: punctuation.definition.string.end.powershell
210-
4: keyword.operator.assignment.powershell
211-
- include: expressions
203+
push: inside-hashtable
204+
205+
inside-hashtable:
206+
- meta_scope: meta.hashtable.powershell
207+
- match: \}
208+
scope: punctuation.section.braces.end.powershell
209+
pop: 1
210+
- match: \b(['"]?)(\w+)(['"]?)\s*(=)\s*
211+
scope: meta.hashtable.assignment.powershell
212+
captures:
213+
1: punctuation.definition.string.begin.powershell
214+
2: variable.other.readwrite.powershell
215+
3: punctuation.definition.string.end.powershell
216+
4: keyword.operator.assignment.powershell
217+
- include: expressions
212218

213219
subexpressions:
214220
- match: (\$)(\()
215221
captures:
216222
1: keyword.other.variable.definition.powershell
217223
2: punctuation.section.group.begin.powershell
218-
push:
219-
- meta_scope: meta.group.complex.subexpression.powershell
220-
- match: \)
221-
scope: punctuation.section.group.end.powershell
222-
pop: 1
223-
- include: expressions
224+
push: inside-subexpression
225+
226+
inside-subexpression:
227+
- meta_scope: meta.group.complex.subexpression.powershell
228+
- match: \)
229+
scope: punctuation.section.group.end.powershell
230+
pop: 1
231+
- include: expressions
224232

225233
script-blocks:
226234
- match: (%)?(\{)
227235
captures:
228236
1: keyword.control.loop.for.powershell
229237
2: punctuation.section.braces.begin.powershell
230-
push:
231-
- meta_scope: meta.block.powershell
232-
- match: \}
233-
scope: punctuation.section.braces.end.powershell
234-
pop: 1
235-
- include: statements
238+
push: inside-script-block
239+
240+
inside-script-block:
241+
- meta_scope: meta.block.powershell
242+
- match: \}
243+
scope: punctuation.section.braces.end.powershell
244+
pop: 1
245+
- include: statements
236246

237247
###[ COMMANDS ]################################################################
238248

0 commit comments

Comments
 (0)